-
Notifications
You must be signed in to change notification settings - Fork 25k
PR: Enable remote debugging automatically upon launch of the application #757
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
For anyone at FB looking at this, what could I have done differently not to break the TravisCI build? |
|
What is the use-case for this? Make it easier to develop apps? If so, I'd suggest making "is debugger enabled" a setting that survives app restarts. |
|
I submitted #652 a couple days ago which lets you specify the primary executor. So one thing you could do is create a bridge that defaults to the WebSocketExecutor: [[RCTBridge alloc] initWithBundlePath:bundlePath
moduleProvider:block
launchOptions:launchOptions
executorBlock:^{
Class executorClass = NSClassFromString(@"RCTWebSocketExecutor");
if (!executorClass) {
RCTLogError(@"WebSocket debugger is not available. Did you forget to include RCTWebSocketExecutor?");
executorClass = [RCTContextExecutor class];
}
return [[executorClass alloc] init];
}
debugExecutorBlock:nil];One thing that's nice about this approach is you can configure the WebSocketExecutor to support using the Chrome debugger while running the app on your phone. |
|
@frantic , the use case is simple. This PR simply pulls step 2 out of the loop, which is really 2 steps. Think about what life would be like if you were a web developer that had to reopen dev tools upon every page refresh. This PR is synonymous to keeping the web debug tools open & on the ready on every page refresh. @ide, |
|
@jaygarcia - how about the suggestion I made with remembering the last executor? I think this would be even more friendly and you don't have to remember to change your code before shipping to the appstore |
|
@frantic, that is probably the best idea/pattern, but we'd still need the #if DEBUG/#endif around it. That way when it is shipped to the app store, and the developer forgets to turn it off, it will never be enabled. Want me to push that into the Info.plist? That's a trivial action. =) |
|
@frantic gentle nudge. =) |
|
I imagine that this code is very outdated, given lots of changes since this PR nearly two weeks ago. I remain interested in making this happen, even if it requires refactoring on my part. =) |
|
One major change that landed recently is that the executor and debug mode, etc. are all controlled via the bridge now, rather than the root view. We're going to be doing some more refactoring of this soon, so I'd probably hold off on trying to update this for now. As @frantic suggests, the eventual solution will probably be for the app to simply remember it's last state, so if you set debug mode in the dev menu and then do a cold start, it should still be in debug mode. |
It looks like you folks got around to doing this, works great, so I will close this |
* Reduce versions to build on Netlify * Remove imagebackground and safeareaview from 0.5 * Keep 0.46 and 0.50
I've had issues recently where I wanted debugging enabled upon launch of the application. This patch does just that.
From AppDelegate.m, the end developer can change one boolean on the RootView initialization.
This Boolean cascades the RootView into the Bridge instantiation,
where if YES, the executor class is configured as
self.executorClass = NSClassFromString(@"RCTWebSocketExecutor");