diff --git a/api/build.xml b/api/build.xml
index 193c704b2..51da4e741 100644
--- a/api/build.xml
+++ b/api/build.xml
@@ -100,6 +100,27 @@
+
+
+
+
+
+
+
+
+
diff --git a/api/src/com/todoroo/andlib/utility/DateUtilities.java b/api/src/com/todoroo/andlib/utility/DateUtilities.java
index 068c3ed11..7f3cfb4e3 100644
--- a/api/src/com/todoroo/andlib/utility/DateUtilities.java
+++ b/api/src/com/todoroo/andlib/utility/DateUtilities.java
@@ -66,16 +66,16 @@ public class DateUtilities {
}
/** Represents a single hour */
- public static long ONE_HOUR = 3600000L;
+ public static final long ONE_HOUR = 3600000L;
/** Represents a single day */
- public static long ONE_DAY = 24 * ONE_HOUR;
+ public static final long ONE_DAY = 24 * ONE_HOUR;
/** Represents a single week */
- public static long ONE_WEEK = 7 * ONE_DAY;
+ public static final long ONE_WEEK = 7 * ONE_DAY;
/** Represents a single minute */
- public static long ONE_MINUTE = 60000L;
+ public static final long ONE_MINUTE = 60000L;
/* ======================================================================
* =========================================================== formatters
diff --git a/api/src/com/todoroo/andlib/utility/Preferences.java b/api/src/com/todoroo/andlib/utility/Preferences.java
index e7e71159a..95ab91812 100644
--- a/api/src/com/todoroo/andlib/utility/Preferences.java
+++ b/api/src/com/todoroo/andlib/utility/Preferences.java
@@ -51,6 +51,20 @@ public class Preferences {
editor.putBoolean(key, value);
}
+ /**
+ * Helper to write to editor if key specified is null
+ * @param prefs
+ * @param editor
+ * @param r
+ * @param keyResource
+ * @param value
+ */
+ public static void setIfUnset(SharedPreferences prefs, Editor editor, Resources r, int keyResource, String value) {
+ String key = r.getString(keyResource);
+ if(!prefs.contains(key) || !(prefs.getAll().get(key) instanceof String))
+ editor.putString(key, value);
+ }
+
/* ======================================================================
* ======================================================= helper methods
* ====================================================================== */
diff --git a/api/src/com/todoroo/astrid/api/AstridApiConstants.java b/api/src/com/todoroo/astrid/api/AstridApiConstants.java
index e738eb200..54367876d 100644
--- a/api/src/com/todoroo/astrid/api/AstridApiConstants.java
+++ b/api/src/com/todoroo/astrid/api/AstridApiConstants.java
@@ -21,17 +21,22 @@ public class AstridApiConstants {
/**
* Astrid broadcast base package name
*/
- public static final String PACKAGE = "com.todoroo.astrid";
+ public static final String API_PACKAGE = "com.todoroo.astrid";
+
+ /**
+ * Astrid app base package name
+ */
+ public static final String ASTRID_PACKAGE = "com.timsu.astrid";
/**
* Permission for reading tasks and receiving to GET_FILTERS intent
*/
- public static final String PERMISSION_READ = PACKAGE + ".READ";
+ public static final String PERMISSION_READ = API_PACKAGE + ".READ";
/**
* Permission for writing and creating tasks
*/
- public static final String PERMISSION_WRITE = PACKAGE + ".WRITE";
+ public static final String PERMISSION_WRITE = API_PACKAGE + ".WRITE";
/**
* Name of Astrid's publicly readable preference store
@@ -82,34 +87,34 @@ public class AstridApiConstants {
/**
* Action name for broadcast intent requesting add-ons
*/
- public static final String BROADCAST_REQUEST_ADDONS = PACKAGE + ".REQUEST_ADDONS";
+ public static final String BROADCAST_REQUEST_ADDONS = API_PACKAGE + ".REQUEST_ADDONS";
/**
* Action name for broadcast intent sending add-ons back to Astrid
*
EXTRAS_RESPONSE an {@link Addon} object
*/
- public static final String BROADCAST_SEND_ADDONS = PACKAGE + ".SEND_ADDONS";
+ public static final String BROADCAST_SEND_ADDONS = API_PACKAGE + ".SEND_ADDONS";
// --- Filters API
/**
* Action name for broadcast intent requesting filters
*/
- public static final String BROADCAST_REQUEST_FILTERS = PACKAGE + ".REQUEST_FILTERS";
+ public static final String BROADCAST_REQUEST_FILTERS = API_PACKAGE + ".REQUEST_FILTERS";
/**
* Action name for broadcast intent sending filters back to Astrid
*
EXTRAS_ADDON your add-on identifier
*
EXTRAS_RESPONSE an array of {@link FilterListItem}s
*/
- public static final String BROADCAST_SEND_FILTERS = PACKAGE + ".SEND_FILTERS";
+ public static final String BROADCAST_SEND_FILTERS = API_PACKAGE + ".SEND_FILTERS";
// -- Custom criteria API
/**
* Action name for a broadcast intent requesting custom filter criteria (e.g. "Due by, Tagged, Tag contains", etc.)
*/
- public static final String BROADCAST_REQUEST_CUSTOM_FILTER_CRITERIA = PACKAGE + ".REQUEST_CUSTOM_FILTER_CRITERIA";
+ public static final String BROADCAST_REQUEST_CUSTOM_FILTER_CRITERIA = API_PACKAGE + ".REQUEST_CUSTOM_FILTER_CRITERIA";
/**
@@ -117,7 +122,7 @@ public class AstridApiConstants {
*
EXTRAS_ADDON you add-on identifier
*
EXTRAS_RESPONSE an array of {@link CustomFilterCriterion}
*/
- public static final String BROADCAST_SEND_CUSTOM_FILTER_CRITERIA = PACKAGE + ".SEND_CUSTOM_FILTER_CRITERIA";
+ public static final String BROADCAST_SEND_CUSTOM_FILTER_CRITERIA = API_PACKAGE + ".SEND_CUSTOM_FILTER_CRITERIA";
// --- Edit Controls API
@@ -125,14 +130,14 @@ public class AstridApiConstants {
* Action name for broadcast intent requesting task edit controls
*
EXTRAS_TASK_ID id of the task user is editing
*/
- public static final String BROADCAST_REQUEST_EDIT_CONTROLS = PACKAGE + ".REQUEST_EDIT_CONTROLS";
+ public static final String BROADCAST_REQUEST_EDIT_CONTROLS = API_PACKAGE + ".REQUEST_EDIT_CONTROLS";
/**
* Action name for broadcast intent sending task edit controls back to Astrid
*
EXTRAS_ADDON your add-on identifier
*
EXTRAS_RESPONSE a {@link RemoteViews} with your edit controls
*/
- public static final String BROADCAST_SEND_EDIT_CONTROLS = PACKAGE + ".SEND_EDIT_CONTROLS";
+ public static final String BROADCAST_SEND_EDIT_CONTROLS = API_PACKAGE + ".SEND_EDIT_CONTROLS";
// --- Task Details API
@@ -143,7 +148,7 @@ public class AstridApiConstants {
*
EXTRAS_TASK_ID id of the task
*
EXTRAS_EXTENDED whether request is for standard or extended details
*/
- public static final String BROADCAST_REQUEST_DETAILS = PACKAGE + ".REQUEST_DETAILS";
+ public static final String BROADCAST_REQUEST_DETAILS = API_PACKAGE + ".REQUEST_DETAILS";
/**
* Action name for broadcast intent sending details back to Astrid
@@ -152,7 +157,7 @@ public class AstridApiConstants {
*
EXTRAS_EXTENDED whether request is for standard or extended details
*
EXTRAS_RESPONSE a String
*/
- public static final String BROADCAST_SEND_DETAILS = PACKAGE + ".SEND_DETAILS";
+ public static final String BROADCAST_SEND_DETAILS = API_PACKAGE + ".SEND_DETAILS";
// --- Sync Action API
@@ -160,14 +165,14 @@ public class AstridApiConstants {
* Action name for broadcast intent requesting a listing of active
* sync actions users can activate from the menu
*/
- public static final String BROADCAST_REQUEST_SYNC_ACTIONS = PACKAGE + ".REQUEST_SYNC_ACTIONS";
+ 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 = PACKAGE + ".SEND_SYNC_ACTIONS";
+ public static final String BROADCAST_SEND_SYNC_ACTIONS = API_PACKAGE + ".SEND_SYNC_ACTIONS";
// --- Task Decorations API
@@ -175,7 +180,7 @@ public class AstridApiConstants {
* Action name for broadcast intent requesting task list decorations for a task
*
EXTRAS_TASK_ID id of the task
*/
- public static final String BROADCAST_REQUEST_DECORATIONS = PACKAGE + ".REQUEST_DECORATIONS";
+ public static final String BROADCAST_REQUEST_DECORATIONS = API_PACKAGE + ".REQUEST_DECORATIONS";
/**
* Action name for broadcast intent sending decorations back to Astrid
@@ -183,7 +188,7 @@ public class AstridApiConstants {
*
EXTRAS_TASK_ID id of the task
*
EXTRAS_RESPONSE a {@link TaskDecoration}
*/
- public static final String BROADCAST_SEND_DECORATIONS = PACKAGE + ".SEND_DECORATIONS";
+ public static final String BROADCAST_SEND_DECORATIONS = API_PACKAGE + ".SEND_DECORATIONS";
// --- Actions API
@@ -191,33 +196,33 @@ public class AstridApiConstants {
* Action name for intents to be displayed on task context menu
*
EXTRAS_TASK_ID id of the task
*/
- public static final String ACTION_TASK_CONTEXT_MENU = PACKAGE + ".CONTEXT_MENU";
+ public static final String ACTION_TASK_CONTEXT_MENU = API_PACKAGE + ".CONTEXT_MENU";
/**
* Action name for intents to be displayed on Astrid's task list menu
*
EXTRAS_ADDON your add-on identifier
*
EXTRAS_RESPONSE an array of {@link Intent}s
*/
- public static final String ACTION_TASK_LIST_MENU = PACKAGE + ".TASK_LIST_MENU";
+ public static final String ACTION_TASK_LIST_MENU = API_PACKAGE + ".TASK_LIST_MENU";
/**
* Action name for intents to be displayed in Astrid's settings. By default,
* your application will be put into the category named by your application,
* but you can add a string meta-data with name "category" to override this.
*/
- public static final String ACTION_SETTINGS = PACKAGE + ".SETTINGS";
+ public static final String ACTION_SETTINGS = API_PACKAGE + ".SETTINGS";
// --- Events API
/**
* Action name for broadcast intent notifying add-ons that Astrid started up
*/
- public static final String BROADCAST_EVENT_STARTUP = PACKAGE + ".STARTUP";
+ public static final String BROADCAST_EVENT_STARTUP = API_PACKAGE + ".STARTUP";
/**
* Action name for broadcast intent notifying Astrid task list to refresh
*/
- public static final String BROADCAST_EVENT_REFRESH = PACKAGE + ".REFRESH";
+ public static final String BROADCAST_EVENT_REFRESH = API_PACKAGE + ".REFRESH";
/**
* Action name for broadcast intent notifying Astrid to clear detail cache
@@ -225,20 +230,20 @@ public class AstridApiConstants {
* logging out of a sync provider). Use this call carefully, as loading
* details can degrade the performance of Astrid.
*/
- public static final String BROADCAST_EVENT_FLUSH_DETAILS = PACKAGE + ".FLUSH_DETAILS";
+ public static final String BROADCAST_EVENT_FLUSH_DETAILS = API_PACKAGE + ".FLUSH_DETAILS";
/**
* Action name for broadcast intent notifying that task was created or
* title was changed
*
EXTRAS_TASK_ID id of the task
*/
- public static final String BROADCAST_EVENT_TASK_LIST_UPDATED = PACKAGE + ".TASK_LIST_UPDATED";
+ public static final String BROADCAST_EVENT_TASK_LIST_UPDATED = API_PACKAGE + ".TASK_LIST_UPDATED";
/**
* Action name for broadcast intent notifying that task was completed
*
EXTRAS_TASK_ID id of the task
*/
- public static final String BROADCAST_EVENT_TASK_COMPLETED = PACKAGE + ".TASK_COMPLETED";
+ public static final String BROADCAST_EVENT_TASK_COMPLETED = API_PACKAGE + ".TASK_COMPLETED";
/**
* Action name for broadcast intent notifying that task was created from repeating template
@@ -246,7 +251,7 @@ public class AstridApiConstants {
*
EXTRAS_OLD_DUE_DATE task old due date (could be 0)
*
EXTRAS_NEW_DUE_DATE task new due date (will not be 0)
*/
- public static final String BROADCAST_EVENT_TASK_REPEATED = PACKAGE + ".TASK_REPEATED";
+ public static final String BROADCAST_EVENT_TASK_REPEATED = API_PACKAGE + ".TASK_REPEATED";
/**
* Action name for broadcast intent notifying that a repeating task has passed its repeat_until value
@@ -254,11 +259,11 @@ public class AstridApiConstants {
*
EXTRAS_OLD_DUE_DATE task old due date (could be 0)
*
EXTRAS_NEW_DUE_DATE task new due date (will not be 0)
*/
- public static final String BROADCAST_EVENT_TASK_REPEAT_FINISHED = PACKAGE + ".TASK_REPEAT_FINISHED";
+ public static final String BROADCAST_EVENT_TASK_REPEAT_FINISHED = API_PACKAGE + ".TASK_REPEAT_FINISHED";
/**
* Action name for broadcast intent notifying that tag was deleted
*/
- public static final String BROADCAST_EVENT_TAG_DELETED = PACKAGE + ".TAG_DELETED";
+ public static final String BROADCAST_EVENT_TAG_DELETED = API_PACKAGE + ".TAG_DELETED";
}
diff --git a/api/src/com/todoroo/astrid/api/FilterWithCustomIntent.java b/api/src/com/todoroo/astrid/api/FilterWithCustomIntent.java
index 1aee63c48..368d08634 100644
--- a/api/src/com/todoroo/astrid/api/FilterWithCustomIntent.java
+++ b/api/src/com/todoroo/astrid/api/FilterWithCustomIntent.java
@@ -45,7 +45,7 @@ public class FilterWithCustomIntent extends Filter {
public Intent getCustomIntent() {
Intent intent = new Intent();
intent.putExtra("filter", this); //$NON-NLS-1$
- intent.setComponent(new ComponentName("com.timsu.astrid", "com.todoroo.astrid.activity.TaskListActivity")); //$NON-NLS-1$ //$NON-NLS-2$
+ intent.setComponent(new ComponentName(AstridApiConstants.ASTRID_PACKAGE, "com.todoroo.astrid.activity.TaskListActivity")); //$NON-NLS-1$
if(customExtras != null)
intent.putExtras(customExtras);
diff --git a/api/src/com/todoroo/astrid/data/Metadata.java b/api/src/com/todoroo/astrid/data/Metadata.java
index 419dcbec6..faf5db7ad 100644
--- a/api/src/com/todoroo/astrid/data/Metadata.java
+++ b/api/src/com/todoroo/astrid/data/Metadata.java
@@ -32,7 +32,7 @@ public class Metadata extends AbstractModel {
public static final Table TABLE = new Table("metadata", Metadata.class);
/** content uri for this model */
- public static final Uri CONTENT_URI = Uri.parse("content://" + AstridApiConstants.PACKAGE + "/" +
+ public static final Uri CONTENT_URI = Uri.parse("content://" + AstridApiConstants.API_PACKAGE + "/" +
TABLE.name);
// --- properties
diff --git a/api/src/com/todoroo/astrid/data/StoreObject.java b/api/src/com/todoroo/astrid/data/StoreObject.java
index db3641c03..4131e713e 100644
--- a/api/src/com/todoroo/astrid/data/StoreObject.java
+++ b/api/src/com/todoroo/astrid/data/StoreObject.java
@@ -32,7 +32,7 @@ public class StoreObject extends AbstractModel {
public static final Table TABLE = new Table("store", StoreObject.class);
/** content uri for this model */
- public static final Uri CONTENT_URI = Uri.parse("content://" + AstridApiConstants.PACKAGE + "/" +
+ public static final Uri CONTENT_URI = Uri.parse("content://" + AstridApiConstants.API_PACKAGE + "/" +
TABLE.name);
// --- properties
diff --git a/api/src/com/todoroo/astrid/data/TagData.java b/api/src/com/todoroo/astrid/data/TagData.java
index a862589bf..2468fe0d4 100644
--- a/api/src/com/todoroo/astrid/data/TagData.java
+++ b/api/src/com/todoroo/astrid/data/TagData.java
@@ -36,7 +36,7 @@ public final class TagData extends RemoteModel {
public static final Class extends OutstandingEntry> OUTSTANDING_MODEL = TagOutstanding.class;
/** content uri for this model */
- public static final Uri CONTENT_URI = Uri.parse("content://" + AstridApiConstants.PACKAGE + "/" +
+ public static final Uri CONTENT_URI = Uri.parse("content://" + AstridApiConstants.API_PACKAGE + "/" +
TABLE.name);
// --- properties
diff --git a/api/src/com/todoroo/astrid/data/Task.java b/api/src/com/todoroo/astrid/data/Task.java
index 52d465c60..d97826762 100644
--- a/api/src/com/todoroo/astrid/data/Task.java
+++ b/api/src/com/todoroo/astrid/data/Task.java
@@ -41,7 +41,7 @@ public final class Task extends RemoteModel {
public static final Class extends OutstandingEntry> OUTSTANDING_MODEL = TaskOutstanding.class;
/** content uri for this model */
- public static final Uri CONTENT_URI = Uri.parse("content://" + AstridApiConstants.PACKAGE + "/" +
+ public static final Uri CONTENT_URI = Uri.parse("content://" + AstridApiConstants.API_PACKAGE + "/" +
TABLE.name);
// --- properties
diff --git a/api/src/com/todoroo/astrid/data/Update.java b/api/src/com/todoroo/astrid/data/Update.java
index bd8d2fad1..46954672d 100644
--- a/api/src/com/todoroo/astrid/data/Update.java
+++ b/api/src/com/todoroo/astrid/data/Update.java
@@ -32,7 +32,7 @@ public class Update extends RemoteModel {
public static final Table TABLE = new Table("updates", Update.class);
/** content uri for this model */
- public static final Uri CONTENT_URI = Uri.parse("content://" + AstridApiConstants.PACKAGE + "/" +
+ public static final Uri CONTENT_URI = Uri.parse("content://" + AstridApiConstants.API_PACKAGE + "/" +
TABLE.name);
// --- properties
diff --git a/api/src/com/todoroo/astrid/data/User.java b/api/src/com/todoroo/astrid/data/User.java
index ccc75bc24..2e555503b 100644
--- a/api/src/com/todoroo/astrid/data/User.java
+++ b/api/src/com/todoroo/astrid/data/User.java
@@ -33,7 +33,7 @@ public final class User extends RemoteModel {
public static final Table TABLE = new Table("users", User.class);
/** content uri for this model */
- public static final Uri CONTENT_URI = Uri.parse("content://" + AstridApiConstants.PACKAGE + "/" +
+ public static final Uri CONTENT_URI = Uri.parse("content://" + AstridApiConstants.API_PACKAGE + "/" +
TABLE.name);
// --- properties
diff --git a/astrid/.classpath b/astrid/.classpath
index a20a47fca..20e839511 100644
--- a/astrid/.classpath
+++ b/astrid/.classpath
@@ -31,5 +31,6 @@
+
diff --git a/astrid/AndroidManifest.xml b/astrid/AndroidManifest.xml
index 3801b73dc..486fde02c 100644
--- a/astrid/AndroidManifest.xml
+++ b/astrid/AndroidManifest.xml
@@ -6,7 +6,7 @@
-->
@@ -45,6 +45,9 @@
+
+
+
@@ -82,7 +85,8 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+ android:windowSoftInputMode="stateHidden"/>
+
+
+
+
+
+
+
+
+
+
-
+
+
+
@@ -150,6 +152,8 @@
match="API_SECRET = .*"
replace="API_SECRET = "${apikey.analytics.secret}";" />
+
+
@@ -159,6 +163,15 @@
replace="PUB_KEY_OBFUSCATED = "${apikey.googleplay.pubkey}";" />
+
+
+
+
+
+
@@ -216,6 +230,118 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -290,14 +416,14 @@
-->
-
@@ -318,8 +444,21 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/astrid/libs/gcm-src.jar b/astrid/libs/gcm-src.jar
new file mode 100644
index 000000000..e2d9b43e9
Binary files /dev/null and b/astrid/libs/gcm-src.jar differ
diff --git a/astrid/libs/gcm.jar b/astrid/libs/gcm.jar
new file mode 100644
index 000000000..ac109a830
Binary files /dev/null and b/astrid/libs/gcm.jar differ
diff --git a/astrid/plugin-src/com/timsu/astrid/C2DMReceiver.java b/astrid/plugin-src/com/timsu/astrid/GCMIntentService.java
similarity index 79%
rename from astrid/plugin-src/com/timsu/astrid/C2DMReceiver.java
rename to astrid/plugin-src/com/timsu/astrid/GCMIntentService.java
index 05221f313..f90fb50ab 100644
--- a/astrid/plugin-src/com/timsu/astrid/C2DMReceiver.java
+++ b/astrid/plugin-src/com/timsu/astrid/GCMIntentService.java
@@ -1,8 +1,3 @@
-/**
- * Copyright (c) 2012 Todoroo Inc
- *
- * See the file "LICENSE" for the full license governing this code.
- */
package com.timsu.astrid;
import java.io.IOException;
@@ -12,7 +7,6 @@ import org.json.JSONObject;
import android.app.Notification;
import android.app.PendingIntent;
-import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
@@ -20,6 +14,8 @@ import android.provider.Settings.Secure;
import android.text.TextUtils;
import android.util.Log;
+import com.google.android.gcm.GCMBaseIntentService;
+import com.google.android.gcm.GCMRegistrar;
import com.todoroo.andlib.data.TodorooCursor;
import com.todoroo.andlib.service.Autowired;
import com.todoroo.andlib.service.ContextManager;
@@ -55,36 +51,18 @@ import com.todoroo.astrid.tags.TagFilterExposer;
import com.todoroo.astrid.utility.Constants;
@SuppressWarnings("nls")
-public class C2DMReceiver extends BroadcastReceiver {
+public class GCMIntentService extends GCMBaseIntentService {
- public static final String C2DM_SENDER = "c2dm@astrid.com"; //$NON-NLS-1$
+ public static final String SENDER_ID = "1003855277730"; //$NON-NLS-1$
+ public static final String PREF_REGISTRATION = "gcm_id";
+ public static final String PREF_NEEDS_REGISTRATION = "gcm_needs_reg";
- private static final String PREF_REGISTRATION = "c2dm_key";
- private static final String PREF_LAST_C2DM = "c2dm_last";
+ private static final String PREF_LAST_GCM = "c2dm_last";
+ public static final String PREF_C2DM_REGISTRATION = "c2dm_key";
- private static final long MIN_MILLIS_BETWEEN_FULL_SYNCS = DateUtilities.ONE_HOUR;
-
- @Autowired TaskService taskService;
- @Autowired TagDataService tagDataService;
- @Autowired UpdateDao updateDao;
- @Autowired ActFmPreferenceService actFmPreferenceService;
- @Autowired ActFmSyncService actFmSyncService;
-
- static {
- AstridDependencyInjector.initialize();
- }
-
- private final SyncResultCallbackAdapter refreshOnlyCallback = new SyncResultCallbackAdapter() {
- @Override
- public void finished() {
- ContextManager.getContext().sendBroadcast(new Intent(AstridApiConstants.BROADCAST_EVENT_REFRESH));
- }
- };
-
- private static String getDeviceID() {
+ public static String getDeviceID() {
String id = Secure.getString(ContextManager.getContext().getContentResolver(), Secure.ANDROID_ID);;
if(AndroidUtilities.getSdkVersion() > 8) { //Gingerbread and above
-
//the following uses relection to get android.os.Build.SERIAL to avoid having to build with Gingerbread
try {
if(!Build.UNKNOWN.equals(Build.SERIAL))
@@ -101,31 +79,54 @@ public class C2DMReceiver extends BroadcastReceiver {
return id;
}
- @Override
- public void onReceive(Context context, final Intent intent) {
- ContextManager.setContext(context);
+ static {
+ AstridDependencyInjector.initialize();
+ }
+
+ @Autowired
+ private ActFmSyncService actFmSyncService;
+
+ @Autowired
+ private ActFmPreferenceService actFmPreferenceService;
+
+ @Autowired
+ private TaskService taskService;
+
+ @Autowired
+ private TagDataService tagDataService;
+
+ @Autowired
+ private UpdateDao updateDao;
+
+ public GCMIntentService() {
+ super();
DependencyInjectionService.getInstance().inject(this);
- if (intent.getAction().equals("com.google.android.c2dm.intent.REGISTRATION")) {
- handleRegistration(intent);
- } else if (intent.getAction().equals("com.google.android.c2dm.intent.RECEIVE")) {
- new Thread(new Runnable() {
- @Override
- public void run() {
- if (actFmPreferenceService.isLoggedIn()) {
- if(intent.hasExtra("web_update"))
- if (DateUtilities.now() - actFmPreferenceService.getLastSyncDate() > MIN_MILLIS_BETWEEN_FULL_SYNCS && !actFmPreferenceService.isOngoing())
- new ActFmSyncV2Provider().synchronizeActiveTasks(false, refreshOnlyCallback);
- else
- handleWebUpdate(intent);
- else
- handleMessage(intent);
- }
- }
- }).start();
- }
- }
+ }
- // --- web update handling
+
+ // ===================== Messaging =================== //
+
+ private final SyncResultCallbackAdapter refreshOnlyCallback = new SyncResultCallbackAdapter() {
+ @Override
+ public void finished() {
+ ContextManager.getContext().sendBroadcast(new Intent(AstridApiConstants.BROADCAST_EVENT_REFRESH));
+ }
+ };
+
+ private static final long MIN_MILLIS_BETWEEN_FULL_SYNCS = DateUtilities.ONE_HOUR;
+
+ @Override
+ protected void onMessage(Context context, Intent intent) {
+ if (actFmPreferenceService.isLoggedIn()) {
+ if(intent.hasExtra("web_update"))
+ if (DateUtilities.now() - actFmPreferenceService.getLastSyncDate() > MIN_MILLIS_BETWEEN_FULL_SYNCS && !actFmPreferenceService.isOngoing())
+ new ActFmSyncV2Provider().synchronizeActiveTasks(false, refreshOnlyCallback);
+ else
+ handleWebUpdate(intent);
+ else
+ handleMessage(intent);
+ }
+ }
/** Handle web task or list changed */
protected void handleWebUpdate(Intent intent) {
@@ -192,10 +193,10 @@ public class C2DMReceiver extends BroadcastReceiver {
if(TextUtils.isEmpty(message))
return;
- long lastNotification = Preferences.getLong(PREF_LAST_C2DM, 0);
+ long lastNotification = Preferences.getLong(PREF_LAST_GCM, 0);
if(DateUtilities.now() - lastNotification < 5000L)
return;
- Preferences.setLong(PREF_LAST_C2DM, DateUtilities.now());
+ Preferences.setLong(PREF_LAST_GCM, DateUtilities.now());
Intent notifyIntent = null;
int notifId;
@@ -419,56 +420,67 @@ public class C2DMReceiver extends BroadcastReceiver {
return true;
}
- private void handleRegistration(Intent intent) {
- final String registration = intent.getStringExtra("registration_id");
- if (intent.getStringExtra("error") != null) {
- Log.w("astrid-actfm", "error-c2dm: " + intent.getStringExtra("error"));
- } else if (intent.getStringExtra("unregistered") != null) {
- // un-registration done
- } else if (registration != null) {
- DependencyInjectionService.getInstance().inject(this);
- new Thread() {
- @Override
- public void run() {
- try {
- String deviceId = getDeviceID();
- if (deviceId != null)
- actFmSyncService.invoke("user_set_c2dm", "c2dm", registration, "device_id", deviceId);
- else
- actFmSyncService.invoke("user_set_c2dm", "c2dm", registration);
- Preferences.setString(PREF_REGISTRATION, registration);
- } catch (IOException e) {
- Log.e("astrid-actfm", "error-c2dm-transfer", e);
- }
+ // ==================== Registration ============== //
+
+ public static final void register(Context context) {
+ try {
+ if (AndroidUtilities.getSdkVersion() >= 8) {
+ GCMRegistrar.checkDevice(context);
+ GCMRegistrar.checkManifest(context);
+ final String regId = GCMRegistrar.getRegistrationId(context);
+ if ("".equals(regId)) {
+ GCMRegistrar.register(context, GCMIntentService.SENDER_ID);
+ } else {
+ // TODO: Already registered--do something?
}
- }.start();
+ }
+ } catch (Exception e) {
+ // phone may not support gcm
+ Log.e("actfm-sync", "gcm-register", e);
}
}
- /** try to request registration from c2dm service */
- public static void register() {
- if(Preferences.getStringValue(PREF_REGISTRATION) != null)
- return;
-
- new Thread() {
- @Override
- public void run() {
- Context context = ContextManager.getContext();
- Intent registrationIntent = new Intent("com.google.android.c2dm.intent.REGISTER");
- registrationIntent.putExtra("app", PendingIntent.getBroadcast(context, 0, new Intent(), 0)); // boilerplate
- registrationIntent.putExtra("sender", C2DM_SENDER);
- context.startService(registrationIntent);
+ public static final void unregister(Context context) {
+ try {
+ if (AndroidUtilities.getSdkVersion() >= 8) {
+ GCMRegistrar.unregister(context);
}
- }.start();
+ } catch (Exception e) {
+ Log.e("actfm-sync", "gcm-unregister", e);
+ }
}
- /** unregister with c2dm service */
- public static void unregister() {
- Preferences.setString(PREF_REGISTRATION, null);
- Context context = ContextManager.getContext();
- Intent unregIntent = new Intent("com.google.android.c2dm.intent.UNREGISTER");
- unregIntent.putExtra("app", PendingIntent.getBroadcast(context, 0, new Intent(), 0));
- context.startService(unregIntent);
+ @Override
+ protected void onRegistered(Context context, String registrationId) {
+ actFmSyncService.setGCMRegistration(registrationId);
+ }
+
+ @Override
+ protected void onUnregistered(Context context, String registrationId) {
+ // Server can unregister automatically next time it tries to send a message
+ }
+
+
+ @Override
+ protected void onError(Context context, String intent) {
+ // Unrecoverable
+ }
+
+ // =========== Migration ============= //
+
+ public static class GCMMigration {
+ @Autowired
+ private ActFmPreferenceService actFmPreferenceService;
+
+ public GCMMigration() {
+ DependencyInjectionService.getInstance().inject(this);
+ }
+
+ public void performMigration(Context context) {
+ if (actFmPreferenceService.isLoggedIn()) {
+ GCMIntentService.register(context);
+ }
+ }
}
}
diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmLoginActivity.java b/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmLoginActivity.java
index b632c4c0c..ee961ec23 100644
--- a/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmLoginActivity.java
+++ b/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmLoginActivity.java
@@ -50,7 +50,7 @@ import com.facebook.android.LoginButton;
import com.facebook.android.Util;
import com.google.android.googlelogin.GoogleLoginServiceConstants;
import com.google.android.googlelogin.GoogleLoginServiceHelper;
-import com.timsu.astrid.C2DMReceiver;
+import com.timsu.astrid.GCMIntentService;
import com.timsu.astrid.R;
import com.todoroo.andlib.service.Autowired;
import com.todoroo.andlib.service.ContextManager;
@@ -95,7 +95,7 @@ public class ActFmLoginActivity extends FragmentActivity implements AuthListener
private Facebook facebook;
private AsyncFacebookRunner facebookRunner;
- private TextView errors;
+ protected TextView errors;
public static final String SHOW_TOAST = "show_toast"; //$NON-NLS-1$
@@ -572,12 +572,7 @@ public class ActFmLoginActivity extends FragmentActivity implements AuthListener
setResult(RESULT_OK);
finish();
- try {
- C2DMReceiver.register();
- } catch (Exception e) {
- // phone may not support c2dm
- exceptionService.reportError("error-c2dm-register", e);
- }
+ GCMIntentService.register(this);
}
@SuppressWarnings("nls")
diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmPreferences.java b/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmPreferences.java
index d8ffa63c2..8159711b1 100644
--- a/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmPreferences.java
+++ b/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmPreferences.java
@@ -15,6 +15,7 @@ import android.os.Bundle;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceCategory;
+import android.preference.PreferenceScreen;
import android.widget.Toast;
import com.timsu.astrid.R;
@@ -71,13 +72,18 @@ public class ActFmPreferences extends SyncProviderPreferences {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- findPreference(getString(R.string.actfm_inapp_billing)).setOnPreferenceClickListener(new OnPreferenceClickListener() {
- @Override
- public boolean onPreferenceClick(Preference preference) {
- handleInAppBillingClicked();
- return true;
- }
- });
+ PreferenceScreen screen = getPreferenceScreen();
+ Preference inAppBilling = findPreference(getString(R.string.actfm_inapp_billing));
+ if (Constants.ASTRID_LITE)
+ screen.removePreference(inAppBilling);
+ else
+ inAppBilling.setOnPreferenceClickListener(new OnPreferenceClickListener() {
+ @Override
+ public boolean onPreferenceClick(Preference preference) {
+ handleInAppBillingClicked();
+ return true;
+ }
+ });
findPreference(getString(R.string.actfm_account_type)).setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/EditPeopleControlSet.java b/astrid/plugin-src/com/todoroo/astrid/actfm/EditPeopleControlSet.java
index 835f93e47..8f4b1661f 100644
--- a/astrid/plugin-src/com/todoroo/astrid/actfm/EditPeopleControlSet.java
+++ b/astrid/plugin-src/com/todoroo/astrid/actfm/EditPeopleControlSet.java
@@ -170,15 +170,6 @@ public class EditPeopleControlSet extends PopupControlSet {
DisplayMetrics metrics = new DisplayMetrics();
activity.getWindowManager().getDefaultDisplay().getMetrics(metrics);
sharedWithDialog.setContentView(v, new LayoutParams(metrics.widthPixels - (int)(30 * metrics.density), LayoutParams.WRAP_CONTENT));
- Button dismiss = (Button) v.findViewById(R.id.edit_dlg_ok);
- if (dismiss != null) {
- dismiss.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View view) {
- DialogUtilities.dismissDialog(EditPeopleControlSet.this.activity, sharedWithDialog);
- }
- });
- }
sharedWithDialog.setOwnerActivity(this.activity);
assignedCustom = (EditText) getView().findViewById(R.id.assigned_custom);
@@ -196,6 +187,20 @@ public class EditPeopleControlSet extends PopupControlSet {
setUpListeners();
}
+ @Override
+ protected void setupOkButton(View v) {
+ super.setupOkButton(getSharedWithView());
+ Button dismiss = (Button) getSharedWithView().findViewById(R.id.edit_dlg_ok);
+ if (dismiss != null) {
+ dismiss.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ DialogUtilities.dismissDialog(EditPeopleControlSet.this.activity, sharedWithDialog);
+ }
+ });
+ }
+ }
+
@Override
public void readFromTask(Task sourceTask) {
setTask(sourceTask);
@@ -404,8 +409,8 @@ public class EditPeopleControlSet extends PopupControlSet {
int taskRabbitIndex = addUnassigned ? 3 : 2;
if (!addContactPicker)
taskRabbitIndex--;
- coreUsers.add(taskRabbitIndex, taskRabbitUser);
if(l.didPostToTaskRabbit()){
+ coreUsers.add(taskRabbitIndex, taskRabbitUser);
assignedIndex = taskRabbitIndex;
}
}
diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/TagSettingsActivity.java b/astrid/plugin-src/com/todoroo/astrid/actfm/TagSettingsActivity.java
index b9584024e..cdf0c112c 100644
--- a/astrid/plugin-src/com/todoroo/astrid/actfm/TagSettingsActivity.java
+++ b/astrid/plugin-src/com/todoroo/astrid/actfm/TagSettingsActivity.java
@@ -71,7 +71,7 @@ public class TagSettingsActivity extends FragmentActivity {
public static final int REQUEST_ACTFM_LOGIN = 3;
public static final String TOKEN_AUTOPOPULATE_MEMBERS = "autopopulateMembers"; //$NON-NLS-1$
-
+
public static final String TOKEN_AUTOPOPULATE_NAME = "autopopulateName"; //$NON-NLS-1$
private static final String MEMBERS_IN_PROGRESS = "members"; //$NON-NLS-1$
@@ -149,8 +149,13 @@ public class TagSettingsActivity extends FragmentActivity {
isDialog = AstridPreferences.useTabletLayout(this);
if (isDialog)
setTheme(ThemeService.getDialogTheme());
- else
+ else {
ThemeService.applyTheme(this);
+ if (ThemeService.getUnsimplifiedTheme() == R.style.Theme_White_Alt)
+ getTheme().applyStyle(R.style.SaveAsBackWhite, true);
+ else
+ getTheme().applyStyle(R.style.SaveAsBack, true);
+ }
}
private void showCollaboratorsPopover() {
@@ -233,7 +238,7 @@ public class TagSettingsActivity extends FragmentActivity {
updateMembers(autopopulateMembers);
getIntent().removeExtra(TOKEN_AUTOPOPULATE_MEMBERS);
}
-
+
String autopopulateName = getIntent().getStringExtra(TOKEN_AUTOPOPULATE_NAME);
if (!TextUtils.isEmpty(autopopulateName)) {
tagName.setText(autopopulateName);
@@ -494,12 +499,14 @@ public class TagSettingsActivity extends FragmentActivity {
public boolean onCreateOptionsMenu(Menu menu) {
MenuItem item;
item = menu.add(Menu.NONE, MENU_DISCARD_ID, 0, R.string.TEA_menu_discard);
- item.setIcon(R.drawable.ic_menu_close);
+ item.setIcon(ThemeService.getDrawable(R.drawable.ic_menu_close));
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
- item = menu.add(Menu.NONE, MENU_SAVE_ID, 0, R.string.TEA_menu_save);
- item.setIcon(R.drawable.ic_menu_save);
- item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
+ if (isDialog) {
+ item = menu.add(Menu.NONE, MENU_SAVE_ID, 0, R.string.TEA_menu_save);
+ item.setIcon(ThemeService.getDrawable(R.drawable.ic_menu_save));
+ item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
+ }
return super.onCreateOptionsMenu(menu);
}
@@ -513,7 +520,9 @@ public class TagSettingsActivity extends FragmentActivity {
saveSettings();
break;
case android.R.id.home:
- finish();
+ saveSettings();
+ if (!isFinishing())
+ finish();
break;
}
return super.onOptionsItemSelected(item);
diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/TagViewFragment.java b/astrid/plugin-src/com/todoroo/astrid/actfm/TagViewFragment.java
index 208ac2155..54b3de167 100644
--- a/astrid/plugin-src/com/todoroo/astrid/actfm/TagViewFragment.java
+++ b/astrid/plugin-src/com/todoroo/astrid/actfm/TagViewFragment.java
@@ -17,6 +17,7 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.support.v4.view.Menu;
+import android.support.v4.view.MenuItem;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.view.MotionEvent;
@@ -71,7 +72,7 @@ public class TagViewFragment extends TaskListFragment {
private static final String LAST_FETCH_KEY = "tag-fetch-"; //$NON-NLS-1$
- public static final String BROADCAST_TAG_ACTIVITY = AstridApiConstants.PACKAGE + ".TAG_ACTIVITY"; //$NON-NLS-1$
+ public static final String BROADCAST_TAG_ACTIVITY = AstridApiConstants.API_PACKAGE + ".TAG_ACTIVITY"; //$NON-NLS-1$
public static final String EXTRA_TAG_NAME = "tag"; //$NON-NLS-1$
@@ -83,6 +84,7 @@ public class TagViewFragment extends TaskListFragment {
public static final String EXTRA_TAG_DATA = "tagData"; //$NON-NLS-1$
protected static final int MENU_REFRESH_ID = MENU_SUPPORT_ID + 1;
+ protected static final int MENU_LIST_SETTINGS_ID = R.string.tag_settings_title;
private static final int REQUEST_CODE_SETTINGS = 0;
@@ -188,6 +190,16 @@ public class TagViewFragment extends TaskListFragment {
}
}
+ @Override
+ protected void addMenuItems(Menu menu, Activity activity) {
+ super.addMenuItems(menu, activity);
+ if (!Preferences.getBoolean(R.string.p_show_list_members, true)) {
+ MenuItem item = menu.add(Menu.NONE, MENU_LIST_SETTINGS_ID, 0, R.string.tag_settings_title);
+ item.setIcon(ThemeService.getDrawable(R.drawable.list_settings));
+ item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
+ }
+ }
+
// --- data loading
@Override
@@ -321,6 +333,10 @@ public class TagViewFragment extends TaskListFragment {
}
protected void setUpMembersGallery() {
+ if (!Preferences.getBoolean(R.string.p_show_list_members, true)) {
+ getView().findViewById(R.id.members_header).setVisibility(View.GONE);
+ return;
+ }
if (tagData == null)
return;
LinearLayout membersView = (LinearLayout)getView().findViewById(R.id.shared_with);
@@ -561,6 +577,9 @@ public class TagViewFragment extends TaskListFragment {
case MENU_REFRESH_ID:
refreshData(true);
return true;
+ case MENU_LIST_SETTINGS_ID:
+ settingsListener.onClick(null);
+ return true;
}
return super.handleOptionsMenuItemSelected(id, intent);
diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/TaskCommentsFragment.java b/astrid/plugin-src/com/todoroo/astrid/actfm/TaskCommentsFragment.java
index 8a779a07e..57aac3166 100644
--- a/astrid/plugin-src/com/todoroo/astrid/actfm/TaskCommentsFragment.java
+++ b/astrid/plugin-src/com/todoroo/astrid/actfm/TaskCommentsFragment.java
@@ -8,6 +8,7 @@ import android.widget.ListView;
import com.timsu.astrid.R;
import com.todoroo.andlib.service.Autowired;
import com.todoroo.andlib.sql.Criterion;
+import com.todoroo.andlib.sql.Order;
import com.todoroo.andlib.sql.Query;
import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.astrid.adapter.UpdateAdapter;
@@ -55,10 +56,10 @@ public class TaskCommentsFragment extends CommentsFragment {
@Override
protected Cursor getCursor() {
if (!task.containsNonNullValue(Task.REMOTE_ID))
- return updateDao.query(Query.select(Update.PROPERTIES).where(Update.TASK_LOCAL.eq(task.getId())));
+ return updateDao.query(Query.select(Update.PROPERTIES).where(Update.TASK_LOCAL.eq(task.getId())).orderBy(Order.desc(Update.CREATION_DATE)));
else
return updateDao.query(Query.select(Update.PROPERTIES).where(Criterion.or(
- Update.TASK.eq(task.getValue(Task.REMOTE_ID)), Update.TASK_LOCAL.eq(task.getId()))));
+ Update.TASK.eq(task.getValue(Task.REMOTE_ID)), Update.TASK_LOCAL.eq(task.getId()))).orderBy(Order.desc(Update.CREATION_DATE)));
}
@Override
diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmInvoker.java b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmInvoker.java
index 1160fe718..02aef6b9d 100644
--- a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmInvoker.java
+++ b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmInvoker.java
@@ -105,8 +105,22 @@ public class ActFmInvoker {
*/
public JSONObject invoke(String method, Object... getParameters) throws IOException,
ActFmServiceException {
+ return invokeWithApi(null, method, getParameters);
+ }
+
+ /**
+ * Invokes API method using HTTP GET
+ *
+ * @param method
+ * API method to invoke
+ * @param getParameters
+ * Name/Value pairs. Values will be URL encoded.
+ * @return response object
+ */
+ public JSONObject invokeWithApi(String api, String method, Object... getParameters) throws IOException,
+ ActFmServiceException {
try {
- String request = createFetchUrl(method, getParameters);
+ String request = createFetchUrl(api, method, getParameters);
Log.e("act-fm-invoke", request);
String response = restClient.get(request);
Log.e("act-fm-invoke-response", response);
@@ -135,7 +149,7 @@ public class ActFmInvoker {
public JSONObject post(String method, HttpEntity data, Object... getParameters) throws IOException,
ActFmServiceException {
try {
- String request = createFetchUrl(method, getParameters);
+ String request = createFetchUrl(null, method, getParameters);
Log.e("act-fm-post", request);
String response = restClient.post(request, data);
Log.e("act-fm-post-response", response);
@@ -158,7 +172,7 @@ public class ActFmInvoker {
* @throws UnsupportedEncodingException
* @throws NoSuchAlgorithmException
*/
- public String createFetchUrl(String method, Object... getParameters) throws UnsupportedEncodingException, NoSuchAlgorithmException {
+ private String createFetchUrl(String api, String method, Object... getParameters) throws UnsupportedEncodingException, NoSuchAlgorithmException {
ArrayList> params = new ArrayList>();
for(int i = 0; i < getParameters.length; i += 2) {
if(getParameters[i+1] instanceof ArrayList) {
@@ -195,14 +209,20 @@ public class ActFmInvoker {
});
String url = URL;
- if (method.startsWith("/"))
- url = url.replaceFirst("/api/", "");
+ boolean customApi = false;
+ if (api != null) {
+ customApi = true;
+ url = url.replace("api", api);
+ }
if (Preferences.getBoolean(R.string.actfm_https_key, false))
url = "https:" + url;
else
url = "http:" + url;
- StringBuilder requestBuilder = new StringBuilder(url).append(API_VERSION).append("/").append(method).append('?');
+ StringBuilder requestBuilder = new StringBuilder(url);
+ if (!customApi)
+ requestBuilder.append(API_VERSION).append("/");
+ requestBuilder.append(method).append('?');
StringBuilder sigBuilder = new StringBuilder(method);
for(Pair entry : params) {
if(entry.getRight() == null)
diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncService.java b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncService.java
index df84acd7e..748c72a57 100644
--- a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncService.java
+++ b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncService.java
@@ -32,6 +32,7 @@ import android.os.ConditionVariable;
import android.text.TextUtils;
import android.util.Log;
+import com.timsu.astrid.GCMIntentService;
import com.timsu.astrid.R;
import com.todoroo.andlib.data.AbstractModel;
import com.todoroo.andlib.data.DatabaseDao;
@@ -1233,6 +1234,31 @@ public final class ActFmSyncService {
}
}
+ public void setGCMRegistration(String regId) {
+ try {
+ String deviceId = GCMIntentService.getDeviceID();
+ String existingC2DM = Preferences.getStringValue(GCMIntentService.PREF_C2DM_REGISTRATION);
+
+ ArrayList