mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-24 04:16:00 +08:00
Added support for JavaScript third-party debuggers
Summary:* Add ability to configure the app that should open when starting debugging axemclion discussed this feature with tadeuzagallo and martinbigio on: https://github.com/facebook/react-native/issues/5051 Closes https://github.com/facebook/react-native/pull/5683 Reviewed By: martinbigio Differential Revision: D2971497 Pulled By: mkonicek fb-gh-sync-id: 91c3ce68feed989658124bb96cb61d03dd032599 fbshipit-source-id: 91c3ce68feed989658124bb96cb61d03dd032599
This commit is contained in:
committed by
Facebook Github Bot 1
parent
b9396cd744
commit
4c8a9f0d00
@@ -185,7 +185,7 @@ RCT_EXPORT_MODULE()
|
||||
[weakSelf.bridge.eventDispatcher sendDeviceEventWithName:@"toggleElementInspector" body:nil];
|
||||
}]];
|
||||
|
||||
_webSocketExecutorName = [_defaults objectForKey:@"websocket-executor-name"] ?: @"Chrome";
|
||||
_webSocketExecutorName = [_defaults objectForKey:@"websocket-executor-name"] ?: @"JS Remotely";
|
||||
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
@@ -443,8 +443,8 @@ RCT_EXPORT_MODULE()
|
||||
[weakSelf reload];
|
||||
}]];
|
||||
|
||||
Class chromeExecutorClass = NSClassFromString(@"RCTWebSocketExecutor");
|
||||
if (!chromeExecutorClass) {
|
||||
Class jsDebuggingExecutorClass = NSClassFromString(@"RCTWebSocketExecutor");
|
||||
if (!jsDebuggingExecutorClass) {
|
||||
[items addObject:[RCTDevMenuItem buttonItemWithTitle:[NSString stringWithFormat:@"%@ Debugger Unavailable", _webSocketExecutorName] handler:^{
|
||||
UIAlertView *alert = RCTAlertView(
|
||||
[NSString stringWithFormat:@"%@ Debugger Unavailable", _webSocketExecutorName],
|
||||
@@ -455,10 +455,10 @@ RCT_EXPORT_MODULE()
|
||||
[alert show];
|
||||
}]];
|
||||
} else {
|
||||
BOOL isDebuggingInChrome = _executorClass && _executorClass == chromeExecutorClass;
|
||||
NSString *debugTitleChrome = isDebuggingInChrome ? [NSString stringWithFormat:@"Disable %@ Debugging", _webSocketExecutorName] : [NSString stringWithFormat:@"Debug in %@", _webSocketExecutorName];
|
||||
[items addObject:[RCTDevMenuItem buttonItemWithTitle:debugTitleChrome handler:^{
|
||||
weakSelf.executorClass = isDebuggingInChrome ? Nil : chromeExecutorClass;
|
||||
BOOL isDebuggingJS = _executorClass && _executorClass == jsDebuggingExecutorClass;
|
||||
NSString *debugTitleJS = isDebuggingJS ? [NSString stringWithFormat:@"Disable %@ Debugging", _webSocketExecutorName] : [NSString stringWithFormat:@"Debug %@", _webSocketExecutorName];
|
||||
[items addObject:[RCTDevMenuItem buttonItemWithTitle:debugTitleJS handler:^{
|
||||
weakSelf.executorClass = isDebuggingJS ? Nil : jsDebuggingExecutorClass;
|
||||
}]];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user