|
|
|
@ -6,9 +6,7 @@
|
|
|
|
|
package com.todoroo.astrid.actfm.sync;
|
|
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
|
|
|
|
|
|
|
import org.json.JSONException;
|
|
|
|
|
import org.json.JSONObject;
|
|
|
|
|
|
|
|
|
|
import com.timsu.astrid.GCMIntentService;
|
|
|
|
@ -73,8 +71,6 @@ public class ActFmSyncV2Provider extends SyncV2Provider {
|
|
|
|
|
return actFmPreferenceService.isLoggedIn();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static final String LAST_FEATURED_TAG_FETCH_TIME = "actfm_last_featuredTag"; //$NON-NLS-1$
|
|
|
|
|
|
|
|
|
|
// --- synchronize active tasks
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -84,13 +80,9 @@ public class ActFmSyncV2Provider extends SyncV2Provider {
|
|
|
|
|
new Thread(new Runnable() {
|
|
|
|
|
public void run() {
|
|
|
|
|
|
|
|
|
|
final AtomicInteger finisher = new AtomicInteger(1);
|
|
|
|
|
|
|
|
|
|
updateUserStatus();
|
|
|
|
|
|
|
|
|
|
ActFmSyncThread.getInstance().setTimeForBackgroundSync(true);
|
|
|
|
|
|
|
|
|
|
startFeaturedListFetcher(finisher);
|
|
|
|
|
}
|
|
|
|
|
}).start();
|
|
|
|
|
}
|
|
|
|
@ -129,30 +121,6 @@ public class ActFmSyncV2Provider extends SyncV2Provider {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** fetch changes to tags */
|
|
|
|
|
private void startFeaturedListFetcher(final AtomicInteger finisher) {
|
|
|
|
|
new Thread(new Runnable() {
|
|
|
|
|
@Override
|
|
|
|
|
public void run() {
|
|
|
|
|
int time = Preferences.getInt(LAST_FEATURED_TAG_FETCH_TIME, 0);
|
|
|
|
|
try {
|
|
|
|
|
if (Preferences.getBoolean(R.string.p_show_featured_lists, false)) {
|
|
|
|
|
time = actFmSyncService.fetchFeaturedLists(time);
|
|
|
|
|
Preferences.setInt(LAST_FEATURED_TAG_FETCH_TIME, time);
|
|
|
|
|
}
|
|
|
|
|
} catch (JSONException e) {
|
|
|
|
|
handler.handleException("actfm-sync", e, e.toString()); //$NON-NLS-1$
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
handler.handleException("actfm-sync", e, e.toString()); //$NON-NLS-1$
|
|
|
|
|
} finally {
|
|
|
|
|
if(finisher.decrementAndGet() == 0) {
|
|
|
|
|
finishSync(null);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}).start();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// --- synchronize list
|
|
|
|
|
@Override
|
|
|
|
|
public void synchronizeList(Object list, final boolean manual,
|
|
|
|
|