mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-15 12:36:23 +00:00
* feat(apps): Android, iPhone, and Watch approval clients Squash-rebased #103912 segment onto the deep-links tip on current main. Native approval surfaces: iOS approval presentation with gateway-switch lease preservation and resolution fencing, watchOS inbox + approval actions with shipped-shape payload codec, Android approval notices with publication-tokened dismissal. Native i18n inventory regenerated. (cherry picked from commit 428a76670ffeede54248b7bd7aa4438e2589851b) (cherry picked from commit 80225d5707c3645eeea5435f266131037b50ede6) (cherry picked from commit 2a23b714dc30d773a294aa45adc617e46b80732e) (cherry picked from commit 9ff1153827769e2cbab7c11c153f0f8634662c28) (cherry picked from commit 5b25723525bd562e5f97478af492f7b46ad30fd1) (cherry picked from commit 8c80e8467b5fe89aad0d4c74a0573f1600ed3af9) (cherry picked from commit ad4037bc9846bf6f082b41c129ee68aa344576c3) (cherry picked from commit fdf767dd662cff3c8a5a6d571f38f153410651ca) (cherry picked from commit 00c120376ffd992ea68ce29254a9bc0a25ed1740) (cherry picked from commitf36a95213e) (cherry picked from commit e2c25cbe2baacab44d21871d8cb6734704f065ac) (cherry picked from commit 7c4fda519080486d341a9f4df36d63f9e24b1235) (cherry picked from commit 1b3d4eda3dc5988012124597f9454ae21fb187a1) (cherry picked from commit2a60619722) (cherry picked from commit6f0c386567) (cherry picked from commit784a5857b7) (cherry picked from commit cbf294e026841c9bc2799da0fc7db666a69c52db) * fix(apps): harden approval reconciliation and watch states
186 lines
6.7 KiB
Swift
186 lines
6.7 KiB
Swift
import CoreLocation
|
|
import Foundation
|
|
import OpenClawKit
|
|
import UIKit
|
|
|
|
typealias OpenClawCameraSnapResult = (format: String, base64: String, width: Int, height: Int)
|
|
typealias OpenClawCameraClipResult = (format: String, base64: String, durationMs: Int, hasAudio: Bool)
|
|
|
|
protocol CameraServicing: Sendable {
|
|
func listDevices() async -> [CameraController.CameraDeviceInfo]
|
|
func snap(params: OpenClawCameraSnapParams) async throws -> OpenClawCameraSnapResult
|
|
func clip(params: OpenClawCameraClipParams) async throws -> OpenClawCameraClipResult
|
|
}
|
|
|
|
protocol ScreenRecordingServicing: Sendable {
|
|
func record(
|
|
screenIndex: Int?,
|
|
durationMs: Int?,
|
|
fps: Double?,
|
|
includeAudio: Bool?,
|
|
outPath: String?) async throws -> String
|
|
}
|
|
|
|
@MainActor
|
|
protocol LocationServicing: Sendable {
|
|
func authorizationStatus() -> CLAuthorizationStatus
|
|
func accuracyAuthorization() -> CLAccuracyAuthorization
|
|
func ensureAuthorization(mode: OpenClawLocationMode) async -> CLAuthorizationStatus
|
|
func currentLocation(
|
|
params: OpenClawLocationGetParams,
|
|
desiredAccuracy: OpenClawLocationAccuracy,
|
|
maxAgeMs: Int?,
|
|
timeoutMs: Int?) async throws -> CLLocation
|
|
func setBackgroundLocationUpdatesEnabled(_ enabled: Bool)
|
|
func setAuthorizationChangeHandler(
|
|
_ handler: @escaping @MainActor @Sendable (CLAuthorizationStatus) -> Void)
|
|
func startMonitoringSignificantLocationChanges(onUpdate: @escaping @Sendable (CLLocation) -> Void)
|
|
func stopMonitoringSignificantLocationChanges()
|
|
}
|
|
|
|
@MainActor
|
|
protocol DeviceStatusServicing: Sendable {
|
|
func status() async throws -> OpenClawDeviceStatusPayload
|
|
func info() -> OpenClawDeviceInfoPayload
|
|
}
|
|
|
|
protocol PhotosServicing: Sendable {
|
|
func latest(params: OpenClawPhotosLatestParams) async throws -> OpenClawPhotosLatestPayload
|
|
}
|
|
|
|
protocol ContactsServicing: Sendable {
|
|
func search(params: OpenClawContactsSearchParams) async throws -> OpenClawContactsSearchPayload
|
|
func add(params: OpenClawContactsAddParams) async throws -> OpenClawContactsAddPayload
|
|
}
|
|
|
|
protocol CalendarServicing: Sendable {
|
|
func events(params: OpenClawCalendarEventsParams) async throws -> OpenClawCalendarEventsPayload
|
|
func add(params: OpenClawCalendarAddParams) async throws -> OpenClawCalendarAddPayload
|
|
}
|
|
|
|
protocol RemindersServicing: Sendable {
|
|
func list(params: OpenClawRemindersListParams) async throws -> OpenClawRemindersListPayload
|
|
func add(params: OpenClawRemindersAddParams) async throws -> OpenClawRemindersAddPayload
|
|
}
|
|
|
|
protocol MotionServicing: Sendable {
|
|
func activities(params: OpenClawMotionActivityParams) async throws -> OpenClawMotionActivityPayload
|
|
func pedometer(params: OpenClawPedometerParams) async throws -> OpenClawPedometerPayload
|
|
}
|
|
|
|
struct WatchMessagingStatus: Equatable {
|
|
var supported: Bool
|
|
var paired: Bool
|
|
var appInstalled: Bool
|
|
var reachable: Bool
|
|
var activationState: String
|
|
}
|
|
|
|
struct WatchQuickReplyEvent: Codable, Equatable {
|
|
var replyId: String
|
|
var promptId: String
|
|
var actionId: String
|
|
var actionLabel: String?
|
|
var sessionKey: String?
|
|
var gatewayStableID: String?
|
|
var note: String?
|
|
var sentAtMs: Int64?
|
|
var transport: String
|
|
}
|
|
|
|
enum WatchMessageKind: String, Codable, Equatable {
|
|
case chat
|
|
case quickReply
|
|
}
|
|
|
|
struct WatchExecApprovalResolveEvent: Codable, Equatable {
|
|
var replyId: String
|
|
var approvalId: String
|
|
var gatewayStableID: String?
|
|
var decision: OpenClawWatchExecApprovalDecision
|
|
var sentAtMs: Int64?
|
|
var transport: String
|
|
}
|
|
|
|
struct WatchExecApprovalSnapshotRequestItem: Equatable {
|
|
var approvalId: String
|
|
var activeResolutionAttemptId: String?
|
|
}
|
|
|
|
struct WatchExecApprovalSnapshotRequestEvent: Equatable {
|
|
var requestId: String
|
|
var gatewayStableID: String?
|
|
var heldApprovals: [WatchExecApprovalSnapshotRequestItem]
|
|
var sentAtMs: Int64?
|
|
var transport: String
|
|
|
|
init(
|
|
requestId: String,
|
|
gatewayStableID: String? = nil,
|
|
heldApprovals: [WatchExecApprovalSnapshotRequestItem] = [],
|
|
sentAtMs: Int64?,
|
|
transport: String)
|
|
{
|
|
self.requestId = requestId
|
|
self.gatewayStableID = gatewayStableID
|
|
self.heldApprovals = heldApprovals
|
|
self.sentAtMs = sentAtMs
|
|
self.transport = transport
|
|
}
|
|
}
|
|
|
|
struct WatchAppSnapshotRequestEvent: Equatable {
|
|
var requestId: String
|
|
var sentAtMs: Int64?
|
|
var transport: String
|
|
}
|
|
|
|
struct WatchAppCommandEvent: Codable, Equatable {
|
|
var commandId: String
|
|
var command: OpenClawWatchAppCommand
|
|
var sessionKey: String?
|
|
var gatewayStableID: String?
|
|
var text: String?
|
|
var sentAtMs: Int64?
|
|
var transport: String
|
|
var messageKind: WatchMessageKind?
|
|
}
|
|
|
|
struct WatchNotificationSendResult: Equatable {
|
|
var deliveredImmediately: Bool
|
|
var queuedForDelivery: Bool
|
|
var transport: String
|
|
}
|
|
|
|
protocol WatchMessagingServicing: AnyObject, Sendable {
|
|
func status() async -> WatchMessagingStatus
|
|
func setStatusHandler(_ handler: (@Sendable (WatchMessagingStatus) -> Void)?)
|
|
func setReplyHandler(_ handler: (@Sendable (WatchQuickReplyEvent) -> Void)?)
|
|
func setExecApprovalResolveHandler(_ handler: (@Sendable (WatchExecApprovalResolveEvent) -> Void)?)
|
|
func setExecApprovalSnapshotRequestHandler(
|
|
_ handler: (@Sendable (WatchExecApprovalSnapshotRequestEvent) -> Void)?)
|
|
func setAppSnapshotRequestHandler(_ handler: (@Sendable (WatchAppSnapshotRequestEvent) -> Void)?)
|
|
func setAppCommandHandler(_ handler: (@Sendable (WatchAppCommandEvent) -> Void)?)
|
|
func sendDirectNodeSetup(setupCode: String) async throws -> WatchNotificationSendResult
|
|
func sendNotification(
|
|
id: String,
|
|
params: OpenClawWatchNotifyParams,
|
|
gatewayStableID: String?) async throws -> WatchNotificationSendResult
|
|
func sendExecApprovalPrompt(
|
|
_ message: OpenClawWatchExecApprovalPromptMessage) async throws -> WatchNotificationSendResult
|
|
func sendExecApprovalResolved(
|
|
_ message: OpenClawWatchExecApprovalResolvedMessage) async throws -> WatchNotificationSendResult
|
|
func sendExecApprovalExpired(
|
|
_ message: OpenClawWatchExecApprovalExpiredMessage) async throws -> WatchNotificationSendResult
|
|
func syncExecApprovalSnapshot(
|
|
_ message: OpenClawWatchExecApprovalSnapshotMessage) async throws -> WatchNotificationSendResult
|
|
func syncAppSnapshot(
|
|
_ message: OpenClawWatchAppSnapshotMessage) async throws -> WatchNotificationSendResult
|
|
func sendChatCompletion(
|
|
_ message: OpenClawWatchChatCompletionMessage) async throws -> WatchNotificationSendResult
|
|
}
|
|
|
|
extension CameraController: CameraServicing {}
|
|
extension ScreenRecordService: ScreenRecordingServicing {}
|
|
extension LocationService: LocationServicing {}
|