Commit 3cdfc706 authored by Ricki Hirner's avatar Ricki Hirner 🐑

Optimize read-only contact notifications

parent 29eb1fda
......@@ -148,13 +148,17 @@ class ContactsSyncManager(
for (group in localAddressBook.getDeletedGroups()) {
Logger.log.warning("Restoring locally deleted group (read-only address book!)")
group.resetDeleted()
numDiscarded++
}
for (contact in localAddressBook.getDeletedContacts()) {
Logger.log.warning("Restoring locally deleted contact (read-only address book!)")
notifyDiscardedChange()
contact.resetDeleted()
numDiscarded++
}
if (numDiscarded > 0)
notifyDiscardedChange()
} else
super.processLocallyDeleted()
}
......@@ -164,14 +168,18 @@ class ContactsSyncManager(
for (group in localAddressBook.getDirtyGroups()) {
Logger.log.warning("Resetting locally modified group to ETag=null (read-only address book!)")
group.clearDirty(null)
numDiscarded++
}
for (contact in localAddressBook.getDirtyContacts()) {
Logger.log.warning("Resetting locally modified contact to ETag=null (read-only address book!)")
notifyDiscardedChange()
contact.clearDirty(null)
numDiscarded++
}
if (numDiscarded > 0)
notifyDiscardedChange()
} else {
super.prepareDirty()
......@@ -222,7 +230,7 @@ class ContactsSyncManager(
.setSmallIcon(R.drawable.ic_delete_light)
.setLargeIcon(App.getLauncherBitmap(context))
.setContentTitle(context.getString(R.string.sync_contacts_read_only_address_book))
.setContentText(context.resources.getQuantityString(R.plurals.sync_contacts_local_contact_changes_discarded, ++numDiscarded, numDiscarded))
.setContentText(context.resources.getQuantityString(R.plurals.sync_contacts_local_contact_changes_discarded, numDiscarded, numDiscarded))
.setSubText(account.name)
.setCategory(NotificationCompat.CATEGORY_ERROR)
.setPriority(NotificationCompat.PRIORITY_LOW)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment