Bug 1351585 - Part 4. Add pref to turn on/off leanplum. r?maliu,sebastian
MozReview-Commit-ID: 8LHvMPSxAdl
--- a/mobile/android/app/mobile.js
+++ b/mobile/android/app/mobile.js
@@ -409,16 +409,25 @@ pref("browser.ui.zoom.force-user-scalabl
// When removing this Nightly flag, also remember to remove the flags surrounding this feature
// in GeckoPreferences and BrowserApp (see bug 1245930).
#ifdef NIGHTLY_BUILD
pref("ui.bookmark.mobilefolder.enabled", true);
#else
pref("ui.bookmark.mobilefolder.enabled", false);
#endif
+#if MOZ_UPDATE_CHANNEL == nightly
+pref("mma.enabled", true);
+#elif MOZ_UPDATE_CHANNEL == beta
+pref("mma.enabled", true);
+#else
+pref("mma.enabled", true);
+#endif
+
+
pref("ui.touch.radius.enabled", false);
pref("ui.touch.radius.leftmm", 3);
pref("ui.touch.radius.topmm", 5);
pref("ui.touch.radius.rightmm", 3);
pref("ui.touch.radius.bottommm", 2);
pref("ui.touch.radius.visitedWeight", 120);
pref("ui.mouse.radius.enabled", false);
--- a/mobile/android/base/java/org/mozilla/gecko/mma/MmaDelegate.java
+++ b/mobile/android/base/java/org/mozilla/gecko/mma/MmaDelegate.java
@@ -5,23 +5,45 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.gecko.mma;
import android.app.Application;
import android.content.Context;
import org.mozilla.gecko.MmaConstants;
+import org.mozilla.gecko.PrefsHelper;
public class MmaDelegate {
+ private static final String ENABLE_PREF = "mma.enabled";
+
private static MmaInterface mmaHelper = MmaConstants.getMma();
+ private static final String[] prefs = { ENABLE_PREF };
+
+
public static void init(Application application) {
- mmaHelper.init(application);
+ setupPrefHandler(application);
}
public void start(Context context) {
mmaHelper.start(context);
}
-}
+ private static void setupPrefHandler(final Application application) {
+ PrefsHelper.PrefHandler handler = new PrefsHelper.PrefHandlerBase() {
+ @Override
+ public void prefValue(String pref, boolean value) {
+ if (pref.equals(ENABLE_PREF)) {
+ if (value) {
+ mmaHelper.init(application);
+ }
+
+ }
+ }
+ };
+ PrefsHelper.addObserver(prefs, handler);
+
+
+ }
+}
\ No newline at end of file