Use remote timestamp for GtasksList.LAST_SYNC

pull/189/head
Alex Baker 11 years ago
parent 770a0d6a05
commit 22bbf5f4a1

@ -253,8 +253,9 @@ public class GtasksSyncV2Provider extends SyncV2Provider {
container.gtaskMetadata.setValue(GtasksMetadata.PARENT_TASK, gtasksMetadataService.localIdForGtasksId(t.getParent()));
container.gtaskMetadata.setValue(GtasksMetadata.LAST_SYNC, DateUtilities.now() + 1000L);
write(container);
lastSyncDate = Math.max(lastSyncDate, container.getUpdateTime());
}
list.setValue(GtasksList.LAST_SYNC, DateUtilities.now());
list.setValue(GtasksList.LAST_SYNC, lastSyncDate);
storeObjectDao.persist(list);
gtasksTaskListUpdater.correctOrderAndIndentForList(listId);
}

@ -5,6 +5,7 @@
*/
package com.todoroo.astrid.gtasks.sync;
import com.google.api.client.util.DateTime;
import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.astrid.data.Metadata;
import com.todoroo.astrid.data.Task;
@ -17,6 +18,7 @@ import java.util.ArrayList;
public class GtasksTaskContainer extends SyncContainer {
public Metadata gtaskMetadata;
private final long updateTime;
public GtasksTaskContainer(com.google.api.services.tasks.model.Task remoteTask, String listId, Metadata metadata) {
this.task = new Task();
@ -42,6 +44,13 @@ public class GtasksTaskContainer extends SyncContainer {
gtaskMetadata.setValue(GtasksMetadata.ID, remoteTask.getId());
gtaskMetadata.setValue(GtasksMetadata.LIST_ID, listId);
DateTime updated = remoteTask.getUpdated();
updateTime = updated == null ? 0 : updated.getValue();
}
public long getUpdateTime() {
return updateTime;
}
@Override

Loading…
Cancel
Save