Add: expose hot & live reload, remote debug, profiling

Summary:
Explain the **motivation** for making this change. What existing problem does the pull request solve?

- Being able to call these from JS is really useful in envs where action sheets are not available (eg: App Extensions). I made the functions act as explicit toggles, this way it's easy to set the wanted behavior.

**Test plan (required)**
- I tested the functions manually.

![Remote debug from an iMessage Application](https://cloud.githubusercontent.com/assets/4422516/17445198/976ebfe0-5af8-11e6-885f-1b40f9518aab.png)
Closes https://github.com/facebook/react-native/pull/9242

Differential Revision: D3749568

fbshipit-source-id: 2cea1d609dc792aec73d4bcf1eae07575725b4b7
This commit is contained in:
Hugo Dozois 2016-09-12 02:57:40 -07:00 committed by Facebook Github Bot
parent 027a2706d2
commit 38354c4cbf

View File

@ -569,13 +569,19 @@ RCT_EXPORT_METHOD(reload)
[_bridge requestReload]; [_bridge requestReload];
} }
RCT_EXPORT_METHOD(debugRemotely:(BOOL)enableDebug)
{
Class jsDebuggingExecutorClass = NSClassFromString(@"RCTWebSocketExecutor");
self.executorClass = enableDebug ? jsDebuggingExecutorClass : nil;
}
- (void)setShakeToShow:(BOOL)shakeToShow - (void)setShakeToShow:(BOOL)shakeToShow
{ {
_shakeToShow = shakeToShow; _shakeToShow = shakeToShow;
[self updateSetting:@"shakeToShow" value:@(_shakeToShow)]; [self updateSetting:@"shakeToShow" value:@(_shakeToShow)];
} }
- (void)setProfilingEnabled:(BOOL)enabled RCT_EXPORT_METHOD(setProfilingEnabled:(BOOL)enabled)
{ {
_profilingEnabled = enabled; _profilingEnabled = enabled;
[self updateSetting:@"profilingEnabled" value:@(_profilingEnabled)]; [self updateSetting:@"profilingEnabled" value:@(_profilingEnabled)];
@ -591,7 +597,7 @@ RCT_EXPORT_METHOD(reload)
} }
} }
- (void)setLiveReloadEnabled:(BOOL)enabled RCT_EXPORT_METHOD(setLiveReloadEnabled:(BOOL)enabled)
{ {
_liveReloadEnabled = enabled; _liveReloadEnabled = enabled;
[self updateSetting:@"liveReloadEnabled" value:@(_liveReloadEnabled)]; [self updateSetting:@"liveReloadEnabled" value:@(_liveReloadEnabled)];
@ -609,7 +615,7 @@ RCT_EXPORT_METHOD(reload)
return _bridge.bundleURL && !_bridge.bundleURL.fileURL; // Only works when running from server return _bridge.bundleURL && !_bridge.bundleURL.fileURL; // Only works when running from server
} }
- (void)setHotLoadingEnabled:(BOOL)enabled RCT_EXPORT_METHOD(setHotLoadingEnabled:(BOOL)enabled)
{ {
_hotLoadingEnabled = enabled; _hotLoadingEnabled = enabled;
[self updateSetting:@"hotLoadingEnabled" value:@(_hotLoadingEnabled)]; [self updateSetting:@"hotLoadingEnabled" value:@(_hotLoadingEnabled)];