chore: commit all pending changes
This commit is contained in:
@@ -39,8 +39,27 @@ class AppDelegate: NSObject, UIApplicationDelegate {
|
||||
didReceiveRemoteNotification userInfo: [AnyHashable: Any],
|
||||
fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void
|
||||
) {
|
||||
// Handle CloudKit subscription notification
|
||||
// TODO: Re-implement subscription handling for ItineraryItem changes
|
||||
completionHandler(.noData)
|
||||
guard let notification = CKNotification(fromRemoteNotificationDictionary: userInfo) as? CKQueryNotification,
|
||||
let subscriptionID = notification.subscriptionID,
|
||||
CloudKitService.canonicalSubscriptionIDs.contains(subscriptionID),
|
||||
let recordType = CloudKitService.recordType(forSubscriptionID: subscriptionID) else {
|
||||
completionHandler(.noData)
|
||||
return
|
||||
}
|
||||
|
||||
Task { @MainActor in
|
||||
var changed = false
|
||||
|
||||
if notification.queryNotificationReason == .recordDeleted,
|
||||
let recordID = notification.recordID {
|
||||
changed = await BackgroundSyncManager.shared.applyDeletionHint(
|
||||
recordType: recordType,
|
||||
recordName: recordID.recordName
|
||||
)
|
||||
}
|
||||
|
||||
let updated = await BackgroundSyncManager.shared.triggerSyncFromPushNotification(subscriptionID: subscriptionID)
|
||||
completionHandler((changed || updated) ? .newData : .noData)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user