Move Chrome debugging menu item to BridgeDevSupportManager

Summary:
Google Chrome debugging is only supported by the bridge. So, it makes sense to move it to BridgeDevSupportManager.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D29031514

fbshipit-source-id: 4d6b6bb3bc298be5fe4d9f96c0d019676fe256db
This commit is contained in:
Ramanpreet Nara
2021-06-15 12:15:39 -07:00
committed by Facebook GitHub Bot
parent 2f943d9d63
commit 5f2fae0c2d
2 changed files with 19 additions and 14 deletions
@@ -107,6 +107,22 @@ public final class BridgeDevSupportManager extends DevSupportManagerBase {
toggleJSSamplingProfiler();
}
});
if (!getDevSettings().isDeviceDebugEnabled()) {
// For remote debugging, we open up Chrome running the app in a web worker.
// Note that this requires async communication, which will not work for Turbo Modules.
addCustomDevOption(
getDevSettings().isRemoteJSDebugEnabled()
? applicationContext.getString(com.facebook.react.R.string.catalyst_debug_stop)
: applicationContext.getString(com.facebook.react.R.string.catalyst_debug),
new DevOptionHandler() {
@Override
public void onOptionSelected() {
getDevSettings().setRemoteJSDebugEnabled(!getDevSettings().isRemoteJSDebugEnabled());
handleReloadJS();
}
});
}
}
@Override
@@ -396,6 +396,7 @@ public abstract class DevSupportManagerBase implements DevSupportManager {
handleReloadJS();
}
});
if (mDevSettings.isDeviceDebugEnabled()) {
// For on-device debugging we link out to Flipper.
// Since we're assuming Flipper is available, also include the DevTools.
@@ -428,21 +429,8 @@ public abstract class DevSupportManagerBase implements DevSupportManager {
mApplicationContext.getString(R.string.catalyst_open_flipper_error));
}
});
} else {
// For remote debugging, we open up Chrome running the app in a web worker.
// Note that this requires async communication, which will not work for Turbo Modules.
options.put(
mDevSettings.isRemoteJSDebugEnabled()
? mApplicationContext.getString(R.string.catalyst_debug_stop)
: mApplicationContext.getString(R.string.catalyst_debug),
new DevOptionHandler() {
@Override
public void onOptionSelected() {
mDevSettings.setRemoteJSDebugEnabled(!mDevSettings.isRemoteJSDebugEnabled());
handleReloadJS();
}
});
}
options.put(
mApplicationContext.getString(R.string.catalyst_change_bundle_location),
new DevOptionHandler() {
@@ -478,6 +466,7 @@ public abstract class DevSupportManagerBase implements DevSupportManager {
bundleLocationDialog.show();
}
});
options.put(
// NOTE: `isElementInspectorEnabled` is not guaranteed to be accurate.
mApplicationContext.getString(R.string.catalyst_inspector),