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
Fix onboarding playback recovery and effective prompt labels
altic-dev498bcbb05ca0
diff --git a/Sources/Fluid/Persistence/SettingsStore.swift b/Sources/Fluid/Persistence/SettingsStore.swiftindex e5c41cc0..c8aef45a 100644--- a/Sources/Fluid/Persistence/SettingsStore.swift+++ b/Sources/Fluid/Persistence/SettingsStore.swift@@ -755,19 +755,19 @@ final class SettingsStore: ObservableObject {let name = profile.name.trimmingCharacters(in: .whitespacesAndNewlines)return name.isEmpty ? "Untitled" : name}- return "Smart"+ return "Default"case .privateAI:if self.isAppDictationPromptBindingActive(for: slot, appBundleID: appBundleID) {if let profile = self.resolvedDictationPromptProfile(for: slot, appBundleID: appBundleID) {let name = profile.name.trimmingCharacters(in: .whitespacesAndNewlines)return name.isEmpty ? "Untitled" : name}- return "Smart"+ return "Default"}return "Smart"case let .profile(promptID):guard let profile = self.dictationPromptProfiles.first(where: { $0.id == promptID && $0.mode.normalized == .dictate }) else {- return "Smart"+ return "Default"}let name = profile.name.trimmingCharacters(in: .whitespacesAndNewlines)return name.isEmpty ? "Untitled" : namediff --git a/Sources/Fluid/UI/OnboardingAIEnhancementStepView.swift b/Sources/Fluid/UI/OnboardingAIEnhancementStepView.swiftindex 4cca9ea3..4cfc4b57 100644--- a/Sources/Fluid/UI/OnboardingAIEnhancementStepView.swift+++ b/Sources/Fluid/UI/OnboardingAIEnhancementStepView.swift@@ -144,6 +144,7 @@ struct OnboardingAIEnhancementStepView: View {}}self.action(id: "intro-continue", title: "Continue", tone: .primary, width: 160) {+ self.introductionFinished = trueself.showPractice = true}} else if !self.isReady {@@ -338,7 +339,7 @@ struct OnboardingAIEnhancementStepView: View {private var introductionScene: some View {ZStack(alignment: .top) {- if self.reduceMotion {+ if self.reduceMotion || self.introductionFinished {Color.clear.aspectRatio(1560.0 / 1096.0, contentMode: .fit)} else {OnboardingOverlayIntroductionView { self.introductionFinished = true }diff --git a/Sources/Fluid/UI/OnboardingOverlayIntroductionView.swift b/Sources/Fluid/UI/OnboardingOverlayIntroductionView.swiftindex d8a663b1..f2996ff2 100644--- a/Sources/Fluid/UI/OnboardingOverlayIntroductionView.swift+++ b/Sources/Fluid/UI/OnboardingOverlayIntroductionView.swift@@ -55,8 +55,11 @@ private struct OnboardingIntroductionPlayer: NSViewRepresentable {private var player: AVPlayer?private var observers: [NSObjectProtocol] = []private var statusObservation: NSKeyValueObservation?+ private var playbackObservation: NSKeyValueObservation?private var completed = falseprivate var startupTimeout: DispatchWorkItem?+ private var recoveryTimeout: DispatchWorkItem?+ private var isRecovering = falseprivate weak var view: IntroductionPlayerView?init(onComplete: @escaping () -> Void) {@@ -77,11 +80,23 @@ private struct OnboardingIntroductionPlayer: NSViewRepresentable {self.player = playerview.player = playerlet center = NotificationCenter.default- for name in [Notification.Name.AVPlayerItemDidPlayToEndTime, .AVPlayerItemFailedToPlayToEndTime, .AVPlayerItemPlaybackStalled] {+ for name in [Notification.Name.AVPlayerItemDidPlayToEndTime, .AVPlayerItemFailedToPlayToEndTime] {self.observers.append(center.addObserver(forName: name, object: item, queue: .main) { [weak self] _ inself?.finish()})}+ self.observers.append(center.addObserver(forName: .AVPlayerItemPlaybackStalled, object: item, queue: .main) { [weak self] _ in+ guard let self, !self.completed else { return }+ self.isRecovering = true+ self.updatePlayback()+ })+ self.playbackObservation = player.observe(\.timeControlStatus, options: [.new]) { [weak self] _, _ in+ DispatchQueue.main.async { [weak self] in+ guard let self, !self.completed, self.player?.timeControlStatus == .playing else { return }+ self.isRecovering = false+ self.cancelRecoveryTimeout()+ }+ }// A bundled movie should load quickly, but decoding failure must not trap onboarding.let timeout = DispatchWorkItem { [weak self] in self?.finish() }self.startupTimeout = timeout@@ -100,7 +115,7 @@ private struct OnboardingIntroductionPlayer: NSViewRepresentable {}}self.observers.append(center.addObserver(forName: NSApplication.didResignActiveNotification, object: nil, queue: .main) { [weak self] _ in- self?.player?.pause()+ self?.updatePlayback()})self.observers.append(center.addObserver(forName: NSApplication.didBecomeActiveNotification, object: nil, queue: .main) { [weak self] _ inself?.updatePlayback()@@ -112,14 +127,30 @@ private struct OnboardingIntroductionPlayer: NSViewRepresentable {guard !self.completed else { return }if NSApp.isActive, self.view?.window?.occlusionState.contains(.visible) == true {self.player?.play()+ if self.isRecovering, self.recoveryTimeout == nil {+ // A stall may recover on its own. Bound visible recovery without+ // counting time spent in another app or a hidden window.+ let timeout = DispatchWorkItem { [weak self] in self?.finish() }+ self.recoveryTimeout = timeout+ DispatchQueue.main.asyncAfter(deadline: .now() + 15, execute: timeout)+ }} else {self.player?.pause()+ self.cancelRecoveryTimeout()}}+ private func cancelRecoveryTimeout() {+ self.recoveryTimeout?.cancel()+ self.recoveryTimeout = nil+ }+private func finish() {guard !self.completed else { return }self.completed = true+ self.isRecovering = false+ self.cancelRecoveryTimeout()+ self.playbackObservation = nilself.startupTimeout?.cancel()self.startupTimeout = nil// Retain the final background frame while native practice appears over it.@@ -134,6 +165,9 @@ private struct OnboardingIntroductionPlayer: NSViewRepresentable {func stop() {self.completed = true+ self.isRecovering = false+ self.cancelRecoveryTimeout()+ self.playbackObservation = nilself.startupTimeout?.cancel()self.startupTimeout = nilself.player?.pause()diff --git a/Sources/Fluid/Views/BottomOverlayView.swift b/Sources/Fluid/Views/BottomOverlayView.swiftindex 73fd31ce..a071af34 100644--- a/Sources/Fluid/Views/BottomOverlayView.swift+++ b/Sources/Fluid/Views/BottomOverlayView.swift@@ -2433,7 +2433,7 @@ struct BottomOverlayView: View {case .off:return "Basic"case .privateAI:- return "Smart"+ return self.isAppPromptOverrideActive ? nil : "Smart"case .default:let hasAppOverride = self.settings.resolvedDictationPromptProfile(for: self.activeDictationShortcutSlot,