Skip to content

Fastest and only macOS Dictation app with on-device STT and custom trained AI enhancement model. Windows, iOS testflight! Android, Linux waitlist open! A local Wispr Flow alternative. Follow https://x.com/fluidvoiceapp for more

style(dictation): keep the stop pipeline under the lint limit

altic-dev5cbccaf8caf7
diff --git a/Sources/Fluid/ContentView.swift b/Sources/Fluid/ContentView.swift
index 84b30f0f..b7b57bdd 100644
--- a/Sources/Fluid/ContentView.swift
+++ b/Sources/Fluid/ContentView.swift
@@ -2264,7 +2264,8 @@ struct ContentView: View {
)
}
- private func completeDictationStopSnapshot(_ snapshot: inout DictationStopSnapshot) {
+ private func completeDictationStopSnapshot(_ stopSnapshot: inout DictationStopSnapshot?) {
+ guard var snapshot = stopSnapshot else { return }
let windowTitle = snapshot.target.flatMap { self.getFrontmostWindowTitle(ownerPid: $0.pid) }
var precedingText: String?
if snapshot.readsContextFromFocusedField,
@@ -2275,6 +2276,7 @@ struct ContentView: View {
precedingText = TypingService.textBeforeCursorInFocusedField()
}
snapshot.completeContext(windowTitle: windowTitle, precedingText: precedingText)
+ stopSnapshot = snapshot
}
private func prepareStoppedDictationDelivery(_ text: String, keepBackup: Bool, snapshot: DictationStopSnapshot?, needsRestoration: Bool) async -> Bool {
@@ -2774,12 +2776,8 @@ struct ContentView: View {
let shouldUseAIOnStop = stopSnapshot?.usesAI ?? activeDictationSlot.map {
DictationAIPostProcessingGate.isConfigured(for: $0, appBundleID: self.recordingAppInfo?.bundleId)
} ?? DictationAIPostProcessingGate.isConfigured(for: .primary, appBundleID: self.recordingAppInfo?.bundleId)
- let shouldHideOverlayOnStop = route == .normal &&
- !wasRewriteMode &&
- !wasCommandMode &&
- !promptTest.isActive &&
- !shouldUseAIOnStop &&
- !self.settings.spokenSendEnabled
+ let shouldHideOverlayOnStop = route == .normal && !wasRewriteMode && !wasCommandMode
+ && !promptTest.isActive && !shouldUseAIOnStop && !self.settings.spokenSendEnabled
DebugLogger.shared.info(
"Routing decision snapshot | activeMode=\(modeAtStop.rawValue) | rewrite=\(wasRewriteMode) | command=\(wasCommandMode) | overlay=\(NotchContentState.shared.mode.rawValue)",
source: "ContentView"
@@ -2804,10 +2802,7 @@ struct ContentView: View {
onFinalTranscriptionStarted: stopOverlay.onFinalTranscriptionStarted
)
self.appBench("asr_stop_return elapsedMs=\(Int(((ProcessInfo.processInfo.systemUptime - asrStopStartedAt) * 1000).rounded()))")
- if var snapshot = stopSnapshot {
- self.completeDictationStopSnapshot(&snapshot)
- stopSnapshot = snapshot
- }
+ self.completeDictationStopSnapshot(&stopSnapshot)
let audioSnapshot = self.asr.consumeLastCompletedAudioSnapshot()
let transcriptionDurationMilliseconds = self.asr.consumeLastFinalTranscriptionDurationMs()
DebugLogger.shared.info(