diff options
-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() |