|
|
|
@ -47,7 +47,6 @@ import com.todoroo.astrid.service.StatisticsService;
|
|
|
|
|
import com.todoroo.astrid.service.TaskService;
|
|
|
|
|
import com.todoroo.astrid.sync.SyncResultCallback;
|
|
|
|
|
import com.todoroo.astrid.sync.SyncV2Provider;
|
|
|
|
|
import com.todoroo.astrid.sync.SyncV2Provider.SyncExceptionHandler;
|
|
|
|
|
|
|
|
|
|
public class GtasksSyncV2Provider extends SyncV2Provider {
|
|
|
|
|
|
|
|
|
@ -113,8 +112,10 @@ public class GtasksSyncV2Provider extends SyncV2Provider {
|
|
|
|
|
final GtasksInvoker invoker = new GtasksInvoker(authToken);
|
|
|
|
|
try {
|
|
|
|
|
gtasksListService.updateLists(invoker.allGtaskLists());
|
|
|
|
|
} catch (GoogleTasksException e) {
|
|
|
|
|
handler.handleException("gtasks-sync=io", e, e.getType()); //$NON-NLS-1$
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
handler.handleException("gtasks-sync=io", e); //$NON-NLS-1$
|
|
|
|
|
handler.handleException("gtasks-sync=io", e, e.getMessage()); //$NON-NLS-1$
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StoreObject[] lists = gtasksListService.getLists();
|
|
|
|
@ -130,9 +131,7 @@ public class GtasksSyncV2Provider extends SyncV2Provider {
|
|
|
|
|
synchronizeListHelper(list, invoker, manual, handler, callback);
|
|
|
|
|
callback.incrementProgress(25);
|
|
|
|
|
if (finisher.decrementAndGet() == 0) {
|
|
|
|
|
gtasksPreferenceService.recordSuccessfulSync();
|
|
|
|
|
gtasksPreferenceService.stopOngoing();
|
|
|
|
|
callback.finished();
|
|
|
|
|
finishSync(callback);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}).start();
|
|
|
|
@ -156,8 +155,10 @@ public class GtasksSyncV2Provider extends SyncV2Provider {
|
|
|
|
|
task.readFromCursor(queued);
|
|
|
|
|
try {
|
|
|
|
|
gtasksSyncService.pushTaskOnSave(task, task.getMergedValues(), invoker, false);
|
|
|
|
|
} catch (GoogleTasksException e) {
|
|
|
|
|
handler.handleException("gtasks-sync-io", e, e.getType()); //$NON-NLS-1$
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
handler.handleException("gtasks-sync-io", e); //$NON-NLS-1$
|
|
|
|
|
handler.handleException("gtasks-sync-io", e, e.getMessage()); //$NON-NLS-1$
|
|
|
|
|
} finally {
|
|
|
|
|
callback.incrementProgress(10);
|
|
|
|
|
}
|
|
|
|
@ -256,9 +257,12 @@ public class GtasksSyncV2Provider extends SyncV2Provider {
|
|
|
|
|
|
|
|
|
|
gtasksTaskListUpdater.correctOrderAndIndentForList(listId);
|
|
|
|
|
}
|
|
|
|
|
} catch (GoogleTasksException e) {
|
|
|
|
|
if (errorHandler != null)
|
|
|
|
|
errorHandler.handleException("gtasks-sync-io", e, e.getType()); //$NON-NLS-1$
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
if (errorHandler != null)
|
|
|
|
|
errorHandler.handleException("gtasks-sync-io", e); //$NON-NLS-1$
|
|
|
|
|
errorHandler.handleException("gtasks-sync-io", e, e.getMessage()); //$NON-NLS-1$
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|