|
|
@ -15,9 +15,8 @@ public final class AppDelegate: NSObject, NSApplicationDelegate { |
|
|
private var remoteListener: NWListener? |
|
|
private var remoteListener: NWListener? |
|
|
|
|
|
|
|
|
public func applicationDidFinishLaunching(_ notification: Notification) { |
|
|
public func applicationDidFinishLaunching(_ notification: Notification) { |
|
|
if UserDefaults.standard.object(forKey: "SonioxPlaySounds") == nil { |
|
|
|
|
|
UserDefaults.standard.set(true, forKey: "SonioxPlaySounds") |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// Completely silent operation by default |
|
|
|
|
|
UserDefaults.standard.set(false, forKey: "SonioxPlaySounds") |
|
|
|
|
|
|
|
|
statusBarController = StatusBarController() |
|
|
statusBarController = StatusBarController() |
|
|
statusBarController.onToggleRecording = { [weak self] in |
|
|
statusBarController.onToggleRecording = { [weak self] in |
|
|
@ -63,8 +62,7 @@ public final class AppDelegate: NSObject, NSApplicationDelegate { |
|
|
// Connect to Linux Persistent Gateway (via local tunnel 18999 -> 8999) |
|
|
// Connect to Linux Persistent Gateway (via local tunnel 18999 -> 8999) |
|
|
RelayClient.shared.onRemoteUpdateReceived = { [weak self] text, cursor, isFullReplace in |
|
|
RelayClient.shared.onRemoteUpdateReceived = { [weak self] text, cursor, isFullReplace in |
|
|
guard let self = self else { return } |
|
|
guard let self = self else { return } |
|
|
print("AppDelegate: 📥 Clean Remote Input Update: '\(text.prefix(30))...' (replace: \(isFullReplace))") |
|
|
|
|
|
self.playSystemSound(name: "Tink") |
|
|
|
|
|
|
|
|
print("AppDelegate: 📥 Clean Remote Input Update (Silent): '\(text.prefix(30))...' (replace: \(isFullReplace))") |
|
|
HUDOverlayController.shared.show(state: .success(text: text)) |
|
|
HUDOverlayController.shared.show(state: .success(text: text)) |
|
|
FocusedInputSync.shared.applyRemoteUpdate(text: text, cursor: cursor, isFullReplace: isFullReplace) |
|
|
FocusedInputSync.shared.applyRemoteUpdate(text: text, cursor: cursor, isFullReplace: isFullReplace) |
|
|
} |
|
|
} |
|
|
@ -115,7 +113,6 @@ public final class AppDelegate: NSObject, NSApplicationDelegate { |
|
|
let text = json["text"] as? String { |
|
|
let text = json["text"] as? String { |
|
|
|
|
|
|
|
|
DispatchQueue.main.async { |
|
|
DispatchQueue.main.async { |
|
|
self.playSystemSound(name: "Tink") |
|
|
|
|
|
FocusedInputSync.shared.applyRemoteUpdate(text: text, cursor: nil, isFullReplace: true) |
|
|
FocusedInputSync.shared.applyRemoteUpdate(text: text, cursor: nil, isFullReplace: true) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
@ -152,7 +149,6 @@ public final class AppDelegate: NSObject, NSApplicationDelegate { |
|
|
guard !audioRecorder.isRecording, !isBusyFinalizing else { return } |
|
|
guard !audioRecorder.isRecording, !isBusyFinalizing else { return } |
|
|
|
|
|
|
|
|
latestPartialText = nil |
|
|
latestPartialText = nil |
|
|
playSystemSound(name: "Blow") |
|
|
|
|
|
|
|
|
|
|
|
let session = SonioxSessionPool.shared.acquireSession() |
|
|
let session = SonioxSessionPool.shared.acquireSession() |
|
|
self.activeSession = session |
|
|
self.activeSession = session |
|
|
@ -171,7 +167,6 @@ public final class AppDelegate: NSObject, NSApplicationDelegate { |
|
|
|
|
|
|
|
|
switch result { |
|
|
switch result { |
|
|
case .success(let text): |
|
|
case .success(let text): |
|
|
self.playSystemSound(name: "Hero") |
|
|
|
|
|
FocusedInputSync.shared.applyRemoteUpdate(text: text, cursor: nil, isFullReplace: false) |
|
|
FocusedInputSync.shared.applyRemoteUpdate(text: text, cursor: nil, isFullReplace: false) |
|
|
case .failure(let error): |
|
|
case .failure(let error): |
|
|
print("Soniox error:", error) |
|
|
print("Soniox error:", error) |
|
|
@ -206,9 +201,4 @@ public final class AppDelegate: NSObject, NSApplicationDelegate { |
|
|
|
|
|
|
|
|
session.finalizeStream() |
|
|
session.finalizeStream() |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private func playSystemSound(name: String) { |
|
|
|
|
|
guard UserDefaults.standard.bool(forKey: "SonioxPlaySounds") else { return } |
|
|
|
|
|
NSSound(named: name)?.play() |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |