Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 11 additions & 30 deletions Sources/Fluid/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2017,38 +2017,21 @@ struct ContentView: View {
let activeDictationSlot = self.currentDictationShortcutSlot(for: modeAtStop)
let promptOverride = self.promptModeOverrideText
let promptTest = DictationPromptTestCoordinator.shared
let shouldUseAIOnStop = 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
var didRequestOverlayHideOnStop = false
DebugLogger.shared.info(
"Routing decision snapshot | activeMode=\(modeAtStop.rawValue) | rewrite=\(wasRewriteMode) | command=\(wasCommandMode) | overlay=\(NotchContentState.shared.mode.rawValue)",
source: "ContentView"
)

self.clearActiveRecordingMode()

if shouldHideOverlayOnStop {
didRequestOverlayHideOnStop = true
DebugLogger.shared.debug("Hiding dictation overlay at stop path", source: "ContentView")
self.hideOverlayAsync(reason: "stop_path")
} else {
// Show "Transcribing" state before calling stop() when the overlay needs
// to remain available for prompt, command, rewrite, or AI feedback.
DebugLogger.shared.debug("Showing transcription processing state", source: "ContentView")
self.appBench("processing_ui_request status=Transcribing")
self.menuBarManager.setProcessing(true)
NotchOverlayManager.shared.updateTranscriptionText("Transcribing")
self.appBench("processing_ui_requested status=Transcribing")

// Give SwiftUI a chance to render the processing state before heavier work.
await Task.yield()
}
DebugLogger.shared.debug("Showing transcription processing state", source: "ContentView")
self.appBench("processing_ui_request status=Transcribing")
self.menuBarManager.setProcessing(true)
NotchOverlayManager.shared.updateTranscriptionText("Transcribing")
self.appBench("processing_ui_requested status=Transcribing")

// Give SwiftUI a chance to render the processing state before heavier work.
await Task.yield()

// Stop the ASR service and wait for transcription to complete
// The processing indicator will stay visible during this phase
Expand All @@ -2073,9 +2056,7 @@ struct ContentView: View {
guard transcribedText.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty == false else {
DebugLogger.shared.debug("Transcription returned empty text", source: "ContentView")
// Finish the same short exit transition even when no text is emitted.
if !didRequestOverlayHideOnStop {
await self.menuBarManager.finishProcessingAndHideOverlay()
}
await self.menuBarManager.finishProcessingAndHideOverlay()
return
}

Expand Down Expand Up @@ -2387,7 +2368,7 @@ struct ContentView: View {
tracksDictionaryCorrections: true
)
didTypeExternally = true
if !shouldShowAIProcessingFailure, !didRequestOverlayHideOnStop {
if !shouldShowAIProcessingFailure {
self.hideOverlayAfterOutput()
}
}
Expand Down Expand Up @@ -2428,7 +2409,7 @@ struct ContentView: View {
)
}

if !didTypeExternally, !shouldShowAIProcessingFailure, !didRequestOverlayHideOnStop {
if !didTypeExternally, !shouldShowAIProcessingFailure {
self.hideOverlayAfterOutput()
}
}
Expand Down
Loading