From 7326f6f00ff24bcd36d529e809a0848d7db87562 Mon Sep 17 00:00:00 2001 From: Alex Baker Date: Sat, 31 May 2014 23:31:14 -0500 Subject: [PATCH] Remove ActFmPreferenceService --- .../actfm/sync/ActFmPreferenceService.java | 80 ------------------- .../astrid/gcal/CalendarAlarmReceiver.java | 9 +-- 2 files changed, 1 insertion(+), 88 deletions(-) delete mode 100644 astrid/src/main/java/com/todoroo/astrid/actfm/sync/ActFmPreferenceService.java diff --git a/astrid/src/main/java/com/todoroo/astrid/actfm/sync/ActFmPreferenceService.java b/astrid/src/main/java/com/todoroo/astrid/actfm/sync/ActFmPreferenceService.java deleted file mode 100644 index f67dc80bc..000000000 --- a/astrid/src/main/java/com/todoroo/astrid/actfm/sync/ActFmPreferenceService.java +++ /dev/null @@ -1,80 +0,0 @@ -/** - * Copyright (c) 2012 Todoroo Inc - * - * See the file "LICENSE" for the full license governing this code. - */ -package com.todoroo.astrid.actfm.sync; - -import com.todoroo.andlib.utility.Preferences; - -import org.json.JSONException; -import org.json.JSONObject; - -/** - * Methods for working with GTasks preferences - * - * @author timsu - * - */ -public class ActFmPreferenceService { - - /** add-on identifier */ - public static final String IDENTIFIER = "actfm"; //$NON-NLS-1$ - - /** - * @return get user id - */ - public static String userId() { - try { - String value = Preferences.getStringValue(PREF_USER_ID); - if (value == null) { - return Long.toString(Preferences.getLong(PREF_USER_ID, -2L)); - } - return value; - } catch (Exception e) { - return Long.toString(Preferences.getLong(PREF_USER_ID, -2L)); - } - } - - /** Act.fm current user id */ - public static final String PREF_USER_ID = IDENTIFIER + "_user"; //$NON-NLS-1$ - - /** Act.fm current user name */ - public static final String PREF_NAME = IDENTIFIER + "_name"; //$NON-NLS-1$ - - /** Act.fm current user first name */ - public static final String PREF_FIRST_NAME = IDENTIFIER + "_first_name"; //$NON-NLS-1$ - - /** Act.fm current user last name */ - public static final String PREF_LAST_NAME = IDENTIFIER + "_last_name"; //$NON-NLS-1$ - - /** Act.fm current user picture */ - public static final String PREF_PICTURE = IDENTIFIER + "_picture"; //$NON-NLS-1$ - - /** Act.fm current user email */ - public static final String PREF_EMAIL = IDENTIFIER + "_email"; //$NON-NLS-1$ - - private static JSONObject user = null; - - public synchronized static JSONObject thisUser() { - if(user == null) { - user = new JSONObject(); - populateUser(); - } - return user; - } - - private static void populateUser() { - try { - user.put("name", Preferences.getStringValue(PREF_NAME)); - user.put("first_name", Preferences.getStringValue(PREF_FIRST_NAME)); - user.put("last_name", Preferences.getStringValue(PREF_LAST_NAME)); - user.put("premium", true); - user.put("email", Preferences.getStringValue(PREF_EMAIL)); - user.put("picture", Preferences.getStringValue(PREF_PICTURE)); - user.put("id", ActFmPreferenceService.userId()); - } catch (JSONException e) { - throw new RuntimeException(e); - } - } -} diff --git a/astrid/src/main/java/com/todoroo/astrid/gcal/CalendarAlarmReceiver.java b/astrid/src/main/java/com/todoroo/astrid/gcal/CalendarAlarmReceiver.java index fe41e37ba..3ad99054a 100644 --- a/astrid/src/main/java/com/todoroo/astrid/gcal/CalendarAlarmReceiver.java +++ b/astrid/src/main/java/com/todoroo/astrid/gcal/CalendarAlarmReceiver.java @@ -13,7 +13,6 @@ import android.text.TextUtils; import com.todoroo.andlib.utility.AndroidUtilities; import com.todoroo.andlib.utility.DateUtilities; import com.todoroo.andlib.utility.Preferences; -import com.todoroo.astrid.actfm.sync.ActFmPreferenceService; import com.todoroo.astrid.utility.Constants; import org.tasks.R; @@ -66,8 +65,7 @@ public class CalendarAlarmReceiver extends BroadcastReceiver { } } - private void showCalReminder(Context context, - long eventId, boolean fromPostpone) { + private void showCalReminder(Context context, long eventId, boolean fromPostpone) { ContentResolver cr = context.getContentResolver(); Uri eventUri = Calendars.getCalendarContentUri(Calendars.CALENDAR_CONTENT_EVENTS); @@ -121,11 +119,6 @@ public class CalendarAlarmReceiver extends BroadcastReceiver { phoneAccounts.add(a.name); } - String astridUser = ActFmPreferenceService.thisUser().optString("email"); - if (!TextUtils.isEmpty(astridUser)) { - phoneAccounts.add(astridUser); - } - boolean includesMe = false; for (attendees.moveToFirst(); !attendees.isAfterLast(); attendees.moveToNext()) { String name = attendees.getString(nameIndex);