Skip to content

Commit 011eb4c

Browse files
rickhanloniifacebook-github-bot
authored andcommitted
Remove "Debug with Nuclide" option
Summary: This is no longer needed. Reviewed By: cpojer Differential Revision: D20722274 fbshipit-source-id: 5bc3104e90811d724f42aadbf137ab8eff718ca0
1 parent 7007df6 commit 011eb4c

File tree

5 files changed

+4
-126
lines changed

5 files changed

+4
-126
lines changed

React/CoreModules/RCTDevMenu.mm

+1-17
Original file line numberDiff line numberDiff line change
@@ -249,28 +249,12 @@ - (void)setDefaultJSBundle
249249
} else {
250250
[items addObject:[RCTDevMenuItem
251251
buttonItemWithTitleBlock:^NSString * {
252-
if (devSettings.isNuclideDebuggingAvailable) {
253-
return devSettings.isDebuggingRemotely ? @"Stop Chrome Debugger" : @"Debug with Chrome";
254-
} else {
255-
return devSettings.isDebuggingRemotely ? @"Stop Debugging" : @"Debug";
256-
}
252+
return devSettings.isDebuggingRemotely ? @"Stop Debugging" : @"Debug";
257253
}
258254
handler:^{
259255
devSettings.isDebuggingRemotely = !devSettings.isDebuggingRemotely;
260256
}]];
261257
}
262-
263-
if (devSettings.isNuclideDebuggingAvailable && !devSettings.isDebuggingRemotely) {
264-
[items addObject:[RCTDevMenuItem buttonItemWithTitle:@"Debug with Nuclide"
265-
handler:^{
266-
#if RCT_ENABLE_INSPECTOR
267-
[RCTInspectorDevServerHelper
268-
attachDebugger:@"ReactNative"
269-
withBundleURL:bridge.bundleURL
270-
withView:RCTPresentedViewController()];
271-
#endif
272-
}]];
273-
}
274258
}
275259

276260
[items addObject:[RCTDevMenuItem

React/DevSupport/RCTInspectorDevServerHelper.h

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
+ (RCTInspectorPackagerConnection *)connectWithBundleURL:(NSURL *)bundleURL;
1919
+ (void)disableDebugger;
20-
+ (void)attachDebugger:(NSString *)owner withBundleURL:(NSURL *)bundleURL withView:(UIViewController *)view;
2120
@end
2221

2322
#endif

React/DevSupport/RCTInspectorDevServerHelper.mm

-48
Original file line numberDiff line numberDiff line change
@@ -49,24 +49,6 @@
4949
escapedAppName]];
5050
}
5151

52-
static NSURL *getAttachDeviceUrl(NSURL *bundleURL, NSString *title)
53-
{
54-
NSNumber *metroBundlerPort = @8081;
55-
NSString *metroBundlerPortStr = [[[NSProcessInfo processInfo] environment] objectForKey:@"RCT_METRO_PORT"];
56-
if (metroBundlerPortStr && [metroBundlerPortStr length] > 0) {
57-
metroBundlerPort = [NSNumber numberWithInt:[metroBundlerPortStr intValue]];
58-
}
59-
NSString *escapedDeviceName = [[[UIDevice currentDevice] name]
60-
stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLHostAllowedCharacterSet];
61-
NSString *escapedAppName = [[[NSBundle mainBundle] bundleIdentifier]
62-
stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLHostAllowedCharacterSet];
63-
return [NSURL URLWithString:[NSString stringWithFormat:@"http://%@/attach-debugger-nuclide?title=%@&device=%@&app=%@",
64-
getServerHost(bundleURL, metroBundlerPort),
65-
title,
66-
escapedDeviceName,
67-
escapedAppName]];
68-
}
69-
7052
@implementation RCTInspectorDevServerHelper
7153

7254
RCT_NOT_IMPLEMENTED(-(instancetype)init)
@@ -80,36 +62,6 @@ static void sendEventToAllConnections(NSString *event)
8062
}
8163
}
8264

83-
static void displayErrorAlert(UIViewController *view, NSString *message)
84-
{
85-
UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil
86-
message:message
87-
preferredStyle:UIAlertControllerStyleAlert];
88-
[view presentViewController:alert animated:YES completion:nil];
89-
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_SEC * 2.5), dispatch_get_main_queue(), ^{
90-
[alert dismissViewControllerAnimated:YES completion:nil];
91-
});
92-
}
93-
94-
+ (void)attachDebugger:(NSString *)owner withBundleURL:(NSURL *)bundleURL withView:(UIViewController *)view
95-
{
96-
NSURL *url = getAttachDeviceUrl(bundleURL, owner);
97-
98-
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
99-
[request setHTTPMethod:@"GET"];
100-
101-
__weak UIViewController *viewCapture = view;
102-
[[[NSURLSession sharedSession]
103-
dataTaskWithRequest:request
104-
completionHandler:^(
105-
__unused NSData *_Nullable data, __unused NSURLResponse *_Nullable response, NSError *_Nullable error) {
106-
UIViewController *viewCaptureStrong = viewCapture;
107-
if (error != nullptr && viewCaptureStrong != nullptr) {
108-
displayErrorAlert(viewCaptureStrong, @"The request to attach Nuclide couldn't reach Metro!");
109-
}
110-
}] resume];
111-
}
112-
11365
+ (void)disableDebugger
11466
{
11567
sendEventToAllConnections(kDebuggerMsgDisable);

ReactAndroid/src/main/java/com/facebook/react/devsupport/DevServerHelper.java

-43
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,10 @@
77

88
package com.facebook.react.devsupport;
99

10-
import android.content.Context;
1110
import android.os.AsyncTask;
12-
import android.widget.Toast;
1311
import androidx.annotation.Nullable;
1412
import com.facebook.common.logging.FLog;
1513
import com.facebook.infer.annotation.Assertions;
16-
import com.facebook.react.R;
1714
import com.facebook.react.common.ReactConstants;
1815
import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener;
1916
import com.facebook.react.devsupport.interfaces.PackagerStatusCallback;
@@ -250,36 +247,6 @@ protected Void doInBackground(Void... params) {
250247
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
251248
}
252249

253-
public void attachDebugger(final Context context, final String title) {
254-
new AsyncTask<Void, String, Boolean>() {
255-
@Override
256-
protected Boolean doInBackground(Void... ignore) {
257-
return doSync();
258-
}
259-
260-
public boolean doSync() {
261-
try {
262-
String attachToNuclideUrl = getInspectorAttachUrl(context, title);
263-
OkHttpClient client = new OkHttpClient();
264-
Request request = new Request.Builder().url(attachToNuclideUrl).build();
265-
client.newCall(request).execute();
266-
return true;
267-
} catch (IOException e) {
268-
FLog.e(ReactConstants.TAG, "Failed to send attach request to Inspector", e);
269-
return false;
270-
}
271-
}
272-
273-
@Override
274-
protected void onPostExecute(Boolean result) {
275-
if (!result) {
276-
String message = context.getString(R.string.catalyst_debug_nuclide_error);
277-
Toast.makeText(context, message, Toast.LENGTH_LONG).show();
278-
}
279-
}
280-
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
281-
}
282-
283250
public void symbolicateStackTrace(
284251
Iterable<StackFrame> stackFrames, final SymbolicationListener listener) {
285252
try {
@@ -370,16 +337,6 @@ private String getInspectorDeviceUrl() {
370337
mPackageName);
371338
}
372339

373-
private String getInspectorAttachUrl(Context context, String title) {
374-
return String.format(
375-
Locale.US,
376-
"http://%s/nuclide/attach-debugger-nuclide?title=%s&app=%s&device=%s",
377-
AndroidInfoHelpers.getServerHost(context),
378-
title,
379-
mPackageName,
380-
AndroidInfoHelpers.getFriendlyDeviceName());
381-
}
382-
383340
public void downloadBundleFromURL(
384341
DevBundleDownloadListener callback,
385342
File outputFile,

ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerBase.java

+3-17
Original file line numberDiff line numberDiff line change
@@ -433,30 +433,16 @@ public void onOptionSelected() {
433433
}
434434
});
435435
options.put(
436-
mDevSettings.isNuclideJSDebugEnabled()
437-
? mDevSettings.isRemoteJSDebugEnabled()
438-
? mApplicationContext.getString(R.string.catalyst_debug_chrome_stop)
439-
: mApplicationContext.getString(R.string.catalyst_debug_chrome)
440-
: mDevSettings.isRemoteJSDebugEnabled()
441-
? mApplicationContext.getString(R.string.catalyst_debug_stop)
442-
: mApplicationContext.getString(R.string.catalyst_debug),
436+
mDevSettings.isRemoteJSDebugEnabled()
437+
? mApplicationContext.getString(R.string.catalyst_debug_stop)
438+
: mApplicationContext.getString(R.string.catalyst_debug),
443439
new DevOptionHandler() {
444440
@Override
445441
public void onOptionSelected() {
446442
mDevSettings.setRemoteJSDebugEnabled(!mDevSettings.isRemoteJSDebugEnabled());
447443
handleReloadJS();
448444
}
449445
});
450-
if (mDevSettings.isNuclideJSDebugEnabled()) {
451-
options.put(
452-
mApplicationContext.getString(R.string.catalyst_debug_nuclide),
453-
new DevOptionHandler() {
454-
@Override
455-
public void onOptionSelected() {
456-
mDevServerHelper.attachDebugger(mApplicationContext, "ReactNative");
457-
}
458-
});
459-
}
460446
options.put(
461447
mApplicationContext.getString(R.string.catalyst_change_bundle_location),
462448
new DevOptionHandler() {

0 commit comments

Comments
 (0)