mirror of
https://github.com/yattee/yattee.git
synced 2026-07-21 06:42:01 +00:00
Resume CloudKit sync from persisted state instead of full re-fetch
Previously CKSyncEngine was created with nil state serialization on every launch, replaying the entire zone change history (hundreds of merge/delete log lines and re-downloads each start). Now the saved state is loaded so launches only fetch changes since the last session. To make incremental sync safe: - Clear persisted state once when the record schema version increases, so records previously skipped as unsupported get re-delivered after an app update. - Handle remote zone deletion in fetchedDatabaseChanges by recreating the zone and re-uploading local data, instead of leaving sync dead. Account change and manual Refresh Sync still clear the state and force a full fetch as before.
This commit is contained in:
@@ -22,7 +22,8 @@ final class CloudKitRecordMapper {
|
||||
|
||||
/// Current schema version for CloudKit records.
|
||||
/// Increment this when record structure changes.
|
||||
private let currentSchemaVersion: Int64 = 2
|
||||
static let currentSchemaVersion: Int64 = 2
|
||||
private var currentSchemaVersion: Int64 { Self.currentSchemaVersion }
|
||||
|
||||
init(zone: CKRecordZone) {
|
||||
self.zone = zone
|
||||
|
||||
Reference in New Issue
Block a user