Added code for ab testing the new cal reminders (currently on for all for prerelease testing purposes), added preference for turning them off

pull/14/head
Sam Bosley 13 years ago
parent a68360026f
commit 79515e85d2

@ -11,7 +11,9 @@ import android.net.Uri;
import android.text.TextUtils;
import android.util.Log;
import com.timsu.astrid.R;
import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.utility.Constants;
@SuppressWarnings("nls")
@ -33,6 +35,8 @@ public class CalendarAlarmReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (!Preferences.getBoolean(R.string.p_calendar_reminders, true))
return;
try {
ContentResolver cr = context.getContentResolver();
long eventId = intent.getLongExtra(TOKEN_EVENT_ID, -1);

@ -10,7 +10,9 @@ import android.content.Intent;
import android.database.Cursor;
import android.util.Log;
import com.timsu.astrid.R;
import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.utility.Constants;
@SuppressWarnings("nls")
@ -19,6 +21,9 @@ public class CalendarAlarmScheduler {
public static final String TAG = "calendar-alarm";
public static void scheduleAllCalendarAlarms(Context context) {
if (!Preferences.getBoolean(R.string.p_calendar_reminders, true))
return;
ContentResolver cr = context.getContentResolver();
long now = DateUtilities.now();

@ -49,6 +49,9 @@
<!-- field missed calls preference -->
<string name="p_field_missed_calls">field_missed_calls</string>
<!-- calendar reminders preference -->
<string name="p_calendar_reminders">p_calendar_reminder</string>
<!-- show friends view preference -->
<string name="p_show_friends_view">show_friends_view</string>

@ -564,6 +564,9 @@
<!-- Calendar reminder: include event members -->
<string name="CRA_include_members">Share with event members</string>
<!-- Calendar reminder: preference title -->
<string name="CRA_calendar_reminders_pref_title">Monitor calendar events</string>
<!-- ===================================================== HelpActivity == -->
<!-- Help: Button to get support from our website -->

@ -17,6 +17,10 @@
android:key="@string/p_field_missed_calls"
android:title="@string/MCA_missed_calls_pref_title"/>
<CheckBoxPreference
android:key="@string/p_calendar_reminders"
android:title="@string/CRA_calendar_reminders_pref_title" />
<CheckBoxPreference
android:key="@string/p_third_party_addons"
android:title="@string/EPr_third_party_addons" />

@ -121,10 +121,14 @@ public class ABTests {
public static final String AB_SIMPLE_TASK_ROW = "android_simple_task_row"; //$NON-NLS-1$
public static final String AB_CALENDAR_REMINDERS = "android_cal_reminders"; //$NON-NLS-1$
private void initialize() {
addTest(AB_SIMPLE_TASK_ROW, new int[] { 1, 1 },
new int[] { 1, 0 }, new String[] { "original-row-style", "simple-row-style" });//$NON-NLS-1$ //$NON-NLS-2$
addTest(AB_CALENDAR_REMINDERS, new int[] { 0, 1 },
new int[] { 0, 1 }, new String[] { "no-cal-reminders", "show-cal-reminders" }); //$NON-NLS-1$ //$NON-NLS-2$
}
}

@ -74,7 +74,8 @@ public class AstridPreferences {
Preferences.setIfUnset(prefs, editor, r, R.string.p_taskRowStyle,
ABChooser.readChoiceForTest(ABTests.AB_SIMPLE_TASK_ROW) != 0);
Preferences.setIfUnset(prefs, editor, r, R.string.p_swipe_lists_enabled, false);
Preferences.setIfUnset(prefs, editor, r, R.string.p_calendar_reminders,
ABChooser.readChoiceForTest(ABTests.AB_CALENDAR_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);

Loading…
Cancel
Save