Prevent hotkey usage during transcription

This commit is contained in:
Beingpax 2025-07-02 12:09:57 +05:45
parent ccfc077cc1
commit 421d0d1a23
2 changed files with 19 additions and 4 deletions

View File

@ -245,12 +245,18 @@ class HotkeyManager: ObservableObject {
if isHandsFreeMode {
isHandsFreeMode = false
Task { @MainActor in await whisperState.handleToggleMiniRecorder() }
Task { @MainActor in
guard !whisperState.isTranscribing && !whisperState.isProcessing else { return }
await whisperState.handleToggleMiniRecorder()
}
return
}
if !whisperState.isMiniRecorderVisible {
Task { @MainActor in await whisperState.handleToggleMiniRecorder() }
Task { @MainActor in
guard !whisperState.isTranscribing && !whisperState.isProcessing else { return }
await whisperState.handleToggleMiniRecorder()
}
}
} else {
let now = Date()
@ -261,7 +267,10 @@ class HotkeyManager: ObservableObject {
if pressDuration < briefPressThreshold {
isHandsFreeMode = true
} else {
Task { @MainActor in await whisperState.handleToggleMiniRecorder() }
Task { @MainActor in
guard !whisperState.isTranscribing && !whisperState.isProcessing else { return }
await whisperState.handleToggleMiniRecorder()
}
}
}
@ -282,11 +291,13 @@ class HotkeyManager: ObservableObject {
if isShortcutHandsFreeMode {
isShortcutHandsFreeMode = false
guard !whisperState.isTranscribing && !whisperState.isProcessing else { return }
await whisperState.handleToggleMiniRecorder()
return
}
if !whisperState.isMiniRecorderVisible {
guard !whisperState.isTranscribing && !whisperState.isProcessing else { return }
await whisperState.handleToggleMiniRecorder()
}
}
@ -303,6 +314,7 @@ class HotkeyManager: ObservableObject {
if pressDuration < briefPressThreshold {
isShortcutHandsFreeMode = true
} else {
guard !whisperState.isTranscribing && !whisperState.isProcessing else { return }
await whisperState.handleToggleMiniRecorder()
}
}

View File

@ -263,7 +263,10 @@ struct SettingsView: View {
.alert("Reset Onboarding", isPresented: $showResetOnboardingAlert) {
Button("Cancel", role: .cancel) { }
Button("Reset", role: .destructive) {
hasCompletedOnboarding = false
// Defer state change to avoid layout issues while alert dismisses
DispatchQueue.main.async {
hasCompletedOnboarding = false
}
}
} message: {
Text("Are you sure you want to reset the onboarding? You'll see the introduction screens again the next time you launch the app.")