iOS: centralize canvas commands and capabilities
This commit is contained in:
@@ -155,17 +155,17 @@ final class BridgeConnectionController {
|
||||
}
|
||||
|
||||
private func currentCaps() -> [String] {
|
||||
var caps = ["canvas"]
|
||||
var caps = [ClawdisCapability.canvas.rawValue]
|
||||
|
||||
// Default-on: if the key doesn't exist yet, treat it as enabled.
|
||||
let cameraEnabled =
|
||||
UserDefaults.standard.object(forKey: "camera.enabled") == nil
|
||||
? true
|
||||
: UserDefaults.standard.bool(forKey: "camera.enabled")
|
||||
if cameraEnabled { caps.append("camera") }
|
||||
if cameraEnabled { caps.append(ClawdisCapability.camera.rawValue) }
|
||||
|
||||
let voiceWakeEnabled = UserDefaults.standard.bool(forKey: VoiceWakePreferences.enabledKey)
|
||||
if voiceWakeEnabled { caps.append("voiceWake") }
|
||||
if voiceWakeEnabled { caps.append(ClawdisCapability.voiceWake.rawValue) }
|
||||
|
||||
return caps
|
||||
}
|
||||
|
||||
@@ -266,12 +266,7 @@ final class NodeAppModel {
|
||||
|
||||
private func handleInvoke(_ req: BridgeInvokeRequest) async -> BridgeInvokeResponse {
|
||||
// Alias for "canvas" capability: accept canvas.* commands and map them to screen.*.
|
||||
let command =
|
||||
if req.command.hasPrefix("canvas.") {
|
||||
"screen." + req.command.dropFirst("canvas.".count)
|
||||
} else {
|
||||
req.command
|
||||
}
|
||||
let command = ClawdisInvokeCommandAliases.canonicalizeCanvasToScreen(req.command)
|
||||
|
||||
if command.hasPrefix("screen.") || command.hasPrefix("camera."), self.isBackgrounded {
|
||||
return BridgeInvokeResponse(
|
||||
|
||||
Reference in New Issue
Block a user