From e8662a2123a0dfd4caefb2233a6df29faa0774b0 Mon Sep 17 00:00:00 2001 From: David Aurelio Date: Thu, 3 May 2018 08:38:00 -0700 Subject: [PATCH] Add react dev menu setting for cpp deltas Summary: Adds a menu item to enable handling of JS module deltas in native code. The check box is dependent on JS Deltas being activated in the first place. Reviewed By: cpojer Differential Revision: D7380167 fbshipit-source-id: 3001d12140542b4e52b1ce96be3c5f56e52a15f8 --- .../react/devsupport/DevInternalSettings.java | 12 ++++++++++++ .../src/main/res/devsupport/xml/preferences.xml | 7 +++++++ 2 files changed, 19 insertions(+) diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevInternalSettings.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevInternalSettings.java index e3204e645..5c07b7ead 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevInternalSettings.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevInternalSettings.java @@ -30,6 +30,7 @@ public class DevInternalSettings implements private static final String PREFS_JS_DEV_MODE_DEBUG_KEY = "js_dev_mode_debug"; private static final String PREFS_JS_MINIFY_DEBUG_KEY = "js_minify_debug"; private static final String PREFS_JS_BUNDLE_DELTAS_KEY = "js_bundle_deltas"; + private static final String PREFS_JS_BUNDLE_DELTAS_CPP_KEY = "js_bundle_deltas_cpp"; private static final String PREFS_ANIMATIONS_DEBUG_KEY = "animations_debug"; private static final String PREFS_RELOAD_ON_JS_CHANGE_KEY = "reload_on_js_change"; private static final String PREFS_INSPECTOR_DEBUG_KEY = "inspector_debug"; @@ -83,6 +84,7 @@ public class DevInternalSettings implements || PREFS_RELOAD_ON_JS_CHANGE_KEY.equals(key) || PREFS_JS_DEV_MODE_DEBUG_KEY.equals(key) || PREFS_JS_BUNDLE_DELTAS_KEY.equals(key) + || PREFS_JS_BUNDLE_DELTAS_CPP_KEY.equals(key) || PREFS_JS_MINIFY_DEBUG_KEY.equals(key)) { mListener.onInternalSettingsChanged(); } @@ -123,6 +125,16 @@ public class DevInternalSettings implements mPreferences.edit().putBoolean(PREFS_JS_BUNDLE_DELTAS_KEY, enabled).apply(); } + @SuppressLint("SharedPreferencesUse") + public boolean isBundleDeltasCppEnabled() { + return mPreferences.getBoolean(PREFS_JS_BUNDLE_DELTAS_CPP_KEY, false); + } + + @SuppressLint("SharedPreferencesUse") + public void setBundleDeltasCppEnabled(boolean enabled) { + mPreferences.edit().putBoolean(PREFS_JS_BUNDLE_DELTAS_CPP_KEY, enabled).apply(); + } + @Override public boolean isNuclideJSDebugEnabled() { return ReactBuildConfig.IS_INTERNAL_BUILD && ReactBuildConfig.DEBUG; diff --git a/ReactAndroid/src/main/res/devsupport/xml/preferences.xml b/ReactAndroid/src/main/res/devsupport/xml/preferences.xml index 7ce20de3f..bb98248b9 100644 --- a/ReactAndroid/src/main/res/devsupport/xml/preferences.xml +++ b/ReactAndroid/src/main/res/devsupport/xml/preferences.xml @@ -25,6 +25,13 @@ android:summary="Request delta bundles from metro to get faster reloads (Experimental)" android:defaultValue="true" /> +