From 8fc7d36d334ca0ba19e5e6afa160b78f97fe6aac Mon Sep 17 00:00:00 2001 From: gabrieldonadel Date: Fri, 31 Mar 2023 17:52:10 -0300 Subject: [PATCH] Remove remote debugging from dev menu --- .../React/CoreModules/RCTDevMenu.mm | 40 +------------------ .../devsupport/BridgeDevSupportManager.java | 16 -------- .../main/res/devsupport/values/strings.xml | 4 -- 3 files changed, 1 insertion(+), 59 deletions(-) diff --git a/packages/react-native/React/CoreModules/RCTDevMenu.mm b/packages/react-native/React/CoreModules/RCTDevMenu.mm index 17c2e874c103c4..303195415b6c6b 100644 --- a/packages/react-native/React/CoreModules/RCTDevMenu.mm +++ b/packages/react-native/React/CoreModules/RCTDevMenu.mm @@ -284,46 +284,8 @@ - (void)setDefaultJSBundle withBundleURL:bundleManager.bundleURL withErrorMessage:@"Failed to open Flipper. Please check that Metro is running."]; }]]; - } else if (devSettings.isRemoteDebuggingAvailable) { -#else - if (devSettings.isRemoteDebuggingAvailable) { -#endif - // 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. - [items addObject:[RCTDevMenuItem - buttonItemWithTitleBlock:^NSString * { - return devSettings.isDebuggingRemotely ? @"Stop Debugging" : @"Debug with Chrome"; - } - handler:^{ - devSettings.isDebuggingRemotely = !devSettings.isDebuggingRemotely; - }]]; - } else { - // If neither are available, we're defaulting to a message that tells you about remote debugging. - [items - addObject:[RCTDevMenuItem - buttonItemWithTitle:@"Debugger Unavailable" - handler:^{ - NSString *message = RCTTurboModuleEnabled() - ? @"Debugging with Chrome is not supported when TurboModules are enabled." - : @"Include the RCTWebSocket library to enable JavaScript debugging."; - UIAlertController *alertController = - [UIAlertController alertControllerWithTitle:@"Debugger Unavailable" - message:message - preferredStyle:UIAlertControllerStyleAlert]; - __weak __typeof__(alertController) weakAlertController = alertController; - [alertController - addAction:[UIAlertAction actionWithTitle:@"OK" - style:UIAlertActionStyleDefault - handler:^(__unused UIAlertAction *action) { - [weakAlertController - dismissViewControllerAnimated:YES - completion:nil]; - }]]; - [RCTPresentedViewController() presentViewController:alertController - animated:YES - completion:NULL]; - }]]; } +#endif } [items addObject:[RCTDevMenuItem diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/BridgeDevSupportManager.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/BridgeDevSupportManager.java index 4d7110c91eb954..6b57090f41cbe5 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/BridgeDevSupportManager.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/BridgeDevSupportManager.java @@ -115,22 +115,6 @@ public void onOptionSelected() { 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(); - } - }); - } } public DevLoadingViewManager getDevLoadingViewManager() { diff --git a/packages/react-native/ReactAndroid/src/main/res/devsupport/values/strings.xml b/packages/react-native/ReactAndroid/src/main/res/devsupport/values/strings.xml index 9ebb11b0830bd4..1b9c4ffefa28e4 100644 --- a/packages/react-native/ReactAndroid/src/main/res/devsupport/values/strings.xml +++ b/packages/react-native/ReactAndroid/src/main/res/devsupport/values/strings.xml @@ -6,12 +6,8 @@ Failed to open Flipper. Please check that Metro is running. Open React DevTools Open Debugger - Debug - Stop Debugging Connecting to debugger... Failed to connect to debugger! - Debug with Chrome - Stop Chrome Debugging Enable Fast Refresh Disable Fast Refresh Disabling Fast Refresh because it requires a development bundle.