diff --git a/api/src/main/java/com/todoroo/astrid/api/AstridApiConstants.java b/api/src/main/java/com/todoroo/astrid/api/AstridApiConstants.java
index e8cb7e0de..a4a64e977 100644
--- a/api/src/main/java/com/todoroo/astrid/api/AstridApiConstants.java
+++ b/api/src/main/java/com/todoroo/astrid/api/AstridApiConstants.java
@@ -105,13 +105,6 @@ public class AstridApiConstants {
*/
public static final String BROADCAST_REQUEST_SYNC_ACTIONS = API_PACKAGE + ".REQUEST_SYNC_ACTIONS";
- /**
- * Action name for broadcast intent sending sync provider information back to Astrid
- *
EXTRAS_ADDON your add-on identifier
- * EXTRAS_RESPONSE a {@link SyncAction} to invoke synchronization
- */
- public static final String BROADCAST_SEND_SYNC_ACTIONS = API_PACKAGE + ".SEND_SYNC_ACTIONS";
-
// --- Actions API
/**
diff --git a/api/src/main/java/com/todoroo/astrid/api/SyncAction.java b/api/src/main/java/com/todoroo/astrid/api/SyncAction.java
deleted file mode 100644
index 77b39f28c..000000000
--- a/api/src/main/java/com/todoroo/astrid/api/SyncAction.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/**
- * Copyright (c) 2012 Todoroo Inc
- *
- * See the file "LICENSE" for the full license governing this code.
- */
-package com.todoroo.astrid.api;
-
-import android.app.PendingIntent;
-import android.os.Parcel;
-import android.os.Parcelable;
-
-/**
- * Represents an intent that can be called to perform synchronization
- *
- * @author Tim Su
- *
- */
-public class SyncAction implements Parcelable {
-
- /**
- * Label
- */
- public String label = null;
-
- /**
- * Intent to call when invoking this operation
- */
- public PendingIntent intent = null;
-
- /**
- * Create an EditOperation object
- *
- * @param label
- * label to display
- * @param intent
- * intent to invoke
- */
- public SyncAction(String label, PendingIntent intent) {
- super();
- this.label = label;
- this.intent = intent;
- }
-
- /**
- * Returns the label of this action
- */
- @Override
- public String toString() {
- return label;
- }
-
- @Override
- public int hashCode() {
- return label.hashCode() ^ intent.getTargetPackage().hashCode();
- }
-
- /**
- * We consider two sync actions equal if target package is identical
- * and the labels are the same. This prevents duplicate pendingIntents
- * from creating multiple SyncAction objects.
- */
- @Override
- public boolean equals(Object o) {
- if(!(o instanceof SyncAction)) {
- return false;
- }
- SyncAction other = (SyncAction) o;
- return label.equals(other.label) && intent.getTargetPackage().equals(other.intent.getTargetPackage());
- }
-
- // --- parcelable helpers
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int describeContents() {
- return 0;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void writeToParcel(Parcel dest, int flags) {
- dest.writeString(label);
- dest.writeParcelable(intent, 0);
- }
-
- /**
- * Parcelable creator
- */
- public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
- /**
- * {@inheritDoc}
- */
- @Override
- public SyncAction createFromParcel(Parcel source) {
- return new SyncAction(source.readString(), (PendingIntent)source.readParcelable(
- PendingIntent.class.getClassLoader()));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public SyncAction[] newArray(int size) {
- return new SyncAction[size];
- }
- };
-
-}
diff --git a/astrid/src/main/java/com/todoroo/astrid/activity/TaskListFragment.java b/astrid/src/main/java/com/todoroo/astrid/activity/TaskListFragment.java
index 3f6f3c8aa..1c0d919b8 100644
--- a/astrid/src/main/java/com/todoroo/astrid/activity/TaskListFragment.java
+++ b/astrid/src/main/java/com/todoroo/astrid/activity/TaskListFragment.java
@@ -491,7 +491,6 @@ public class TaskListFragment extends InjectingListFragment implements OnSortSel
getActivity().registerReceiver(refreshReceiver,
new IntentFilter(AstridApiConstants.BROADCAST_EVENT_REFRESH));
- syncActionHelper.register();
if (Flags.checkAndClear(Flags.REFRESH)) {
refresh();
@@ -552,7 +551,6 @@ public class TaskListFragment extends InjectingListFragment implements OnSortSel
super.onPause();
AndroidUtilities.tryUnregisterReceiver(getActivity(), refreshReceiver);
- syncActionHelper.unregister();
backgroundTimer.cancel();
}
diff --git a/astrid/src/main/java/com/todoroo/astrid/helper/SyncActionHelper.java b/astrid/src/main/java/com/todoroo/astrid/helper/SyncActionHelper.java
index 2a0c8fd19..644f9198b 100644
--- a/astrid/src/main/java/com/todoroo/astrid/helper/SyncActionHelper.java
+++ b/astrid/src/main/java/com/todoroo/astrid/helper/SyncActionHelper.java
@@ -7,11 +7,8 @@ package com.todoroo.astrid.helper;
import android.app.Activity;
import android.app.AlertDialog;
-import android.content.BroadcastReceiver;
-import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
-import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.os.Bundle;
@@ -19,24 +16,19 @@ import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.widget.ArrayAdapter;
-import com.todoroo.andlib.utility.AndroidUtilities;
import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.astrid.activity.TaskListFragment;
import com.todoroo.astrid.api.AstridApiConstants;
-import com.todoroo.astrid.api.SyncAction;
import com.todoroo.astrid.gtasks.GtasksPreferenceService;
import com.todoroo.astrid.gtasks.sync.GtasksSyncV2Provider;
import com.todoroo.astrid.service.SyncV2Service;
import com.todoroo.astrid.sync.SyncResultCallback;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.tasks.R;
import org.tasks.preferences.Preferences;
import org.tasks.sync.IndeterminateProgressBarSyncResultCallback;
import java.util.ArrayList;
-import java.util.LinkedHashSet;
import java.util.List;
/**
@@ -52,16 +44,10 @@ import java.util.List;
*/
public class SyncActionHelper {
- private static final Logger log = LoggerFactory.getLogger(SyncActionHelper.class);
-
public static final String PREF_LAST_AUTO_SYNC = "taskListLastAutoSync"; //$NON-NLS-1$
- private final LinkedHashSet syncActions = new LinkedHashSet<>();
-
public final SyncResultCallback syncResultCallback;
- protected SyncActionReceiver syncActionReceiver = new SyncActionReceiver();
-
private final SyncV2Service syncService;
private final Activity activity;
private final Preferences preferences;
@@ -93,42 +79,7 @@ public class SyncActionHelper {
}
}
- // --- sync action receiver logic
-
- /**
- * Receiver which receives sync provider intents
- *
- */
- protected class SyncActionReceiver extends BroadcastReceiver {
- @Override
- public void onReceive(Context context, Intent intent) {
- if (intent == null
- || !AstridApiConstants.BROADCAST_SEND_SYNC_ACTIONS.equals(intent.getAction())) {
- return;
- }
-
- try {
- Bundle extras = intent.getExtras();
- SyncAction syncAction = extras.getParcelable(AstridApiConstants.EXTRAS_RESPONSE);
- syncActions.add(syncAction);
- } catch (Exception e) {
- log.error(e.getMessage(), e);
- }
- }
- }
-
- public void register() {
- activity.registerReceiver(
- syncActionReceiver,
- new IntentFilter(AstridApiConstants.BROADCAST_SEND_SYNC_ACTIONS));
- }
-
- public void unregister() {
- AndroidUtilities.tryUnregisterReceiver(activity, syncActionReceiver);
- }
-
public void request() {
- syncActions.clear();
Intent broadcastIntent = new Intent(
AstridApiConstants.BROADCAST_REQUEST_SYNC_ACTIONS);
activity.sendOrderedBroadcast(broadcastIntent,
@@ -165,7 +116,7 @@ public class SyncActionHelper {
public void performSyncAction() {
List activeV2Providers = syncService.activeProviders();
- int activeSyncs = syncActions.size() + activeV2Providers.size();
+ int activeSyncs = activeV2Providers.size();
if (activeSyncs == 0) {
String desiredCategory = activity.getString(R.string.SyP_label);