mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-12 13:16:05 +00:00
* feat(ios): add Apple Watch voice turns * chore(ios): sync native i18n inventory * fix(ios): preserve Watch message label
32 lines
829 B
Swift
32 lines
829 B
Swift
import Foundation
|
|
|
|
struct WatchVoiceTurnTracker: Equatable {
|
|
private(set) var commandId: String?
|
|
private(set) var isAwaitingReply = false
|
|
|
|
mutating func begin(commandId: String) {
|
|
self.commandId = commandId
|
|
self.isAwaitingReply = true
|
|
}
|
|
|
|
mutating func takeReply(completedCommandId: String?, text: String?) -> String? {
|
|
guard self.isAwaitingReply,
|
|
let completedCommandId,
|
|
completedCommandId == commandId,
|
|
let text = text?.trimmingCharacters(in: .whitespacesAndNewlines),
|
|
!text.isEmpty
|
|
else {
|
|
return nil
|
|
}
|
|
|
|
self.commandId = nil
|
|
self.isAwaitingReply = false
|
|
return text
|
|
}
|
|
|
|
mutating func cancel() {
|
|
self.commandId = nil
|
|
self.isAwaitingReply = false
|
|
}
|
|
}
|