Bug 1586205 - Change LP variables to fallback to same nonLP defaults.r=petru

Differential Revision: https://phabricator.services.mozilla.com/D48184

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Vlad Baicu 2019-10-04 14:32:40 +00:00
Родитель 0c37cdf48a
Коммит 0e1885d861
3 изменённых файлов: 21 добавлений и 23 удалений

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 22 KiB

Просмотреть файл

@ -33,20 +33,15 @@ public class LeanplumVariables {
private static Resources appResources;
private static final String FIRSTRUN_WELCOME_PANEL_GROUP_NAME = "FirstRun Welcome Panel";
private static final String FIRSTRUN_PRIVACY_PANEL_GROUP_NAME = "FirstRun Privacy Panel";
private static final String FIRSTRUN_CUSTOMIZE_PANEL_GROUP_NAME = "FirstRun Customize Panel";
private static final String FIRSTRUN_SYNC_PANEL_GROUP_NAME = "FirstRun Sync Panel";
private static final String FIRSTRUN_SEND_TAB_PANEL_GROUP_NAME = "FirstRun Send Tab Panel";
@Variable(group = FIRSTRUN_WELCOME_PANEL_GROUP_NAME) public static String welcomePanelTitle;
@Variable(group = FIRSTRUN_WELCOME_PANEL_GROUP_NAME) public static String welcomePanelMessage;
@Variable(group = FIRSTRUN_WELCOME_PANEL_GROUP_NAME) public static String welcomePanelSubtext;
@DrawableRes private static int welcomeDrawableId;
@Variable(group = FIRSTRUN_PRIVACY_PANEL_GROUP_NAME) public static String privacyPanelTitle;
@Variable(group = FIRSTRUN_PRIVACY_PANEL_GROUP_NAME) public static String privacyPanelMessage;
@Variable(group = FIRSTRUN_PRIVACY_PANEL_GROUP_NAME) public static String privacyPanelSubtext;
@DrawableRes private static int privacyDrawableId;
@Variable(group = FIRSTRUN_CUSTOMIZE_PANEL_GROUP_NAME) public static String customizePanelTitle;
@Variable(group = FIRSTRUN_CUSTOMIZE_PANEL_GROUP_NAME) public static String customizePanelMessage;
@Variable(group = FIRSTRUN_CUSTOMIZE_PANEL_GROUP_NAME) public static String customizePanelSubtext;
@ -57,6 +52,11 @@ public class LeanplumVariables {
@Variable(group = FIRSTRUN_SYNC_PANEL_GROUP_NAME) public static String syncPanelSubtext;
@DrawableRes private static int syncDrawableId;
@Variable(group = FIRSTRUN_SEND_TAB_PANEL_GROUP_NAME) public static String sendTabPanelTitle;
@Variable(group = FIRSTRUN_SEND_TAB_PANEL_GROUP_NAME) public static String sendTabPanelMessage;
@Variable(group = FIRSTRUN_SEND_TAB_PANEL_GROUP_NAME) public static String sendTabPanelSubtext;
@DrawableRes private static int sendTabDrawableId;
/**
* Allows constructing and/or returning an already constructed instance of this class
* which has all it's fields populated with values from Resources.<br><br>
@ -82,34 +82,32 @@ public class LeanplumVariables {
// Same titles for the screens of the old / new onboarding UX.
welcomePanelTitle = appResources.getString(R.string.firstrun_panel_title_welcome);
privacyPanelTitle = appResources.getString(R.string.firstrun_panel_title_privacy);
customizePanelTitle = appResources.getString(R.string.firstrun_panel_title_customize);
// The new Onboarding UX uses different messages and images. Only if they are localized.
OnboardingResources onboardingUtil = OnboardingResources.getInstance(context);
syncPanelTitle = onboardingUtil.getSyncTitle();
sendTabPanelTitle = appResources.getString(R.string.firstrun_sendtab_title);
if (onboardingUtil.useNewOnboarding()) {
welcomePanelMessage = onboardingUtil.getWelcomeMessage();
welcomePanelSubtext = onboardingUtil.getWelcomeSubtext();
welcomeDrawableId = R.drawable.firstrun_welcome2;
privacyPanelMessage = FirstrunPanel.NO_MESSAGE;
privacyPanelSubtext = onboardingUtil.getPrivacySubtext();
privacyDrawableId = R.drawable.firstrun_private2;
syncPanelMessage = FirstrunPanel.NO_MESSAGE;
syncPanelSubtext = onboardingUtil.getSyncSubtext();
syncDrawableId = onboardingUtil.getSyncImageResId();
sendTabPanelMessage = FirstrunPanel.NO_MESSAGE;
sendTabPanelSubtext = appResources.getString(R.string.firstrun_sendtab_message);
sendTabDrawableId = R.drawable.firstrun_sendtab;
} else {
welcomePanelMessage = appResources.getString(R.string.firstrun_urlbar_message);
welcomePanelSubtext = appResources.getString(R.string.firstrun_urlbar_subtext);
welcomeDrawableId = R.drawable.firstrun_welcome;
privacyPanelMessage = appResources.getString(R.string.firstrun_privacy_message);
privacyPanelSubtext = appResources.getString(R.string.firstrun_privacy_subtext);
privacyDrawableId = R.drawable.firstrun_private;
customizePanelMessage = appResources.getString(R.string.firstrun_customize_message);
customizePanelSubtext = appResources.getString(R.string.firstrun_customize_subtext);
customizingDrawableId = R.drawable.firstrun_data;
@ -124,10 +122,6 @@ public class LeanplumVariables {
return welcomeDrawableId;
}
public static int getPrivacyImage() {
return privacyDrawableId;
}
public static int getCustomizingImage() {
return customizingDrawableId;
}
@ -136,4 +130,8 @@ public class LeanplumVariables {
return syncDrawableId;
}
public static int getSendTabImage() {
return sendTabDrawableId;
}
}

Просмотреть файл

@ -175,10 +175,6 @@ public class MmaLeanplumImp implements MmaInterface {
case WELCOME:
return new PanelConfig(type, useLocalValues, LeanplumVariables.welcomePanelTitle, LeanplumVariables.welcomePanelMessage,
LeanplumVariables.welcomePanelSubtext, LeanplumVariables.getWelcomeImage());
case PRIVACY:
case LAST_PRIVACY:
return new PanelConfig(type, useLocalValues, LeanplumVariables.privacyPanelTitle, LeanplumVariables.privacyPanelMessage,
LeanplumVariables.privacyPanelSubtext, LeanplumVariables.getPrivacyImage());
case CUSTOMIZE:
case LAST_CUSTOMIZE:
return new PanelConfig(type, useLocalValues, LeanplumVariables.customizePanelTitle, LeanplumVariables.customizePanelMessage,
@ -186,6 +182,10 @@ public class MmaLeanplumImp implements MmaInterface {
case SYNC:
return new PanelConfig(type, useLocalValues, LeanplumVariables.syncPanelTitle, LeanplumVariables.syncPanelMessage,
LeanplumVariables.syncPanelSubtext, LeanplumVariables.getSyncImage());
case SEND_TAB:
return new PanelConfig(type, useLocalValues, LeanplumVariables.sendTabPanelTitle, LeanplumVariables.sendTabPanelMessage,
LeanplumVariables.sendTabPanelSubtext, LeanplumVariables.getSendTabImage());
default: // This will also be the case for "WELCOME"
return new PanelConfig(type, useLocalValues, LeanplumVariables.welcomePanelTitle, LeanplumVariables.welcomePanelMessage,
LeanplumVariables.welcomePanelSubtext, LeanplumVariables.getWelcomeImage());