Permalink
Browse files

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 #9242

Differential Revision: D3749568

fbshipit-source-id: 2cea1d609dc792aec73d4bcf1eae07575725b4b7
  • Loading branch information...
1 parent 027a270 commit 38354c4cbf42ac29c675a8924837baee29c4ec58 @dozoisch dozoisch committed with Facebook Github Bot Sep 12, 2016
Showing with 9 additions and 3 deletions.
  1. +9 −3 React/Modules/RCTDevMenu.m
@@ -569,13 +569,19 @@ - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger
[_bridge requestReload];
}
+RCT_EXPORT_METHOD(debugRemotely:(BOOL)enableDebug)
+{
+ Class jsDebuggingExecutorClass = NSClassFromString(@"RCTWebSocketExecutor");
+ self.executorClass = enableDebug ? jsDebuggingExecutorClass : nil;
+}
+
- (void)setShakeToShow:(BOOL)shakeToShow
{
_shakeToShow = shakeToShow;
[self updateSetting:@"shakeToShow" value:@(_shakeToShow)];
}
-- (void)setProfilingEnabled:(BOOL)enabled
+RCT_EXPORT_METHOD(setProfilingEnabled:(BOOL)enabled)
{
_profilingEnabled = enabled;
[self updateSetting:@"profilingEnabled" value:@(_profilingEnabled)];
@@ -591,7 +597,7 @@ - (void)setProfilingEnabled:(BOOL)enabled
}
}
-- (void)setLiveReloadEnabled:(BOOL)enabled
+RCT_EXPORT_METHOD(setLiveReloadEnabled:(BOOL)enabled)
{
_liveReloadEnabled = enabled;
[self updateSetting:@"liveReloadEnabled" value:@(_liveReloadEnabled)];
@@ -609,7 +615,7 @@ - (BOOL)hotLoadingAvailable
return _bridge.bundleURL && !_bridge.bundleURL.fileURL; // Only works when running from server
}
-- (void)setHotLoadingEnabled:(BOOL)enabled
+RCT_EXPORT_METHOD(setHotLoadingEnabled:(BOOL)enabled)
{
_hotLoadingEnabled = enabled;
[self updateSetting:@"hotLoadingEnabled" value:@(_hotLoadingEnabled)];

0 comments on commit 38354c4

Please sign in to comment.