fix(ios): tighten calendar scope and avoid headless contacts prompts
This commit is contained in:
parent
184a590a3d
commit
3540c35cc2
@ -46,7 +46,7 @@ final class CalendarService: CalendarServicing {
|
||||
let status = EKEventStore.authorizationStatus(for: .event)
|
||||
let authorized: Bool
|
||||
if status == .notDetermined {
|
||||
authorized = await Self.requestEventAccess(store: store)
|
||||
authorized = await Self.requestWriteOnlyEventAccess(store: store)
|
||||
} else {
|
||||
authorized = EventKitAuthorization.allowsWrite(status: status)
|
||||
}
|
||||
@ -121,6 +121,22 @@ final class CalendarService: CalendarServicing {
|
||||
}
|
||||
}
|
||||
|
||||
private static func requestWriteOnlyEventAccess(store: EKEventStore) async -> Bool {
|
||||
if #available(iOS 17.0, *) {
|
||||
return await withCheckedContinuation { continuation in
|
||||
store.requestWriteOnlyAccessToEvents { granted, _ in
|
||||
continuation.resume(returning: granted)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return await withCheckedContinuation { continuation in
|
||||
store.requestAccess(to: .event) { granted, _ in
|
||||
continuation.resume(returning: granted)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static func resolveCalendar(
|
||||
store: EKEventStore,
|
||||
calendarId: String?,
|
||||
|
||||
@ -103,11 +103,8 @@ final class ContactsService: ContactsServicing {
|
||||
case .authorized, .limited:
|
||||
return true
|
||||
case .notDetermined:
|
||||
return await withCheckedContinuation { continuation in
|
||||
store.requestAccess(for: .contacts) { granted, _ in
|
||||
continuation.resume(returning: granted)
|
||||
}
|
||||
}
|
||||
// Avoid prompting during node.invoke; headless/unattended flows should fail fast.
|
||||
return false
|
||||
case .restricted, .denied:
|
||||
return false
|
||||
@unknown default:
|
||||
|
||||
@ -54,6 +54,8 @@
|
||||
<string>OpenClaw uses your calendars to show events and scheduling context when you enable calendar access.</string>
|
||||
<key>NSCalendarsFullAccessUsageDescription</key>
|
||||
<string>OpenClaw uses your calendars to show events and scheduling context when you enable calendar access.</string>
|
||||
<key>NSCalendarsWriteOnlyAccessUsageDescription</key>
|
||||
<string>OpenClaw uses your calendars to add events when you enable calendar access.</string>
|
||||
<key>NSContactsUsageDescription</key>
|
||||
<string>OpenClaw uses your contacts so you can search and reference people while using the assistant.</string>
|
||||
<key>NSLocalNetworkUsageDescription</key>
|
||||
|
||||
@ -136,6 +136,7 @@ targets:
|
||||
NSCameraUsageDescription: OpenClaw can capture photos or short video clips when requested via the gateway.
|
||||
NSCalendarsUsageDescription: OpenClaw uses your calendars to show events and scheduling context when you enable calendar access.
|
||||
NSCalendarsFullAccessUsageDescription: OpenClaw uses your calendars to show events and scheduling context when you enable calendar access.
|
||||
NSCalendarsWriteOnlyAccessUsageDescription: OpenClaw uses your calendars to add events when you enable calendar access.
|
||||
NSContactsUsageDescription: OpenClaw uses your contacts so you can search and reference people while using the assistant.
|
||||
NSLocationWhenInUseUsageDescription: OpenClaw uses your location when you allow location sharing.
|
||||
NSLocationAlwaysAndWhenInUseUsageDescription: OpenClaw can share your location in the background when you enable Always.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user