|
|
|
|
@ -14,6 +14,7 @@ import com.todoroo.andlib.data.Property.IntegerProperty;
|
|
|
|
|
import com.todoroo.andlib.data.Property.LongProperty;
|
|
|
|
|
import com.todoroo.andlib.data.Property.PropertyVisitor;
|
|
|
|
|
import com.todoroo.andlib.data.Property.StringProperty;
|
|
|
|
|
import com.todoroo.andlib.utility.Preferences;
|
|
|
|
|
import com.todoroo.astrid.dao.RemoteModelDao;
|
|
|
|
|
import com.todoroo.astrid.data.RemoteModel;
|
|
|
|
|
import com.todoroo.astrid.data.SyncFlags;
|
|
|
|
|
@ -36,7 +37,8 @@ public class MakeChanges<TYPE extends RemoteModel> extends ServerToClientMessage
|
|
|
|
|
public void processMessage() {
|
|
|
|
|
JSONArray changes = json.optJSONArray("changes");
|
|
|
|
|
String uuid = json.optString("uuid");
|
|
|
|
|
if (dao != null && changes != null && !TextUtils.isEmpty(uuid)) {
|
|
|
|
|
if (changes != null && !TextUtils.isEmpty(uuid)) {
|
|
|
|
|
if (dao != null) { // Model case
|
|
|
|
|
try {
|
|
|
|
|
TYPE model = dao.getModelClass().newInstance();
|
|
|
|
|
if (changes.length() > 0) {
|
|
|
|
|
@ -66,6 +68,21 @@ public class MakeChanges<TYPE extends RemoteModel> extends ServerToClientMessage
|
|
|
|
|
} catch (InstantiationException e) {
|
|
|
|
|
Log.e(ERROR_TAG, "Error instantiating model for MakeChanges", e);
|
|
|
|
|
}
|
|
|
|
|
} else if (NameMaps.TABLE_ID_PUSHED_AT.equals(table)) { // pushed_at case
|
|
|
|
|
JSONArray change = changes.optJSONArray(0);
|
|
|
|
|
if (change != null && change.optString(0).equals(NameMaps.TABLE_ID_PUSHED_AT)) {
|
|
|
|
|
long pushedAt = change.optLong(1);
|
|
|
|
|
String pushedAtKey = null;
|
|
|
|
|
if (NameMaps.TABLE_ID_TASKS.equals(uuid))
|
|
|
|
|
pushedAtKey = NameMaps.PUSHED_AT_TASKS;
|
|
|
|
|
else if (NameMaps.TABLE_ID_TAGS.equals(uuid))
|
|
|
|
|
pushedAtKey = NameMaps.PUSHED_AT_TAGS;
|
|
|
|
|
|
|
|
|
|
if (pushedAtKey != null)
|
|
|
|
|
Preferences.setLong(pushedAtKey, pushedAt);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|