From 9e64858c8f31111a6f553bcd73e6306aba4e7b0a Mon Sep 17 00:00:00 2001 From: Sam Bosley Date: Thu, 31 Jan 2013 17:47:55 -0800 Subject: [PATCH] Never write pushed_at value in MakeChanges --- .../todoroo/astrid/actfm/sync/ActFmSyncThread.java | 11 +---------- .../astrid/actfm/sync/messages/MakeChanges.java | 8 +------- .../actfm/sync/messages/ServerToClientMessage.java | 14 +++++++------- 3 files changed, 9 insertions(+), 24 deletions(-) diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncThread.java b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncThread.java index d8edea2be..8565e0f6c 100644 --- a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncThread.java +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncThread.java @@ -1,7 +1,6 @@ package com.todoroo.astrid.actfm.sync; import java.io.IOException; -import java.text.ParseException; import java.util.Collections; import java.util.LinkedList; import java.util.List; @@ -18,7 +17,6 @@ import com.todoroo.andlib.service.ContextManager; import com.todoroo.andlib.service.DependencyInjectionService; import com.todoroo.andlib.sql.Query; import com.todoroo.andlib.utility.AndroidUtilities; -import com.todoroo.andlib.utility.DateUtilities; import com.todoroo.astrid.actfm.sync.messages.BriefMe; import com.todoroo.astrid.actfm.sync.messages.ChangesHappened; import com.todoroo.astrid.actfm.sync.messages.ClientToServerMessage; @@ -194,18 +192,11 @@ public class ActFmSyncThread { JSONObject response = actFmInvoker.postSync(payload, token); // process responses JSONArray serverMessagesJson = response.optJSONArray("messages"); - String modelPushedAtString = response.optString("time"); - long modelPushedAt = 0; - try { - modelPushedAt = DateUtilities.parseIso8601(modelPushedAtString); - } catch (ParseException e) { - Log.e(ERROR_TAG, "Unparseable date " + modelPushedAtString, e); - } if (serverMessagesJson != null) { for (int i = 0; i < serverMessagesJson.length(); i++) { JSONObject serverMessageJson = serverMessagesJson.optJSONObject(i); if (serverMessageJson != null) { - ServerToClientMessage serverMessage = ServerToClientMessage.instantiateMessage(serverMessageJson, modelPushedAt); + ServerToClientMessage serverMessage = ServerToClientMessage.instantiateMessage(serverMessageJson); if (serverMessage != null) { serverMessage.processMessage(); } else { diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/messages/MakeChanges.java b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/messages/MakeChanges.java index 23853d869..e00767e64 100644 --- a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/messages/MakeChanges.java +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/messages/MakeChanges.java @@ -12,7 +12,6 @@ import android.util.Log; import com.todoroo.andlib.data.AbstractModel; import com.todoroo.andlib.data.Property; -import com.todoroo.andlib.data.Property.LongProperty; import com.todoroo.andlib.data.Property.StringProperty; import com.todoroo.andlib.sql.Criterion; import com.todoroo.astrid.core.PluginServices; @@ -33,13 +32,11 @@ public class MakeChanges extends ServerToClientMessage private final RemoteModelDao dao; private final String table; - private final long pushedAt; - public MakeChanges(JSONObject json, RemoteModelDao dao, long pushedAt) { + public MakeChanges(JSONObject json, RemoteModelDao dao) { super(json); this.table = json.optString("table"); this.dao = dao; - this.pushedAt = pushedAt; } @Override @@ -65,9 +62,6 @@ public class MakeChanges extends ServerToClientMessage uuid = model.getValue(uuidProperty); beforeSaveChanges(changes, model, uuid); - LongProperty pushedAtProperty = (LongProperty) NameMaps.serverColumnNameToLocalProperty(table, "pushed_at"); - if (pushedAtProperty != null && pushedAt > 0) - model.setValue(pushedAtProperty, pushedAt); if (model.getSetValues() != null && !model.getSetValues().containsKey(uuidProperty.name)) model.setValue(uuidProperty, uuid); diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/messages/ServerToClientMessage.java b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/messages/ServerToClientMessage.java index a5394bded..533d72d63 100644 --- a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/messages/ServerToClientMessage.java +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/messages/ServerToClientMessage.java @@ -26,10 +26,10 @@ public abstract class ServerToClientMessage { this.json = json; } - public static ServerToClientMessage instantiateMessage(JSONObject json, long pushedAt) { + public static ServerToClientMessage instantiateMessage(JSONObject json) { String type = json.optString("type"); if (TYPE_MAKE_CHANGES.equals(type)) - return instantiateMakeChanges(json, pushedAt); + return instantiateMakeChanges(json); else if (TYPE_NOW_BRIEFED.equals(type)) return instantiateNowBriefed(json); else if (TYPE_ACKNOWLEDGE_CHANGE.equals(type)) @@ -44,16 +44,16 @@ public abstract class ServerToClientMessage { return null; } - private static MakeChanges instantiateMakeChanges(JSONObject json, long pushedAt) { + private static MakeChanges instantiateMakeChanges(JSONObject json) { String table = json.optString("table"); if (NameMaps.TABLE_ID_TASKS.equals(table)) - return new MakeChanges(json, PluginServices.getTaskDao(), pushedAt); + return new MakeChanges(json, PluginServices.getTaskDao()); else if (NameMaps.TABLE_ID_TAGS.equals(table)) - return new MakeChanges(json, PluginServices.getTagDataDao(), pushedAt); + return new MakeChanges(json, PluginServices.getTagDataDao()); else if (NameMaps.TABLE_ID_USERS.equals(table)) - return new MakeChanges(json, PluginServices.getUserDao(), pushedAt); + return new MakeChanges(json, PluginServices.getUserDao()); else if (NameMaps.TABLE_ID_USER_ACTIVITY.equals(table)) - return new MakeChanges(json, PluginServices.getUserActivityDao(), pushedAt); + return new MakeChanges(json, PluginServices.getUserActivityDao()); else return null; }