Skip to content

Commit 3ef7de8

Browse files
huntiefacebook-github-bot
authored andcommitted
Improve remote debugging LogBox message, cleanup unused openURL method (#39582)
Summary: Pull Request resolved: #39582 Some tidying up around remote JS debugging while testing. See also react-native-community/cli#2083. ## Changelog: [iOS][Breaking] - Remove `openURL` method from `RCTInspectorDevServerHelper` Reviewed By: cipolleschi Differential Revision: D49499068 fbshipit-source-id: 843ef6cf1af658756466854fc1a0b3edd91c1f37
1 parent 8c5340f commit 3ef7de8

File tree

3 files changed

+5
-27
lines changed

3 files changed

+5
-27
lines changed

packages/react-native/React/CoreModules/RCTWebSocketExecutor.mm

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,10 @@ - (void)sendMessage:(NSDictionary<NSString *, id> *)message onReply:(RCTWSMessag
165165

166166
dispatch_async(_jsQueue, ^{
167167
if (!self.valid) {
168-
callback(RCTErrorWithMessage(@"Runtime is not ready for debugging. Make sure Metro is running."), nil);
168+
callback(
169+
RCTErrorWithMessage(
170+
@"Runtime is not ready for debugging. Make sure Metro is running and the Remote Debugging browser window is open."),
171+
nil);
169172
return;
170173
}
171174

packages/react-native/React/DevSupport/RCTInspectorDevServerHelper.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
+ (RCTInspectorPackagerConnection *)connectWithBundleURL:(NSURL *)bundleURL;
1919
+ (void)disableDebugger;
20-
+ (void)openURL:(NSString *)url withBundleURL:(NSURL *)bundleURL withErrorMessage:(NSString *)errorMessage;
2120
+ (void)openDebugger:(NSURL *)bundleURL withErrorMessage:(NSString *)errorMessage;
2221
@end
2322

packages/react-native/React/DevSupport/RCTInspectorDevServerHelper.mm

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,7 @@
5151
escapedDeviceName,
5252
escapedAppName]];
5353
}
54-
static NSURL *getOpenUrlEndpoint(NSURL *bundleURL)
55-
{
56-
return [NSURL URLWithString:[NSString stringWithFormat:@"http://%@/open-url", getServerHost(bundleURL)]];
57-
}
54+
5855
@implementation RCTInspectorDevServerHelper
5956

6057
RCT_NOT_IMPLEMENTED(-(instancetype)init)
@@ -68,27 +65,6 @@ static void sendEventToAllConnections(NSString *event)
6865
}
6966
}
7067

71-
+ (void)openURL:(NSString *)url withBundleURL:(NSURL *)bundleURL withErrorMessage:(NSString *)errorMessage
72-
{
73-
NSURL *endpoint = getOpenUrlEndpoint(bundleURL);
74-
75-
NSDictionary *jsonBodyDict = @{@"url" : url};
76-
NSData *jsonBodyData = [NSJSONSerialization dataWithJSONObject:jsonBodyDict options:kNilOptions error:nil];
77-
78-
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:endpoint];
79-
[request setHTTPMethod:@"POST"];
80-
[request setHTTPBody:jsonBodyData];
81-
82-
[[[NSURLSession sharedSession]
83-
dataTaskWithRequest:request
84-
completionHandler:^(
85-
__unused NSData *_Nullable data, __unused NSURLResponse *_Nullable response, NSError *_Nullable error) {
86-
if (error != nullptr) {
87-
RCTLogWarn(@"%@", errorMessage);
88-
}
89-
}] resume];
90-
}
91-
9268
+ (void)openDebugger:(NSURL *)bundleURL withErrorMessage:(NSString *)errorMessage
9369
{
9470
NSString *appId = [[[NSBundle mainBundle] bundleIdentifier]

0 commit comments

Comments
 (0)