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
This commit is contained in:
David Aurelio 2018-05-03 08:38:00 -07:00 committed by Facebook Github Bot
parent be379efc9b
commit e8662a2123
2 changed files with 19 additions and 0 deletions

View File

@ -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;

View File

@ -25,6 +25,13 @@
android:summary="Request delta bundles from metro to get faster reloads (Experimental)"
android:defaultValue="true"
/>
<CheckBoxPreference
android:key="js_bundle_deltas_cpp"
android:title="Native Delta Handling"
android:summary="Handles delta bundles in native code without writing code to disk (Experimental)."
android:defaultValue="false"
android:dependency="js_bundle_deltas"
/>
<CheckBoxPreference
android:key="animations_debug"
android:title="Animations FPS Summaries"