feat: Notitie editor in the app, dictation routed to system or editor

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-02 09:47:54 +02:00
co-authored by Claude Sonnet 5.5
parent ab7359156b
commit f390d310f4
12 changed files with 433 additions and 34 deletions
+24 -9
View File
@@ -1,18 +1,33 @@
import Foundation
/// Inserts text only while `shouldInsert()` says so (not when Sst itself is in front, nor for window recordings).
public struct GatedInserter: TextInserting {
private let inner: TextInserting
private let shouldInsert: () -> Bool
/// Where one dictation's text goes.
public enum InsertionRoute: Equatable, Sendable {
/// Pasted into whichever app is in front.
case system
/// Typed into the Notitie editor inside Sst.
case editor
/// Dropped (Sst is in front but nothing there takes text, or the recording started in the window).
case none
}
public init(inner: TextInserting, shouldInsert: @escaping () -> Bool) {
self.inner = inner
self.shouldInsert = shouldInsert
/// Sends each dictation to the system paster or the in-app editor, asked at insertion time rather than at creation.
public struct RoutingInserter: TextInserting {
private let system: TextInserting
private let editor: TextInserting
private let route: () -> InsertionRoute
public init(system: TextInserting, editor: TextInserting, route: @escaping () -> InsertionRoute) {
self.system = system
self.editor = editor
self.route = route
}
public func insert(_ text: String) async throws {
guard shouldInsert() else { return }
try await inner.insert(text)
switch route() {
case .system: try await system.insert(text)
case .editor: try await editor.insert(text)
case .none: break
}
}
}