Pass modified_after to tags_list in sync logic

pull/14/head
Tim Su 14 years ago
parent be9ebf52e2
commit 9fb085561c

@ -129,8 +129,7 @@ public class ActFmSyncProvider extends SyncProvider<ActFmTaskContainer> {
int serverTime = Preferences.getInt(ActFmPreferenceService.PREF_SERVER_TIME, 0);
ArrayList<ActFmTaskContainer> remoteTasks = new ArrayList<ActFmTaskContainer>();
serverTime = (int)(fetchRemoteTasks(serverTime, remoteTasks) - DateUtilities.now()/1000L);
int newServerTime = fetchRemoteTasks(serverTime, remoteTasks);
fetchRemoteTagData(serverTime);
SyncData<ActFmTaskContainer> syncData = populateSyncData(remoteTasks);
@ -142,8 +141,7 @@ public class ActFmSyncProvider extends SyncProvider<ActFmTaskContainer> {
syncData.localUpdated.close();
}
serverTime += DateUtilities.now()/1000L;
Preferences.setInt(ActFmPreferenceService.PREF_SERVER_TIME, serverTime);
Preferences.setInt(ActFmPreferenceService.PREF_SERVER_TIME, newServerTime);
actFmPreferenceService.recordSuccessfulSync();
syncSuccess = true;
@ -165,7 +163,7 @@ public class ActFmSyncProvider extends SyncProvider<ActFmTaskContainer> {
* @param serverTime last sync time
*/
private void fetchRemoteTagData(int serverTime) throws ActFmServiceException, IOException, JSONException {
actFmSyncService.fetchTags();
actFmSyncService.fetchTags(serverTime);
}
/**

@ -457,12 +457,14 @@ public final class ActFmSyncService {
/**
* Fetch all tags
* @param serverTime
*/
public void fetchTags() throws JSONException, IOException {
public void fetchTags(int serverTime) throws JSONException, IOException {
if(!checkForToken())
return;
JSONObject result = actFmInvoker.invoke("tag_list", "token", token);
JSONObject result = actFmInvoker.invoke("tag_list",
"token", token, "modified_after", serverTime);
JSONArray tags = result.getJSONArray("list");
HashSet<Long> remoteIds = new HashSet<Long>(tags.length());
for(int i = 0; i < tags.length(); i++) {

@ -411,7 +411,7 @@ public class FilterListActivity extends ExpandableListActivity {
@Override
public void run() {
try {
actFmSyncService.fetchTags();
actFmSyncService.fetchTags(0);
adapter.clear();
adapter.getLists();

Loading…
Cancel
Save