From 5d1c90dcbac4e4a21e63c8fbc762a453d9bf0491 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Fri, 24 Mar 2017 14:40:29 +0000 Subject: [PATCH] Resource: set eTag when creating a new one from server. Before this commit we would create new entries from the server without an etag, essentially marking them as "local only". While the actual value of the eTag is not currently used, null or not matters. Because the resources were "local only", we would get weird behaviours like having an "ADD" action when changing a resource. --- .../etesync/syncadapter/syncadapter/CalendarSyncManager.java | 2 +- .../etesync/syncadapter/syncadapter/ContactsSyncManager.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/etesync/syncadapter/syncadapter/CalendarSyncManager.java b/app/src/main/java/com/etesync/syncadapter/syncadapter/CalendarSyncManager.java index 23b1b439..4a0e40c7 100644 --- a/app/src/main/java/com/etesync/syncadapter/syncadapter/CalendarSyncManager.java +++ b/app/src/main/java/com/etesync/syncadapter/syncadapter/CalendarSyncManager.java @@ -113,7 +113,7 @@ public class CalendarSyncManager extends SyncManager { syncResult.stats.numUpdates++; } else { App.log.info("Adding " + newData.uid + " to local calendar"); - localEvent = new LocalEvent(localCalendar(), newData, newData.uid, null); + localEvent = new LocalEvent(localCalendar(), newData, newData.uid, newData.uid); localEvent.add(); syncResult.stats.numInserts++; } diff --git a/app/src/main/java/com/etesync/syncadapter/syncadapter/ContactsSyncManager.java b/app/src/main/java/com/etesync/syncadapter/syncadapter/ContactsSyncManager.java index 57febeeb..46f6e858 100644 --- a/app/src/main/java/com/etesync/syncadapter/syncadapter/ContactsSyncManager.java +++ b/app/src/main/java/com/etesync/syncadapter/syncadapter/ContactsSyncManager.java @@ -193,13 +193,13 @@ public class ContactsSyncManager extends SyncManager { if (local == null) { if (newData.group) { App.log.log(Level.INFO, "Creating local group", newData); - LocalGroup group = new LocalGroup(localAddressBook(), newData, uuid, null); + LocalGroup group = new LocalGroup(localAddressBook(), newData, uuid, uuid); group.create(); local = group; } else { App.log.log(Level.INFO, "Creating local contact", newData); - LocalContact contact = new LocalContact(localAddressBook(), newData, uuid, null); + LocalContact contact = new LocalContact(localAddressBook(), newData, uuid, uuid); contact.create(); local = contact;