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

feat(onboarding): add shortcut tryout step

altic-dev9e6ac814ae79
diff --git a/Sources/Fluid/ContentView.swift b/Sources/Fluid/ContentView.swift
index 3c29e81d..7690a555 100644
--- a/Sources/Fluid/ContentView.swift
+++ b/Sources/Fluid/ContentView.swift
@@ -1061,17 +1061,14 @@ struct ContentView: View {
self.settings.onboardingAISkipped = true
self.settings.setDictationPromptSelection(.off)
},
- markPlaygroundValidated: {
- self.settings.onboardingPlaygroundValidated = true
- self.settings.playgroundUsed = true
- self.playgroundUsed = true
- },
finishOnboarding: {
self.completeOnboardingIfPossible()
},
openAccessibilitySettings: self.openAccessibilitySettings,
restartApp: self.restartApp,
menuBarManager: self.menuBarManager,
+ activeShortcutRecordingTarget: self.$activeShortcutRecordingTarget,
+ shortcutRecordingMessage: self.$shortcutRecordingMessage,
theme: self.theme
)
.environmentObject(self.appServices)
@@ -1976,6 +1973,13 @@ struct ContentView: View {
// This ensures the user's preference for no capitalization/period is respected
finalText = ASRService.applyGAAVFormatting(finalText)
self.asr.finalText = finalText
+ if route == .onboardingSandbox,
+ !finalText.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty
+ {
+ self.settings.onboardingPlaygroundValidated = true
+ self.settings.playgroundUsed = true
+ self.playgroundUsed = true
+ }
DebugLogger.shared.info("Transcription finalized (chars: \(finalText.count))", source: "ContentView")
let finalTextReadyAt = ProcessInfo.processInfo.systemUptime
@@ -2157,13 +2161,16 @@ struct ContentView: View {
}
}
- private func currentDictationOutputRouteForHotkeyStop() -> DictationOutputRoute {
- let onboardingPlaygroundStep = 5
- let isOnboardingPlayground = !self.settings.onboardingCompleted &&
+ private var isOnboardingPlaygroundStepActive: Bool {
+ let onboardingPlaygroundStep = 4
+ return !self.settings.onboardingCompleted &&
self.settings.onboardingCurrentStep == onboardingPlaygroundStep
+ }
+
+ private func currentDictationOutputRouteForHotkeyStop() -> DictationOutputRoute {
let isDictationMode = self.activeRecordingMode == .dictate || self.activeRecordingMode == .promptMode
- if isOnboardingPlayground && isDictationMode {
+ if self.isOnboardingPlaygroundStepActive && isDictationMode {
return .onboardingSandbox
}
return .normal
@@ -3107,6 +3114,12 @@ extension ContentView {
private func beginDictationRecording(for slot: SettingsStore.DictationShortcutSlot, mode: ActiveRecordingMode) {
DebugLogger.shared.debug("Begin dictation recording for slot \(slot.rawValue)", source: "ContentView")
self.appBench("begin_recording slot=\(slot.rawValue) mode=\(mode.rawValue)")
+ if self.isOnboardingPlaygroundStepActive {
+ self.asr.finalText = ""
+ self.settings.onboardingPlaygroundValidated = false
+ self.settings.playgroundUsed = false
+ self.playgroundUsed = false
+ }
self.captureRecordingContext()
self.applyDictationShortcutSelectionContext(for: slot)
self.setActiveRecordingMode(mode)
diff --git a/Sources/Fluid/UI/OnboardingTryoutStepView.swift b/Sources/Fluid/UI/OnboardingTryoutStepView.swift
new file mode 100644
index 00000000..62f19440
--- /dev/null
+++ b/Sources/Fluid/UI/OnboardingTryoutStepView.swift
@@ -0,0 +1,401 @@
+import SwiftUI
+
+struct OnboardingTryoutStepView: View {
+ @Binding var finalText: String
+
+ let language: VoiceEngineLanguage
+ let shortcutDisplay: String
+ let isReady: Bool
+ let isRunning: Bool
+ let isRecordingShortcut: Bool
+ let shortcutRecordingMessage: String?
+ let onToggleShortcut: () -> Void
+
+ @Environment(\.accessibilityReduceMotion) private var reduceMotion
+ @Environment(\.theme) private var theme
+ @State private var isChangeHovered = false
+ @FocusState private var isEditorFocused: Bool
+ @State private var isShortcutKeyPressed = false
+ @State private var isShortcutGlowActive = false
+ @State private var shortcutAnimationRevision = 0
+
+ private static let languageExamples: [String: [String]] = [
+ "ar": [
+ "ذكرني أن أرسل الملاحظات قبل الخامسة.",
+ "اكتب رسالة قصيرة عن اجتماع اليوم.",
+ ],
+ "de": [
+ "Erinnere mich daran, die Notizen vor fünf zu senden.",
+ "Schreib eine kurze Nachricht über das heutige Treffen.",
+ ],
+ "en": [
+ "Remind me to send the notes before five.",
+ "Write a short update about today's meeting.",
+ ],
+ "es": [
+ "Recuérdame enviar las notas antes de las cinco.",
+ "Escribe una breve actualización sobre la reunión de hoy.",
+ ],
+ "fr": [
+ "Rappelle-moi d'envoyer les notes avant cinq heures.",
+ "Écris un court message sur la réunion d'aujourd'hui.",
+ ],
+ "hi": [
+ "मुझे पाँच बजे से पहले नोट्स भेजने की याद दिलाना।",
+ "आज की मीटिंग के बारे में एक छोटा अपडेट लिखो।",
+ ],
+ "it": [
+ "Ricordami di inviare gli appunti prima delle cinque.",
+ "Scrivi un breve aggiornamento sulla riunione di oggi.",
+ ],
+ "ja": [
+ "5時前にメモを送るようにリマインドして。",
+ "今日の会議について短い更新を書いて。",
+ ],
+ "ko": [
+ "다섯 시 전에 메모를 보내라고 알려줘.",
+ "오늘 회의에 대한 짧은 업데이트를 써줘.",
+ ],
+ "nl": [
+ "Herinner me eraan om de notities voor vijf uur te sturen.",
+ "Schrijf een korte update over de vergadering van vandaag.",
+ ],
+ "pl": [
+ "Przypomnij mi, żeby wysłać notatki przed piątą.",
+ "Napisz krótką aktualizację o dzisiejszym spotkaniu.",
+ ],
+ "pt": [
+ "Lembre-me de enviar as notas antes das cinco.",
+ "Escreva uma breve atualização sobre a reunião de hoje.",
+ ],
+ "ru": [
+ "Напомни мне отправить заметки до пяти.",
+ "Напиши короткое обновление о сегодняшней встрече.",
+ ],
+ "ta": [
+ "ஐந்து மணிக்கு முன் குறிப்புகளை அனுப்ப நினைவூட்டு.",
+ "இன்றைய கூட்டத்தைப் பற்றி ஒரு குறுகிய புதுப்பிப்பு எழுது.",
+ ],
+ "uk": [
+ "Нагадай мені надіслати нотатки до п'ятої.",
+ "Напиши коротке оновлення про сьогоднішню зустріч.",
+ ],
+ "vi": [
+ "Nhắc tôi gửi ghi chú trước năm giờ.",
+ "Viết một cập nhật ngắn về cuộc họp hôm nay.",
+ ],
+ "zh": [
+ "提醒我五点前发送笔记。",
+ "写一段关于今天会议的简短更新。",
+ ],
+ ]
+
+ private var exampleTexts: [String] {
+ Self.languageExamples[self.language.id] ?? []
+ }
+
+ private var promptText: String {
+ if self.exampleTexts.isEmpty {
+ return "Say anything you'd want to dictate in \(self.language.displayName)."
+ }
+ return "Try this, or say anything you'd want to dictate."
+ }
+
+ private var hasText: Bool {
+ !self.finalText.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty
+ }
+
+ private var shouldShowPlaceholder: Bool {
+ !self.hasText && !self.isEditorFocused
+ }
+
+ private var placeholderText: String {
+ if self.isReady {
+ return "Click here to test FluidVoice"
+ }
+ return self.isRunning ? "Listening..." : "Your dictation will appear here..."
+ }
+
+ var body: some View {
+ VStack(spacing: 12) {
+ self.keyboardCard
+
+ Text("Feels slow or inaccurate? Go back and try another model for \(self.language.displayName).")
+ .font(self.theme.typography.captionStrong)
+ .foregroundStyle(Color.white.opacity(0.44))
+ .multilineTextAlignment(.center)
+ .lineLimit(2)
+ }
+ .frame(width: 560)
+ .onAppear {
+ self.isShortcutGlowActive = self.isRunning
+ }
+ .onChange(of: self.isRunning) { _, newValue in
+ self.animateShortcutKeyToggle(to: newValue)
+ }
+ }
+
+ private var keyboardCard: some View {
+ let shape = RoundedRectangle(cornerRadius: 18, style: .continuous)
+
+ return VStack(spacing: 14) {
+ HStack {
+ Spacer()
+ self.changeShortcutButton
+ }
+ .frame(height: 0)
+ .offset(y: 8)
+
+ self.shortcutVisual
+ .padding(.top, 10)
+
+ self.actionHintRow
+
+ if let shortcutRecordingMessage,
+ self.isRecordingShortcut,
+ !shortcutRecordingMessage.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty
+ {
+ Label(shortcutRecordingMessage, systemImage: "exclamationmark.triangle.fill")
+ .font(self.theme.typography.captionSmall)
+ .foregroundStyle(Color.orange.opacity(0.92))
+ .lineLimit(1)
+ .minimumScaleFactor(0.82)
+ }
+
+ self.editorPanel
+ }
+ .padding(.horizontal, 18)
+ .padding(.top, 16)
+ .padding(.bottom, 18)
+ .background(
+ shape
+ .fill(Color.white.opacity(0.040))
+ .overlay(shape.stroke(Color.white.opacity(0.11), lineWidth: 1))
+ .overlay(
+ shape.stroke(
+ FluidOnboardingLandingColors.blue.opacity(self.isShortcutGlowActive ? 0.30 : 0.12),
+ lineWidth: self.isShortcutGlowActive ? 1.3 : 1
+ )
+ )
+ )
+ .accessibilityElement(children: .combine)
+ .accessibilityLabel("Dictation shortcut \(self.shortcutDisplay). Press once to start. Press again to stop.")
+ }
+
+ private var changeShortcutButton: some View {
+ let shape = Capsule()
+ let isEnabled = !self.isRunning
+ let title = self.isRecordingShortcut ? "Cancel" : "Change"
+ let fillOpacity = isEnabled ? (self.isChangeHovered ? 0.11 : 0.07) : 0.045
+ let foregroundOpacity = isEnabled ? (self.isChangeHovered ? 0.94 : 0.78) : 0.42
+ let ringOpacity = self.isChangeHovered && isEnabled ? 0.50 : 0
+
+ return Button {
+ self.onToggleShortcut()
+ } label: {
+ Text(title)
+ .font(self.theme.typography.captionStrong)
+ .foregroundStyle(.white.opacity(foregroundOpacity))
+ .lineLimit(1)
+ .minimumScaleFactor(0.72)
+ .frame(width: 72, height: 32)
+ .background(
+ shape
+ .fill(Color.white.opacity(fillOpacity))
+ .overlay(shape.stroke(self.isChangeHovered && isEnabled ? FluidOnboardingLandingColors.blue.opacity(0.30) : Color.white.opacity(0.07), lineWidth: 1))
+ .overlay(
+ shape
+ .stroke(FluidOnboardingLandingColors.blue.opacity(ringOpacity), lineWidth: self.isChangeHovered && isEnabled ? 1.4 : 1)
+ .padding(-2)
+ )
+ .shadow(color: FluidOnboardingLandingColors.blue.opacity(self.isChangeHovered && isEnabled ? 0.08 : 0), radius: 16, x: 0, y: 6)
+ )
+ .contentShape(shape)
+ }
+ .buttonStyle(.plain)
+ .focusable(false)
+ .contentShape(shape)
+ .disabled(!isEnabled)
+ .onHover { isHovered in
+ self.setChangeHovered(isHovered && isEnabled)
+ }
+ }
+
+ private var shortcutVisual: some View {
+ HStack(spacing: 14) {
+ self.sideKeyBox()
+ self.shortcutKeycap(self.shortcutDisplay)
+ self.sideKeyBox()
+ }
+ }
+
+ private var actionHintRow: some View {
+ Text("Press once to start. Press again to stop.")
+ .font(self.theme.typography.captionStrong)
+ .foregroundStyle(Color.white.opacity(0.62))
+ .multilineTextAlignment(.center)
+ .lineLimit(1)
+ .minimumScaleFactor(0.82)
+ .frame(maxWidth: .infinity)
+ .padding(.top, 2)
+ }
+
+ private var editorPanel: some View {
+ let shape = RoundedRectangle(cornerRadius: 14, style: .continuous)
+ let examples = Array(self.exampleTexts.prefix(1))
+
+ return VStack(alignment: .leading, spacing: 10) {
+ if !examples.isEmpty {
+ Text(self.promptText)
+ .font(self.theme.typography.captionStrong)
+ .foregroundStyle(Color.white.opacity(0.58))
+
+ ForEach(examples, id: \.self) { example in
+ self.examplePill(example)
+ }
+ } else {
+ self.examplePill("Say anything in \(self.language.displayName).")
+ }
+
+ ZStack(alignment: .topLeading) {
+ TextEditor(text: self.$finalText)
+ .font(self.theme.typography.bodyStrong)
+ .foregroundStyle(.white)
+ .frame(height: 108)
+ .padding(10)
+ .background(
+ RoundedRectangle(cornerRadius: 12, style: .continuous)
+ .fill(Color.white.opacity(self.isRunning ? 0.075 : 0.045))
+ .overlay(
+ RoundedRectangle(cornerRadius: 12, style: .continuous)
+ .stroke(
+ self.isRunning ? FluidOnboardingLandingColors.blue.opacity(0.46) : Color.white.opacity(0.08),
+ lineWidth: self.isRunning ? 1.4 : 1
+ )
+ )
+ )
+ .scrollContentBackground(.hidden)
+ .focused(self.$isEditorFocused)
+
+ if self.shouldShowPlaceholder {
+ Text(self.placeholderText)
+ .font(self.theme.typography.bodySmallStrong)
+ .foregroundStyle(Color.white.opacity(0.38))
+ .frame(maxWidth: .infinity, alignment: .leading)
+ .padding(.horizontal, 16)
+ .padding(.vertical, 17)
+ .allowsHitTesting(false)
+ }
+ }
+ }
+ .padding(.horizontal, 2)
+ .padding(.top, 4)
+ }
+
+ private func sideKeyBox() -> some View {
+ RoundedRectangle(cornerRadius: 8, style: .continuous)
+ .fill(
+ LinearGradient(
+ colors: [
+ Color.white.opacity(0.055),
+ Color.white.opacity(0.020),
+ ],
+ startPoint: .topLeading,
+ endPoint: .bottomTrailing
+ )
+ )
+ .overlay(
+ RoundedRectangle(cornerRadius: 8, style: .continuous)
+ .stroke(Color.white.opacity(0.08), lineWidth: 1)
+ )
+ .frame(width: 88, height: 66)
+ }
+
+ private func shortcutKeycap(_ text: String) -> some View {
+ let shape = RoundedRectangle(cornerRadius: 10, style: .continuous)
+ let isPressed = self.isShortcutKeyPressed
+ let isListening = self.isShortcutGlowActive
+
+ return Text(text)
+ .font(.system(size: 20, weight: .semibold))
+ .foregroundStyle(.white)
+ .lineLimit(1)
+ .minimumScaleFactor(0.62)
+ .padding(.horizontal, 14)
+ .frame(width: 112, height: 74)
+ .background(
+ shape
+ .fill(Color.white.opacity(isListening ? 0.115 : 0.075))
+ .overlay(
+ shape.stroke(
+ FluidOnboardingLandingColors.blue.opacity(isListening ? 0.86 : 0.48),
+ lineWidth: isListening ? 1.6 : 1.2
+ )
+ )
+ .shadow(
+ color: FluidOnboardingLandingColors.blue.opacity(isListening ? 0.34 : 0.20),
+ radius: isListening ? 18 : 12,
+ x: 0,
+ y: isPressed ? 2 : 0
+ )
+ )
+ .scaleEffect(isPressed ? 0.965 : 1)
+ .offset(y: isPressed ? 4 : 0)
+ .accessibilityLabel("Current shortcut \(text)")
+ }
+
+ private func examplePill(_ text: String) -> some View {
+ Text(text)
+ .font(self.theme.typography.captionStrong)
+ .foregroundStyle(Color.white.opacity(0.72))
+ .lineLimit(2)
+ .minimumScaleFactor(0.82)
+ .frame(maxWidth: .infinity, alignment: .leading)
+ .padding(.horizontal, 11)
+ .padding(.vertical, 7)
+ .background(
+ RoundedRectangle(cornerRadius: 9, style: .continuous)
+ .fill(FluidOnboardingLandingColors.blue.opacity(0.08))
+ .overlay(
+ RoundedRectangle(cornerRadius: 9, style: .continuous)
+ .stroke(FluidOnboardingLandingColors.blue.opacity(0.16), lineWidth: 1)
+ )
+ )
+ }
+
+ private func setChangeHovered(_ isHovered: Bool) {
+ guard self.isChangeHovered != isHovered else { return }
+ if self.reduceMotion {
+ self.isChangeHovered = isHovered
+ } else {
+ withAnimation(.easeOut(duration: 0.14)) {
+ self.isChangeHovered = isHovered
+ }
+ }
+ }
+
+ private func animateShortcutKeyToggle(to isListening: Bool) {
+ self.shortcutAnimationRevision += 1
+ let revision = self.shortcutAnimationRevision
+
+ if self.reduceMotion {
+ self.isShortcutKeyPressed = false
+ self.isShortcutGlowActive = isListening
+ return
+ }
+
+ withAnimation(.easeOut(duration: 0.055)) {
+ self.isShortcutKeyPressed = true
+ }
+
+ DispatchQueue.main.asyncAfter(deadline: .now() + 0.11) {
+ guard self.shortcutAnimationRevision == revision else {
+ return
+ }
+ withAnimation(.spring(response: 0.18, dampingFraction: 0.72, blendDuration: 0.02)) {
+ self.isShortcutKeyPressed = false
+ self.isShortcutGlowActive = isListening
+ }
+ }
+ }
+}
diff --git a/Sources/Fluid/UI/WelcomeView.swift b/Sources/Fluid/UI/WelcomeView.swift
index 7cf352b4..55b286a5 100644
--- a/Sources/Fluid/UI/WelcomeView.swift
+++ b/Sources/Fluid/UI/WelcomeView.swift
@@ -583,11 +583,12 @@ struct OnboardingFlowView: View {
let accessibilityEnabled: Bool
let accessibilitySetupInProgress: Bool
let markAISkipped: () -> Void
- let markPlaygroundValidated: () -> Void
let finishOnboarding: () -> Void
let openAccessibilitySettings: () -> Void
let restartApp: () -> Void
let menuBarManager: MenuBarManager
+ @Binding var activeShortcutRecordingTarget: ShortcutRecordingTarget?
+ @Binding var shortcutRecordingMessage: String?
let theme: AppTheme
@State private var selectedLanguageID = SettingsStore.shared.onboardingSelectedLanguageID
@@ -636,8 +637,8 @@ struct OnboardingFlowView: View {
case language = 1
case voiceModel = 2
case permissions = 3
- case aiEnhancement = 4
- case playground = 5
+ case playground = 4
+ case aiEnhancement = 5
var title: String {
switch self {
@@ -652,7 +653,7 @@ struct OnboardingFlowView: View {
case .aiEnhancement:
return "Set Up AI Enhancement"
case .playground:
- return "Run Playground Test"
+ return "Try FluidVoice"
}
}
@@ -669,7 +670,7 @@ struct OnboardingFlowView: View {
case .aiEnhancement:
return "Optional: Configure AI post-processing or skip this step."
case .playground:
- return "Record a quick sample to validate your setup before finishing."
+ return "Use your dictation shortcut once before finishing setup."
}
}
}
@@ -688,9 +689,9 @@ struct OnboardingFlowView: View {
private var usesCinematicStep: Bool {
switch self.step {
- case .landing, .language, .voiceModel, .permissions:
+ case .landing, .language, .voiceModel, .permissions, .playground:
return true
- case .aiEnhancement, .playground:
+ case .aiEnhancement:
return false
}
}
@@ -823,6 +824,10 @@ struct OnboardingFlowView: View {
return display.isEmpty ? "your shortcut" : display
}
+ private var isRecordingAnyShortcut: Bool {
+ self.activeShortcutRecordingTarget != nil
+ }
+
private var canContinue: Bool {
guard !self.isModelPreparationInProgress else {
return false
@@ -840,7 +845,7 @@ struct OnboardingFlowView: View {
case .aiEnhancement:
return self.isAIReady
case .playground:
- return self.isPlaygroundReady
+ return self.isPlaygroundReady && !self.asr.isRunning && !self.isRecordingAnyShortcut
}
}
@@ -850,7 +855,7 @@ struct OnboardingFlowView: View {
return "Next"
case .language:
return "Continue"
- case .playground:
+ case .aiEnhancement:
return "Finish Setup"
default:
return "Continue"
@@ -1331,7 +1336,7 @@ struct OnboardingFlowView: View {
canContinue: Bool,
continueAction: @escaping () -> Void
) -> some View {
- let canNavigateBack = !self.isModelPreparationInProgress
+ let canNavigateBack = !self.isModelPreparationInProgress && !self.asr.isRunning && !self.isRecordingAnyShortcut
return HStack {
self.cinematicFooterButton(
@@ -1433,6 +1438,7 @@ struct OnboardingFlowView: View {
self.isShowingAllLanguages = false
self.languageSearchText = ""
}
+ self.resetTryoutValidationForSetupChange()
}
}
@@ -1694,64 +1700,72 @@ struct OnboardingFlowView: View {
}
private var playgroundStep: some View {
- ScrollView {
- VStack(alignment: .leading, spacing: 16) {
- ThemedCard(style: .standard) {
- VStack(alignment: .leading, spacing: 14) {
- HStack {
- Text("Quick Playground Test")
- .font(self.theme.typography.sectionTitle)
- Spacer()
- if self.asr.isRunning {
- Text("Recording...")
- .font(self.theme.typography.captionStrong)
- .foregroundStyle(.red)
- }
- }
+ GeometryReader { proxy in
+ ZStack {
+ FluidOnboardingLandingBackdrop(glowCenter: self.landingGlowCenter)
- VStack(alignment: .leading, spacing: 8) {
- Text("Press Start Recording or use \(self.onboardingShortcutDisplay), then stop and confirm your text appears below.")
- .font(self.theme.typography.caption)
- .foregroundStyle(.secondary)
+ VStack(spacing: 0) {
+ FluidOnboardingCompactProgress(value: self.compactProgressValue)
+ .padding(.top, 28)
- Button(self.asr.isRunning ? "Stop Recording" : "Start Recording") {
- self.togglePlaygroundRecording()
- }
- .fluidButton(.primary, size: .large, isRecording: self.asr.isRunning)
- .disabled(self.asr.micStatus != .authorized)
- }
+ Color.clear
+ .frame(height: 34)
- TextEditor(text: Binding(
- get: { self.asr.finalText },
- set: { self.asr.finalText = $0 }
- ))
- .font(self.theme.typography.body)
- .frame(height: 170)
- .fluidOnboardingEditorSurface()
- .scrollContentBackground(.hidden)
-
- if self.isPlaygroundReady {
- HStack(spacing: 6) {
- Image(systemName: "checkmark.circle.fill")
- .foregroundStyle(self.theme.palette.success)
- Text("Playground test passed. You can finish setup.")
- .font(self.theme.typography.caption)
- .foregroundStyle(.secondary)
- }
- } else {
- Text("Record a short sample with the button or your hotkey and confirm transcription appears here.")
- .font(self.theme.typography.caption)
- .foregroundStyle(.secondary)
- }
+ VStack(spacing: 0) {
+ FluidOnboardingCompactAppIconMark(size: 66)
+ .padding(.bottom, 22)
+
+ Text("FluidVoice is ready.")
+ .font(.system(size: 28, weight: .semibold))
+ .foregroundStyle(.white)
+ .multilineTextAlignment(.center)
+ .lineLimit(2)
+ .minimumScaleFactor(0.74)
+ .padding(.horizontal, 32)
+ .padding(.bottom, 14)
+
+ Text("Now let's try it out.")
+ .font(.system(size: 15, weight: .medium))
+ .foregroundStyle(Color.white.opacity(0.62))
+ .padding(.bottom, 28)
+
+ OnboardingTryoutStepView(
+ finalText: Binding(
+ get: { self.asr.finalText },
+ set: { self.asr.finalText = $0 }
+ ),
+ language: self.selectedOnboardingLanguage,
+ shortcutDisplay: self.onboardingShortcutDisplay,
+ isReady: self.isPlaygroundReady,
+ isRunning: self.asr.isRunning,
+ isRecordingShortcut: self.activeShortcutRecordingTarget == .primaryDictation,
+ shortcutRecordingMessage: self.activeShortcutRecordingTarget == .primaryDictation ? self.shortcutRecordingMessage : nil,
+ onToggleShortcut: self.togglePrimaryShortcutRecording
+ )
+ }
+ .frame(maxWidth: .infinity)
+
+ Spacer(minLength: 28)
+
+ self.cinematicFooter(
+ continueTitle: "Continue",
+ canContinue: self.canContinue
+ ) {
+ self.handlePrimaryAction()
}
- .padding(16)
}
- }
- .padding(24)
- }
- .onChange(of: self.asr.finalText) { _, newValue in
- if !newValue.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
- self.markPlaygroundValidated()
+ .frame(width: proxy.size.width, height: proxy.size.height)
+
+ FluidOnboardingLandingHoverTracker(
+ onMove: { location, size in
+ self.updateLandingGlow(location: location, in: size)
+ },
+ onExit: {
+ self.resetLandingGlow()
+ }
+ )
+ .frame(width: proxy.size.width, height: proxy.size.height)
+ .accessibilityHidden(true)
}
}
}
@@ -1773,7 +1787,7 @@ struct OnboardingFlowView: View {
if self.step == .aiEnhancement {
Button("Skip this step") {
self.markAISkipped()
- self.goNext()
+ self.finishOnboarding()
}
.fluidOnboardingSecondaryButton()
}
@@ -1873,7 +1887,7 @@ struct OnboardingFlowView: View {
}
private func isOnboardingModelBundledOrInstalled(_ model: SettingsStore.SpeechModel) -> Bool {
- model == .appleSpeech || (model != .appleSpeechAnalyzer && model.isInstalled)
+ model.isInstalled
}
private func isPreparingOnboardingModel(_ model: SettingsStore.SpeechModel) -> Bool {
@@ -2492,6 +2506,7 @@ struct OnboardingFlowView: View {
}
if oldModel != self.settings.selectedSpeechModel || languageChanged {
+ self.resetTryoutValidationForSetupChange()
self.asr.resetTranscriptionProvider()
}
}
@@ -2529,6 +2544,23 @@ struct OnboardingFlowView: View {
}
}
+ private func togglePrimaryShortcutRecording() {
+ guard !self.asr.isRunning else { return }
+ if self.activeShortcutRecordingTarget == .primaryDictation {
+ self.activeShortcutRecordingTarget = nil
+ self.shortcutRecordingMessage = nil
+ } else {
+ self.shortcutRecordingMessage = nil
+ self.activeShortcutRecordingTarget = .primaryDictation
+ }
+ }
+
+ private func resetTryoutValidationForSetupChange() {
+ self.settings.onboardingPlaygroundValidated = false
+ self.settings.playgroundUsed = false
+ self.asr.finalText = ""
+ }
+
private func handleMicrophoneAction() {
if self.asr.micStatus == .notDetermined {
self.asr.requestMicAccess()
@@ -2538,10 +2570,14 @@ struct OnboardingFlowView: View {
}
private func goBack() {
+ self.activeShortcutRecordingTarget = nil
+ self.shortcutRecordingMessage = nil
self.currentStep = max(0, self.currentStep - 1)
}
private func goNext() {
+ self.activeShortcutRecordingTarget = nil
+ self.shortcutRecordingMessage = nil
self.currentStep = min(Step.allCases.count - 1, self.currentStep + 1)
}
@@ -2554,29 +2590,11 @@ struct OnboardingFlowView: View {
self.selectOnboardingRoute(route)
}
- if self.step == .playground {
- if !self.settings.onboardingPlaygroundValidated {
- self.markPlaygroundValidated()
- }
+ if self.step == .aiEnhancement {
+ guard self.isAIReady else { return }
self.finishOnboarding()
return
}
self.goNext()
}
-
- private func togglePlaygroundRecording() {
- Task { @MainActor in
- if self.asr.isRunning {
- let transcribed = await self.asr.stop()
- _ = self.asr.consumeLastCompletedAudioSnapshot()
- self.asr.finalText = ASRService.applyGAAVFormatting(transcribed)
- if !self.asr.finalText.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
- self.markPlaygroundValidated()
- }
- } else {
- self.asr.finalText = ""
- await self.asr.start()
- }
- }
- }
}