Bug 1547924 - Ensure Leanplum Onboarding falls back to the new Onboarding UX; r=VladBaicu
authorPetru Lingurar <petru.lingurar@softvision.ro>
Tue, 30 Apr 2019 16:43:46 +0300
changeset 535399 49f7d8f42f5eb06c6c106372965b25fcd122bf51
parent 535398 3c4fb056f40c649f8f79d3710a8fb57a0c8fe0ef
child 535400 f44e2e31e5cc1f0d3ff156b1598aa93f10e6685d
push id11522
push userffxbld-merge
push dateMon, 01 Jul 2019 09:00:55 +0000
treeherdermozilla-beta@53ea74d2bd09 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersVladBaicu
bugs1547924
milestone69.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1547924 - Ensure Leanplum Onboarding falls back to the new Onboarding UX; r=VladBaicu Summary: - Added the `LAST_PRIVACY` case for when the user is already signed into Firefox; - Use the new default onboarding strings and images. If they are localized. Differential Revision: https://phabricator.services.mozilla.com/D29347
mobile/android/base/java/org/mozilla/gecko/mma/LeanplumVariables.java
mobile/android/base/java/org/mozilla/gecko/mma/MmaLeanplumImp.java
--- a/mobile/android/base/java/org/mozilla/gecko/mma/LeanplumVariables.java
+++ b/mobile/android/base/java/org/mozilla/gecko/mma/LeanplumVariables.java
@@ -8,16 +8,18 @@ package org.mozilla.gecko.mma;
 import android.content.Context;
 import android.content.res.Resources;
 import android.support.annotation.DrawableRes;
 import android.support.annotation.NonNull;
 
 import com.leanplum.annotations.Variable;
 
 import org.mozilla.gecko.R;
+import org.mozilla.gecko.firstrun.FirstrunPanel;
+import org.mozilla.gecko.util.OnboardingStringUtil;
 
 import java.lang.reflect.Field;
 
 /**
  * Unified repo for all LeanPlum variables.<br>
  * <ul>To make them appear in the LP dashboard and get new values from the server
  *      <li>they must be annotated with {@link com.leanplum.annotations.Variable}.</li>
  *      <li>they need to be parsed with {@link com.leanplum.annotations.Parser} after {@link com.leanplum.Leanplum#setApplicationContext(Context)}</li>
@@ -72,35 +74,53 @@ public class LeanplumVariables {
     }
 
     /**
      * Allows setting default values for instance variables.
      * @param context used to access application resources
      */
     private LeanplumVariables(@NonNull Context context) {
         appResources = context.getResources();
+
+        // Same titles for the screens of the old / new onboarding UX.
         welcomePanelTitle = appResources.getString(R.string.firstrun_panel_title_welcome);
-        welcomePanelMessage = appResources.getString(R.string.firstrun_urlbar_message);
-        welcomePanelSubtext = appResources.getString(R.string.firstrun_urlbar_subtext);
-        welcomeDrawableId = R.drawable.firstrun_welcome;
+        privacyPanelTitle = appResources.getString(R.string.firstrun_panel_title_privacy);
+        customizePanelTitle = appResources.getString(R.string.firstrun_panel_title_customize);
+        syncPanelTitle = appResources.getString(R.string.firstrun_sync_title);
 
-        privacyPanelTitle = appResources.getString(R.string.firstrun_panel_title_privacy);
-        privacyPanelMessage = appResources.getString(R.string.firstrun_privacy_message);
-        privacyPanelSubtext = appResources.getString(R.string.firstrun_privacy_subtext);
-        privacyDrawableId = R.drawable.firstrun_private;
+        // The new Onboarding UX uses different messages and images. Only if they are localized.
+        if (OnboardingStringUtil.getInstance(context).areStringsLocalized()) {
+            welcomePanelMessage = appResources.getString(R.string.newfirstrun_urlbar_message);
+            welcomePanelSubtext = appResources.getString(R.string.newfirstrun_privacy_subtext);
+            welcomeDrawableId = R.drawable.firstrun_welcome2;
+
+            privacyPanelMessage = FirstrunPanel.NO_MESSAGE;
+            privacyPanelSubtext = appResources.getString(R.string.newfirstrun_privacy_subtext);
+            privacyDrawableId = R.drawable.firstrun_private2;
 
-        customizePanelTitle = appResources.getString(R.string.firstrun_panel_title_customize);
-        customizePanelMessage = appResources.getString(R.string.firstrun_customize_message);
-        customizePanelSubtext = appResources.getString(R.string.firstrun_customize_subtext);
-        customizingDrawableId = R.drawable.firstrun_data;
+            syncPanelMessage = FirstrunPanel.NO_MESSAGE;
+            syncPanelSubtext = appResources.getString(R.string.newfirstrun_sync_subtext);
+            syncDrawableId = R.drawable.firstrun_sync2;
+        } else {
+            welcomePanelMessage = appResources.getString(R.string.firstrun_urlbar_message);
+            welcomePanelSubtext = appResources.getString(R.string.firstrun_urlbar_subtext);
+            welcomeDrawableId = R.drawable.firstrun_welcome;
 
-        syncPanelTitle = appResources.getString(R.string.firstrun_sync_title);
-        syncPanelMessage = appResources.getString(R.string.firstrun_sync_message);
-        syncPanelSubtext = appResources.getString(R.string.firstrun_sync_subtext);
-        syncDrawableId = R.drawable.firstrun_sync;
+            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;
+
+            syncPanelMessage = appResources.getString(R.string.firstrun_sync_message);
+            syncPanelSubtext = appResources.getString(R.string.firstrun_sync_subtext);
+            syncDrawableId = R.drawable.firstrun_sync;
+        }
     }
 
     public static int getWelcomeImage() {
         return welcomeDrawableId;
     }
 
     public static int getPrivacyImage() {
         return privacyDrawableId;
--- a/mobile/android/base/java/org/mozilla/gecko/mma/MmaLeanplumImp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/mma/MmaLeanplumImp.java
@@ -165,16 +165,17 @@ public class MmaLeanplumImp implements M
             throw new UnsupportedOperationException("Cannot build remote panel config with local values");
         }
 
         switch (type) {
             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,
                         LeanplumVariables.customizePanelSubtext, LeanplumVariables.getCustomizingImage());
             case SYNC:
                 return new PanelConfig(type, useLocalValues, LeanplumVariables.syncPanelTitle, LeanplumVariables.syncPanelMessage,