Browse Source

feat: add applicationShouldHandleReopen and soniox://start URL scheme for instant Siri Shortcuts integration

main
Ali Alavi 1 week ago
parent
commit
a44fc57404
  1. BIN
      Frameworks/libonnxruntime.dylib
  2. BIN
      Frameworks/libsherpa-onnx-c-api.dylib
  3. 11
      Info.plist
  4. BIN
      resources/AppIcon.icns
  5. 32
      src/AppDelegate.swift

BIN
Frameworks/libonnxruntime.dylib

BIN
Frameworks/libsherpa-onnx-c-api.dylib

11
Info.plist

@ -37,5 +37,16 @@
<key>NSAllowsArbitraryLoads</key> <key>NSAllowsArbitraryLoads</key>
<true/> <true/>
</dict> </dict>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>com.soniox.voice</string>
<key>CFBundleURLSchemes</key>
<array>
<string>soniox</string>
</array>
</dict>
</array>
</dict> </dict>
</plist> </plist>

BIN
resources/AppIcon.icns

32
src/AppDelegate.swift

@ -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()
} }

Loading…
Cancel
Save