From fe3241022b42d50c574a3b1718eb4d216cd82ae5 Mon Sep 17 00:00:00 2001 From: Sam Bosley Date: Thu, 9 Aug 2012 11:42:31 -0700 Subject: [PATCH] AB test persistent reminders preference --- .../com/todoroo/astrid/reminders/ReminderService.java | 5 ++++- astrid/src/com/todoroo/astrid/service/abtesting/ABTests.java | 5 ++++- astrid/src/com/todoroo/astrid/utility/AstridPreferences.java | 5 +++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/astrid/plugin-src/com/todoroo/astrid/reminders/ReminderService.java b/astrid/plugin-src/com/todoroo/astrid/reminders/ReminderService.java index 981b6e9b0..879778f36 100644 --- a/astrid/plugin-src/com/todoroo/astrid/reminders/ReminderService.java +++ b/astrid/plugin-src/com/todoroo/astrid/reminders/ReminderService.java @@ -31,6 +31,8 @@ import com.todoroo.astrid.dao.TaskDao; import com.todoroo.astrid.dao.TaskDao.TaskCriteria; import com.todoroo.astrid.data.Task; import com.todoroo.astrid.data.TaskApiDao; +import com.todoroo.astrid.service.abtesting.ABChooser; +import com.todoroo.astrid.service.abtesting.ABTests; import com.todoroo.astrid.utility.Constants; @@ -114,7 +116,8 @@ public final class ReminderService { Preferences.setIfUnset(prefs, editor, r, R.string.p_rmd_default_random_hours, 0); Preferences.setIfUnset(prefs, editor, r, R.string.p_rmd_time, 18); Preferences.setIfUnset(prefs, editor, r, R.string.p_rmd_nagging, true); - Preferences.setIfUnset(prefs, editor, r, R.string.p_rmd_persistent, true); + Preferences.setIfUnset(prefs, editor, r, R.string.p_rmd_persistent, + ABChooser.readChoiceForTest(ABTests.AB_TEST_PERSISTENT_REMINDERS) != 0); editor.commit(); preferencesInitialized = true; diff --git a/astrid/src/com/todoroo/astrid/service/abtesting/ABTests.java b/astrid/src/com/todoroo/astrid/service/abtesting/ABTests.java index 9ba5506da..5ff23c099 100644 --- a/astrid/src/com/todoroo/astrid/service/abtesting/ABTests.java +++ b/astrid/src/com/todoroo/astrid/service/abtesting/ABTests.java @@ -119,7 +119,10 @@ public class ABTests { bundles.put(testKey, bundle); } - private void initialize() { + public static final String AB_TEST_PERSISTENT_REMINDERS = "android_persist_rmd"; //$NON-NLS-1$ + private void initialize() { + addTest(AB_TEST_PERSISTENT_REMINDERS, new int[] { 1, 1 }, + new int[] { 0, 1 }, new String[] { "rmd-not-persistent", "rmd-persistent" }); //$NON-NLS-1$ //$NON-NLS-2$ } } diff --git a/astrid/src/com/todoroo/astrid/utility/AstridPreferences.java b/astrid/src/com/todoroo/astrid/utility/AstridPreferences.java index 173e3b51d..bd74f77b0 100644 --- a/astrid/src/com/todoroo/astrid/utility/AstridPreferences.java +++ b/astrid/src/com/todoroo/astrid/utility/AstridPreferences.java @@ -20,6 +20,8 @@ import com.todoroo.astrid.core.PluginServices; import com.todoroo.astrid.data.Task; import com.todoroo.astrid.data.User; import com.todoroo.astrid.service.ThemeService; +import com.todoroo.astrid.service.abtesting.ABChooser; +import com.todoroo.astrid.service.abtesting.ABTests; public class AstridPreferences { @@ -64,6 +66,9 @@ public class AstridPreferences { Preferences.setIfUnset(prefs, editor, r, R.string.p_ideas_tab_enabled, true); Preferences.setIfUnset(prefs, editor, r, R.string.p_end_at_deadline, true); + Preferences.setIfUnset(prefs, editor, r, R.string.p_rmd_persistent, + ABChooser.readChoiceForTest(ABTests.AB_TEST_PERSISTENT_REMINDERS) != 0); + if ("white-blue".equals(Preferences.getStringValue(R.string.p_theme))) { //$NON-NLS-1$ migrate from when white-blue wasn't the default Preferences.setString(R.string.p_theme, ThemeService.THEME_WHITE); }