Move hotkey monitoring to HotkeyManager init
This commit is contained in:
parent
7986f4411d
commit
d08cac5a3a
@ -116,10 +116,11 @@ class HotkeyManager: ObservableObject {
|
||||
self.selectedHotkey2 = HotkeyOption(rawValue: UserDefaults.standard.string(forKey: "selectedHotkey2") ?? "") ?? .none
|
||||
self.whisperState = whisperState
|
||||
self.miniRecorderShortcutManager = MiniRecorderShortcutManager(whisperState: whisperState)
|
||||
}
|
||||
|
||||
func startHotkeyMonitoring() {
|
||||
setupHotkeyMonitoring()
|
||||
|
||||
Task { @MainActor in
|
||||
try? await Task.sleep(nanoseconds: 100_000_000)
|
||||
self.setupHotkeyMonitoring()
|
||||
}
|
||||
}
|
||||
|
||||
private func setupHotkeyMonitoring() {
|
||||
|
||||
@ -191,8 +191,6 @@ struct ContentView: View {
|
||||
.frame(minWidth: 940, minHeight: 730)
|
||||
.onAppear {
|
||||
hasLoadedData = true
|
||||
// Initialize hotkey monitoring after the app is ready
|
||||
hotkeyManager.startHotkeyMonitoring()
|
||||
}
|
||||
.onReceive(NotificationCenter.default.publisher(for: .navigateToDestination)) { notification in
|
||||
print("ContentView: Received navigation notification")
|
||||
|
||||
@ -161,7 +161,6 @@ struct OnboardingTutorialView: View {
|
||||
}
|
||||
}
|
||||
.onAppear {
|
||||
hotkeyManager.startHotkeyMonitoring()
|
||||
animateIn()
|
||||
isFocused = true
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user