Added AB testing of theme:

pull/14/head
Sam Bosley 13 years ago
parent 2957e7ee2e
commit ec4e3e61aa

@ -41,6 +41,8 @@ import com.todoroo.astrid.gtasks.sync.GtasksSyncOnSaveService;
import com.todoroo.astrid.opencrx.OpencrxCoreUtils;
import com.todoroo.astrid.producteev.ProducteevUtilities;
import com.todoroo.astrid.reminders.ReminderStartupReceiver;
import com.todoroo.astrid.service.abtesting.ABChooser;
import com.todoroo.astrid.service.abtesting.ABOptions;
import com.todoroo.astrid.service.abtesting.FeatureFlipper;
import com.todoroo.astrid.utility.AstridPreferences;
import com.todoroo.astrid.utility.Constants;
@ -85,6 +87,8 @@ public class StartupService {
@Autowired FeatureFlipper featureFlipper;
@Autowired ABChooser abChooser;
/**
* bit to prevent multiple initializations
*/
@ -126,6 +130,16 @@ public class StartupService {
exceptionService.reportError("astrid-startup-version-read", e); //$NON-NLS-1$
}
if (latestSetVersion == 0) {
int defaultTheme = abChooser.getChoiceForOption(ABOptions.AB_THEME_KEY);
if (defaultTheme == 0)
Preferences.setString(R.string.p_theme, "white");
else
Preferences.setString(R.string.p_theme, "black");
} else {
abChooser.setChoiceForOption(ABOptions.AB_THEME_KEY, 0);
}
int version = 0;
try {
PackageManager pm = context.getPackageManager();
@ -143,8 +157,9 @@ public class StartupService {
// invoke upgrade service
boolean justUpgraded = latestSetVersion != version;
if(justUpgraded && version > 0) {
if(latestSetVersion > 0)
if(latestSetVersion > 0) {
upgradeService.performUpgrade(context, latestSetVersion);
}
AstridPreferences.setCurrentVersion(version);
}
if(latestSetVersion == 0) {

@ -4,6 +4,8 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import com.todoroo.astrid.service.StatisticsConstants;
/**
* Helper class to define options with their probabilities and descriptions
* @author Sam Bosley <sam@astrid.com>
@ -167,6 +169,14 @@ public class ABOptions {
private void initialize() { // Set up
//Calls to addOption go here
addOption(AB_THEME_KEY, AB_THEME_PROBS, AB_THEME_DESCRIPTIONS, AB_THEME_EVENTS);
}
public static final String AB_THEME_KEY = "ab-theme";
private static final int[] AB_THEME_PROBS = { 9, 1 };
private static final String[] AB_THEME_DESCRIPTIONS = { "ab-theme-white", "ab-theme-black" };
private static final String[] AB_THEME_EVENTS = { StatisticsConstants.USER_FIRST_TASK,
StatisticsConstants.USER_FIRST_LIST,
StatisticsConstants.ACTFM_NEW_USER };
}

Loading…
Cancel
Save