mirror of
https://github.com/etesync/android
synced 2025-01-23 06:01:01 +00:00
Sync notifications: fix changes notifications to not show for items we pushed.
This commit is contained in:
parent
16f7187a77
commit
2b88ad6896
@ -381,9 +381,20 @@ constructor(protected val context: Context, protected val account: Account, prot
|
||||
|
||||
private fun persistItem(item: Item) {
|
||||
synchronized(etebaseLocalCache) {
|
||||
// FIXME: it's terrible that we are fetching and decrypting the item here - we really don't have to
|
||||
val cached = etebaseLocalCache.itemGet(itemMgr, cachedCollection.col.uid, item.uid)
|
||||
if (cached?.item?.etag != item.etag) {
|
||||
syncItemsTotal++
|
||||
|
||||
if (item.isDeleted) {
|
||||
syncItemsDeleted++
|
||||
} else {
|
||||
syncItemsChanged++
|
||||
}
|
||||
etebaseLocalCache.itemSet(itemMgr, cachedCollection.col.uid, item)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Throws(IOException::class, ContactsStorageException::class, CalendarStorageException::class, InvalidCalendarException::class)
|
||||
protected abstract fun processSyncEntryImpl(cEntry: SyncEntry)
|
||||
@ -415,6 +426,12 @@ constructor(protected val context: Context, protected val account: Account, prot
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
when (syncEntry.action) {
|
||||
ADD -> syncItemsChanged++
|
||||
SyncEntry.Actions.DELETE -> syncItemsDeleted++
|
||||
SyncEntry.Actions.CHANGE -> syncItemsChanged++
|
||||
}
|
||||
}
|
||||
|
||||
@Throws(IOException::class, CalendarStorageException::class, ContactsStorageException::class)
|
||||
@ -442,7 +459,6 @@ constructor(protected val context: Context, protected val account: Account, prot
|
||||
// Process new vcards from server
|
||||
val size = items.size
|
||||
var i = 0
|
||||
syncItemsTotal += size
|
||||
|
||||
for (item in items) {
|
||||
if (Thread.interrupted()) {
|
||||
@ -451,12 +467,6 @@ constructor(protected val context: Context, protected val account: Account, prot
|
||||
i++
|
||||
Logger.log.info("Processing (${i}/${size}) UID=${item.uid} Etag=${item.etag}")
|
||||
|
||||
if (item.isDeleted) {
|
||||
syncItemsDeleted++
|
||||
} else {
|
||||
syncItemsChanged++
|
||||
}
|
||||
|
||||
processItem(item)
|
||||
persistItem(item)
|
||||
}
|
||||
@ -516,13 +526,6 @@ constructor(protected val context: Context, protected val account: Account, prot
|
||||
error = e.toString()
|
||||
}
|
||||
|
||||
val action = cEntry.action
|
||||
when (action) {
|
||||
ADD -> syncItemsChanged++
|
||||
SyncEntry.Actions.DELETE -> syncItemsDeleted++
|
||||
SyncEntry.Actions.CHANGE -> syncItemsChanged++
|
||||
}
|
||||
|
||||
persistSyncEntry(entry.uid, cEntry, error)
|
||||
|
||||
remoteCTag = entry.uid
|
||||
|
Loading…
Reference in New Issue
Block a user