diff options
author | Ricki Hirner <hirner@bitfire.at> | 2022-10-21 14:39:49 +0300 |
---|---|---|
committer | Ricki Hirner <hirner@bitfire.at> | 2022-10-21 14:41:22 +0300 |
commit | a8e21bed8b944975a17508accec5481dc63830fc (patch) | |
tree | 298592e19e225c00714a20cc1c065fa9c74e98ee | |
parent | 7b70cf45fc46754a9aeea3cfec78d97deeda9382 (diff) |
Force downloading all contacts after resetting read-only contacts when collection supports Collection Sync
-rw-r--r-- | app/src/main/java/at/bitfire/davdroid/syncadapter/ContactsSyncManager.kt | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/app/src/main/java/at/bitfire/davdroid/syncadapter/ContactsSyncManager.kt b/app/src/main/java/at/bitfire/davdroid/syncadapter/ContactsSyncManager.kt index 09c3abb0..82e84f78 100644 --- a/app/src/main/java/at/bitfire/davdroid/syncadapter/ContactsSyncManager.kt +++ b/app/src/main/java/at/bitfire/davdroid/syncadapter/ContactsSyncManager.kt @@ -159,10 +159,11 @@ class ContactsSyncManager( } } - override fun syncAlgorithm() = if (hasCollectionSync) - SyncAlgorithm.COLLECTION_SYNC - else - SyncAlgorithm.PROPFIND_REPORT + override fun syncAlgorithm() = + if (hasCollectionSync) + SyncAlgorithm.COLLECTION_SYNC + else + SyncAlgorithm.PROPFIND_REPORT override fun processLocallyDeleted() = if (readOnly) { @@ -179,6 +180,12 @@ class ContactsSyncManager( modified = true } + /* This is unfortunately dirty: When a contact has been inserted to a read-only address book + that supports Collection Sync, it's not enough to force synchronization (by returning true), + but we also need to make sure all contacts are downloaded again. */ + if (modified) + localCollection.lastSyncState = null + modified } else // mirror deletions to remote collection (DELETE) @@ -200,6 +207,10 @@ class ContactsSyncManager( modified = true } + // see same position in processLocallyDeleted + if (modified) + localCollection.lastSyncState = null + } else // we only need to handle changes in groups when the address book is read/write groupStrategy.beforeUploadDirty() |