From ccfc077cc19483a3808a7a87f09dc597964c62e6 Mon Sep 17 00:00:00 2001 From: Beingpax Date: Wed, 2 Jul 2025 09:15:29 +0545 Subject: [PATCH] Fix hotkey checks and settings UI --- VoiceInk/Views/ContentView.swift | 2 +- VoiceInk/Views/MetricsView.swift | 2 +- VoiceInk/Views/PermissionsView.swift | 3 ++- VoiceInk/Views/Settings/SettingsView.swift | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/VoiceInk/Views/ContentView.swift b/VoiceInk/Views/ContentView.swift index c0e6610..15e35c7 100644 --- a/VoiceInk/Views/ContentView.swift +++ b/VoiceInk/Views/ContentView.swift @@ -168,7 +168,7 @@ struct ContentView: View { private var isSetupComplete: Bool { hasLoadedData && whisperState.currentTranscriptionModel != nil && - KeyboardShortcuts.getShortcut(for: .toggleMiniRecorder) != nil && + hotkeyManager.selectedHotkey1 != .none && AXIsProcessTrusted() && CGPreflightScreenCaptureAccess() } diff --git a/VoiceInk/Views/MetricsView.swift b/VoiceInk/Views/MetricsView.swift index e264194..85a6be0 100644 --- a/VoiceInk/Views/MetricsView.swift +++ b/VoiceInk/Views/MetricsView.swift @@ -69,7 +69,7 @@ struct MetricsView: View { private var isSetupComplete: Bool { hasLoadedData && whisperState.currentTranscriptionModel != nil && - KeyboardShortcuts.getShortcut(for: .toggleMiniRecorder) != nil && + hotkeyManager.selectedHotkey1 != .none && AXIsProcessTrusted() && CGPreflightScreenCaptureAccess() } diff --git a/VoiceInk/Views/PermissionsView.swift b/VoiceInk/Views/PermissionsView.swift index 081124b..5235236 100644 --- a/VoiceInk/Views/PermissionsView.swift +++ b/VoiceInk/Views/PermissionsView.swift @@ -183,6 +183,7 @@ struct PermissionCard: View { } struct PermissionsView: View { + @EnvironmentObject private var hotkeyManager: HotkeyManager @StateObject private var permissionManager = PermissionManager() var body: some View { @@ -216,7 +217,7 @@ struct PermissionsView: View { icon: "keyboard", title: "Keyboard Shortcut", description: "Set up a keyboard shortcut to use VoiceInk anywhere", - isGranted: permissionManager.isKeyboardShortcutSet, + isGranted: hotkeyManager.selectedHotkey1 != .none, buttonTitle: "Configure Shortcut", buttonAction: { NotificationCenter.default.post( diff --git a/VoiceInk/Views/Settings/SettingsView.swift b/VoiceInk/Views/Settings/SettingsView.swift index 52fe1f0..8ea8e66 100644 --- a/VoiceInk/Views/Settings/SettingsView.swift +++ b/VoiceInk/Views/Settings/SettingsView.swift @@ -48,7 +48,7 @@ struct SettingsView: View { } // "Add another hotkey" button - if hotkeyManager.selectedHotkey2 == .none { + if hotkeyManager.selectedHotkey1 != .none && hotkeyManager.selectedHotkey2 == .none { HStack { Spacer() Button(action: {