|
|
|
@ -8,6 +8,11 @@ package com.todoroo.astrid.service.abtesting;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.Set;
|
|
|
|
import java.util.Set;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import android.accounts.Account;
|
|
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.google.api.client.googleapis.extensions.android2.auth.GoogleAccountManager;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Helper class to define options with their probabilities and descriptions
|
|
|
|
* Helper class to define options with their probabilities and descriptions
|
|
|
|
* @author Sam Bosley <sam@astrid.com>
|
|
|
|
* @author Sam Bosley <sam@astrid.com>
|
|
|
|
@ -20,6 +25,30 @@ public class ABTests {
|
|
|
|
initialize();
|
|
|
|
initialize();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Initialization for any tests that require a context or other logic
|
|
|
|
|
|
|
|
* to be initialized should go here. This method is called from the startup
|
|
|
|
|
|
|
|
* service before any test choices are made, so it is safe to add
|
|
|
|
|
|
|
|
* tests here. It's also ok if this method is a no-op sometimes.
|
|
|
|
|
|
|
|
* @param context
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public void externalInit(Context context) {
|
|
|
|
|
|
|
|
// The outer 'if' statement is to prevent one test from being added one time
|
|
|
|
|
|
|
|
// and the other from being added later if the accounts changed
|
|
|
|
|
|
|
|
if (ABChooser.readChoiceForTest(AB_NEW_LOGIN_NO_GOOGLE) == ABChooser.NO_OPTION
|
|
|
|
|
|
|
|
&& ABChooser.readChoiceForTest(AB_NEW_LOGIN_YES_GOOGLE) == ABChooser.NO_OPTION) {
|
|
|
|
|
|
|
|
GoogleAccountManager am = new GoogleAccountManager(context);
|
|
|
|
|
|
|
|
Account[] accounts = am.getAccounts();
|
|
|
|
|
|
|
|
if (accounts == null || accounts.length == 0) {
|
|
|
|
|
|
|
|
addTest(AB_NEW_LOGIN_NO_GOOGLE, new int[] { 1, 1 },
|
|
|
|
|
|
|
|
new int[] { 1, 0 }, new String[] { "old-welcome", "new-welcome" }); //$NON-NLS-1$//$NON-NLS-2$
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
addTest(AB_NEW_LOGIN_YES_GOOGLE, new int[] { 1, 1, 1 },
|
|
|
|
|
|
|
|
new int[] { 1, 0, 0 }, new String[] { "old-welcome", "new-welcome", "new-quick-welcome" }); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Gets the integer array of weighted probabilities for an option key
|
|
|
|
* Gets the integer array of weighted probabilities for an option key
|
|
|
|
* @param key
|
|
|
|
* @param key
|
|
|
|
@ -127,6 +156,10 @@ public class ABTests {
|
|
|
|
|
|
|
|
|
|
|
|
public static final String AB_DEFAULT_EDIT_TAB = "android_default_edit_tab"; //$NON-NLS-1$
|
|
|
|
public static final String AB_DEFAULT_EDIT_TAB = "android_default_edit_tab"; //$NON-NLS-1$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static final String AB_NEW_LOGIN_NO_GOOGLE = "android_new_login_n_google"; //$NON-NLS-1$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static final String AB_NEW_LOGIN_YES_GOOGLE = "android_new_login_y_google"; //$NON-NLS-1$
|
|
|
|
|
|
|
|
|
|
|
|
private void initialize() {
|
|
|
|
private void initialize() {
|
|
|
|
|
|
|
|
|
|
|
|
addTest(AB_FEATURED_LISTS, new int[] { 1, 1 },
|
|
|
|
addTest(AB_FEATURED_LISTS, new int[] { 1, 1 },
|
|
|
|
|