diff options
Diffstat (limited to 'DomainDig/CloudSyncService.swift')
| -rw-r--r-- | DomainDig/CloudSyncService.swift | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/DomainDig/CloudSyncService.swift b/DomainDig/CloudSyncService.swift index 1cf41d9..2cb4cfe 100644 --- a/DomainDig/CloudSyncService.swift +++ b/DomainDig/CloudSyncService.swift @@ -321,6 +321,20 @@ final class CloudSyncService { } } + func resetLocalStateAfterWipe() { + scheduledSyncTask?.cancel() + scheduledSyncTask = nil + syncTask?.cancel() + syncTask = nil + + let syncEnabled = defaults.bool(forKey: StorageKey.isEnabled) + isEnabled = syncEnabled + status = CloudSyncStatus(rawValue: defaults.string(forKey: StorageKey.status) ?? "") ?? (syncEnabled ? .synced : .disabled) + lastSyncDate = defaults.object(forKey: StorageKey.lastSyncDate) as? Date + lastErrorMessage = defaults.string(forKey: StorageKey.lastErrorMessage) + detailMessage = defaults.string(forKey: StorageKey.detailMessage) ?? "DomainDig stores synced data in your private iCloud account." + } + func acceptShare(metadata: CKShare.Metadata) async throws { guard let container = cloudKitContainer() else { throw CloudSyncRuntimeError.missingEntitlement |
