Remove Google Task clear completed API call

pull/795/head
Alex Baker 7 years ago
parent ac9f91e719
commit e4534d053a

@ -74,7 +74,7 @@ public class GtasksInvoker {
execute(service.tasks().update(listId, task.getId(), task)); execute(service.tasks().update(listId, task.getId(), task));
} }
public Task moveGtask(String listId, String taskId, String parentId, String previousId) Task moveGtask(String listId, String taskId, String parentId, String previousId)
throws IOException { throws IOException {
return execute( return execute(
service.tasks().move(listId, taskId).setParent(parentId).setPrevious(previousId)); service.tasks().move(listId, taskId).setParent(parentId).setPrevious(previousId));
@ -92,10 +92,6 @@ public class GtasksInvoker {
return execute(service.tasklists().insert(new TaskList().setTitle(title))); return execute(service.tasklists().insert(new TaskList().setTitle(title)));
} }
public void clearCompleted(String listId) throws IOException {
execute(service.tasks().clear(listId));
}
public void deleteGtask(String listId, String taskId) throws IOException { public void deleteGtask(String listId, String taskId) throws IOException {
try { try {
execute(service.tasks().delete(listId, taskId)); execute(service.tasks().delete(listId, taskId));

@ -6,8 +6,6 @@
package com.todoroo.astrid.gtasks.sync; package com.todoroo.astrid.gtasks.sync;
import static com.todoroo.andlib.utility.AndroidUtilities.assertNotMainThread;
import android.content.Context; import android.content.Context;
import android.text.TextUtils; import android.text.TextUtils;
import com.google.api.client.googleapis.extensions.android.gms.auth.UserRecoverableAuthIOException; import com.google.api.client.googleapis.extensions.android.gms.auth.UserRecoverableAuthIOException;
@ -32,7 +30,6 @@ import org.tasks.data.GoogleTaskListDao;
import org.tasks.gtasks.GtaskSyncAdapterHelper; import org.tasks.gtasks.GtaskSyncAdapterHelper;
import org.tasks.injection.ApplicationScope; import org.tasks.injection.ApplicationScope;
import org.tasks.injection.ForApplication; import org.tasks.injection.ForApplication;
import org.tasks.jobs.WorkManager;
import org.tasks.preferences.Preferences; import org.tasks.preferences.Preferences;
import timber.log.Timber; import timber.log.Timber;
@ -47,7 +44,6 @@ public class GtasksSyncService {
private final GtaskSyncAdapterHelper gtaskSyncAdapterHelper; private final GtaskSyncAdapterHelper gtaskSyncAdapterHelper;
private final Tracker tracker; private final Tracker tracker;
private final GoogleTaskDao googleTaskDao; private final GoogleTaskDao googleTaskDao;
private final WorkManager workManager;
@Inject @Inject
public GtasksSyncService( public GtasksSyncService(
@ -57,26 +53,16 @@ public class GtasksSyncService {
GtaskSyncAdapterHelper gtaskSyncAdapterHelper, GtaskSyncAdapterHelper gtaskSyncAdapterHelper,
Tracker tracker, Tracker tracker,
GoogleTaskDao googleTaskDao, GoogleTaskDao googleTaskDao,
GoogleTaskListDao googleTaskListDao, GoogleTaskListDao googleTaskListDao) {
WorkManager workManager) {
this.context = context; this.context = context;
this.taskDao = taskDao; this.taskDao = taskDao;
this.preferences = preferences; this.preferences = preferences;
this.gtaskSyncAdapterHelper = gtaskSyncAdapterHelper; this.gtaskSyncAdapterHelper = gtaskSyncAdapterHelper;
this.tracker = tracker; this.tracker = tracker;
this.googleTaskDao = googleTaskDao; this.googleTaskDao = googleTaskDao;
this.workManager = workManager;
new OperationPushThread(operationQueue).start(); new OperationPushThread(operationQueue).start();
} }
public void clearCompleted(GoogleTaskList googleTaskList) throws IOException {
assertNotMainThread();
GtasksInvoker invoker = new GtasksInvoker(context, googleTaskList.getAccount());
invoker.clearCompleted(googleTaskList.getRemoteId());
workManager.syncNow();
}
public void triggerMoveForMetadata(GoogleTaskList googleTaskList, GoogleTask googleTask) { public void triggerMoveForMetadata(GoogleTaskList googleTaskList, GoogleTask googleTask) {
if (googleTask == null) { if (googleTask == null) {
return; return;

@ -22,8 +22,6 @@ public class Tracking {
GTASK_DELETE_LIST( GTASK_DELETE_LIST(
R.string.tracking_category_google_tasks, R.string.tracking_action_delete_list), R.string.tracking_category_google_tasks, R.string.tracking_action_delete_list),
GTASK_SET_COLOR(R.string.tracking_category_google_tasks, R.string.p_theme_color), GTASK_SET_COLOR(R.string.tracking_category_google_tasks, R.string.p_theme_color),
GTASK_CLEAR_COMPLETED(
R.string.tracking_category_google_tasks, R.string.tracking_action_clear_completed),
MULTISELECT_DELETE( MULTISELECT_DELETE(
R.string.tracking_category_event, R.string.tracking_event_multiselect_delete), R.string.tracking_category_event, R.string.tracking_event_multiselect_delete),
MULTISELECT_CLONE(R.string.tracking_category_event, R.string.tracking_event_multiselect_clone), MULTISELECT_CLONE(R.string.tracking_category_event, R.string.tracking_event_multiselect_clone),

@ -11,13 +11,9 @@ import com.todoroo.astrid.activity.TaskListFragment;
import com.todoroo.astrid.api.Filter; import com.todoroo.astrid.api.Filter;
import com.todoroo.astrid.api.GtasksFilter; import com.todoroo.astrid.api.GtasksFilter;
import com.todoroo.astrid.gtasks.sync.GtasksSyncService; import com.todoroo.astrid.gtasks.sync.GtasksSyncService;
import io.reactivex.Completable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import javax.inject.Inject; import javax.inject.Inject;
import org.tasks.R; import org.tasks.R;
import org.tasks.activities.GoogleTaskListSettingsActivity; import org.tasks.activities.GoogleTaskListSettingsActivity;
import org.tasks.analytics.Tracking;
import org.tasks.data.GoogleTaskList; import org.tasks.data.GoogleTaskList;
import org.tasks.injection.FragmentComponent; import org.tasks.injection.FragmentComponent;
@ -85,16 +81,6 @@ public class GtasksListFragment extends TaskListFragment {
} }
} }
@Override
protected void clearCompleted() {
tracker.reportEvent(Tracking.Events.GTASK_CLEAR_COMPLETED);
setSyncOngoing(true);
disposables.add(Completable.fromAction(() -> gtasksSyncService.clearCompleted(list))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(() -> preferences.isSyncOngoing()));
}
@Override @Override
public void onSaveInstanceState(Bundle outState) { public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState); super.onSaveInstanceState(outState);

Loading…
Cancel
Save