From 9ff83d5bfd5512338a1e719c7e1bd5f8e3e4a777 Mon Sep 17 00:00:00 2001 From: Alex Baker Date: Tue, 19 May 2020 14:45:33 -0500 Subject: [PATCH] Process updates in order supplied from server --- app/src/main/java/org/tasks/caldav/CaldavSynchronizer.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/org/tasks/caldav/CaldavSynchronizer.java b/app/src/main/java/org/tasks/caldav/CaldavSynchronizer.java index 5163abd5a..6796a221c 100644 --- a/app/src/main/java/org/tasks/caldav/CaldavSynchronizer.java +++ b/app/src/main/java/org/tasks/caldav/CaldavSynchronizer.java @@ -26,7 +26,6 @@ import at.bitfire.dav4jvm.property.GetCTag; import at.bitfire.dav4jvm.property.GetETag; import at.bitfire.dav4jvm.property.SyncToken; import at.bitfire.ical4android.ICalendar; -import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterables; import com.todoroo.astrid.dao.TaskDao; import com.todoroo.astrid.data.Task; @@ -197,11 +196,9 @@ public class CaldavSynchronizer { ResponseList members = new ResponseList(HrefRelation.MEMBER); davCalendar.calendarQuery("VTODO", null, null, members); - Set remoteObjects = newHashSet(transform(members, Response::hrefName)); - Iterable changed = filter( - ImmutableSet.copyOf(members), + members, vCard -> { GetETag eTag = vCard.get(GetETag.class); if (eTag == null || isNullOrEmpty(eTag.getETag())) { @@ -245,7 +242,7 @@ public class CaldavSynchronizer { new ArrayList<>( difference( newHashSet(caldavDao.getObjects(caldavCalendar.getUuid())), - newHashSet(remoteObjects))); + newHashSet(transform(members, Response::hrefName)))); if (deleted.size() > 0) { Timber.d("DELETED %s", deleted); taskDeleter.delete(caldavDao.getTasks(caldavCalendar.getUuid(), deleted));