|
|
@ -409,6 +409,38 @@ public final class AppDelegate: NSObject, NSApplicationDelegate { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public func applicationShouldHandleReopen(_ sender: NSApplication, hasVisibleWindows flag: Bool) -> Bool { |
|
|
|
|
|
print("AppDelegate: Application reopen triggered. Starting voice recording...") |
|
|
|
|
|
DispatchQueue.main.async { [weak self] in |
|
|
|
|
|
guard let self = self else { return } |
|
|
|
|
|
if !self.audioRecorder.isRecording { |
|
|
|
|
|
self.startRecording() |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return false |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public func application(_ application: NSApplication, open urls: [URL]) { |
|
|
|
|
|
for url in urls { |
|
|
|
|
|
if url.scheme == "soniox" { |
|
|
|
|
|
let action = url.host ?? url.path |
|
|
|
|
|
if action.contains("start") { |
|
|
|
|
|
DispatchQueue.main.async { [weak self] in |
|
|
|
|
|
self?.startRecording() |
|
|
|
|
|
} |
|
|
|
|
|
} else if action.contains("stop") { |
|
|
|
|
|
DispatchQueue.main.async { [weak self] in |
|
|
|
|
|
self?.stopRecording() |
|
|
|
|
|
} |
|
|
|
|
|
} else if action.contains("toggle") { |
|
|
|
|
|
DispatchQueue.main.async { [weak self] in |
|
|
|
|
|
self?.toggleRecording() |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public func applicationWillTerminate(_ notification: Notification) { |
|
|
public func applicationWillTerminate(_ notification: Notification) { |
|
|
HotkeyManager.shared.unregisterHotkeys() |
|
|
HotkeyManager.shared.unregisterHotkeys() |
|
|
} |
|
|
} |
|
|
|