From 3b4ac7958344a484b00690af16895fc3fa168008 Mon Sep 17 00:00:00 2001 From: Dan Caspi Date: Wed, 16 Nov 2016 07:23:27 -0800 Subject: [PATCH] Exposing RCTDevMenuItem when not in DEV mode and adding a missing header Reviewed By: javache Differential Revision: D4189179 fbshipit-source-id: c9ad45b20bab884e5d0fcd17efc494fc37ab7d92 --- React/Executors/RCTJSCExecutor.mm | 4 ---- React/Modules/RCTDevMenu.m | 9 +++++++++ React/React.xcodeproj/project.pbxproj | 6 ++++++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/React/Executors/RCTJSCExecutor.mm b/React/Executors/RCTJSCExecutor.mm index dce385e4e..b1ce0ee8f 100644 --- a/React/Executors/RCTJSCExecutor.mm +++ b/React/Executors/RCTJSCExecutor.mm @@ -175,7 +175,6 @@ RCT_NOT_IMPLEMENTED(-(instancetype)init) RCT_EXPORT_MODULE() #if RCT_DEV - static void RCTInstallJSCProfiler(RCTBridge *bridge, JSContextRef context) { if (RCTJSCProfilerIsSupported()) { @@ -419,8 +418,6 @@ static NSThread *newJavaScriptThread(void) } }; -#ifdef RCT_DEV - // Add toggles for JSC's sampling profiler, if the profiler is enabled if (self->_jscWrapper->JSSamplingProfilerEnabled()) { // Mark this thread as the main JS thread before starting profiling. @@ -451,7 +448,6 @@ static NSThread *newJavaScriptThread(void) }; } #endif -#endif #if RCT_DEV RCTInstallJSCProfiler(self->_bridge, context.JSGlobalContextRef); diff --git a/React/Modules/RCTDevMenu.m b/React/Modules/RCTDevMenu.m index 160e40b92..dbc49486d 100644 --- a/React/Modules/RCTDevMenu.m +++ b/React/Modules/RCTDevMenu.m @@ -694,6 +694,15 @@ RCT_EXPORT_METHOD(setHotLoadingEnabled:(BOOL)enabled) @end +@implementation RCTDevMenuItem + ++ (instancetype)buttonItemWithTitle:(NSString *)title handler:(void(^)(void))handler {return nil;} ++ (instancetype)toggleItemWithKey:(NSString *)key + title:(NSString *)title + selectedTitle:(NSString *)selectedTitle + handler:(void(^)(BOOL selected))handler {return nil;} +@end + #endif @implementation RCTBridge (RCTDevMenu) diff --git a/React/React.xcodeproj/project.pbxproj b/React/React.xcodeproj/project.pbxproj index c55468638..e7d939462 100644 --- a/React/React.xcodeproj/project.pbxproj +++ b/React/React.xcodeproj/project.pbxproj @@ -168,6 +168,7 @@ 2D8C2E331DA40441000EE098 /* RCTMultipartStreamReader.m in Sources */ = {isa = PBXBuildFile; fileRef = 001BFCCF1D8381DE008E587E /* RCTMultipartStreamReader.m */; }; 2DD0EFE11DA84F2800B0C975 /* RCTStatusBarManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 13723B4F1A82FD3C00F88898 /* RCTStatusBarManager.m */; }; 352DCFF01D19F4C20056D623 /* RCTI18nUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 352DCFEF1D19F4C20056D623 /* RCTI18nUtil.m */; }; + 369123E11DDC75850095B341 /* JSCSamplingProfiler.m in Sources */ = {isa = PBXBuildFile; fileRef = 369123E01DDC75850095B341 /* JSCSamplingProfiler.m */; }; 391E86A41C623EC800009732 /* RCTTouchEvent.m in Sources */ = {isa = PBXBuildFile; fileRef = 391E86A21C623EC800009732 /* RCTTouchEvent.m */; }; 3D1E68DB1CABD13900DD7465 /* RCTDisplayLink.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D1E68D91CABD13900DD7465 /* RCTDisplayLink.m */; }; 3D37B5821D522B190042D5B5 /* RCTFont.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3D37B5811D522B190042D5B5 /* RCTFont.mm */; }; @@ -378,6 +379,8 @@ 2D2A28131D9B038B00D4039D /* libReact-tvOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libReact-tvOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 352DCFEE1D19F4C20056D623 /* RCTI18nUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTI18nUtil.h; sourceTree = ""; }; 352DCFEF1D19F4C20056D623 /* RCTI18nUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTI18nUtil.m; sourceTree = ""; }; + 369123DF1DDC75850095B341 /* JSCSamplingProfiler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCSamplingProfiler.h; sourceTree = ""; }; + 369123E01DDC75850095B341 /* JSCSamplingProfiler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCSamplingProfiler.m; sourceTree = ""; }; 391E86A21C623EC800009732 /* RCTTouchEvent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTTouchEvent.m; sourceTree = ""; }; 391E86A31C623EC800009732 /* RCTTouchEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTTouchEvent.h; sourceTree = ""; }; 3D1E68D81CABD13900DD7465 /* RCTDisplayLink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTDisplayLink.h; sourceTree = ""; }; @@ -490,6 +493,8 @@ 13B07FE01A69315300A75B9A /* Modules */ = { isa = PBXGroup; children = ( + 369123DF1DDC75850095B341 /* JSCSamplingProfiler.h */, + 369123E01DDC75850095B341 /* JSCSamplingProfiler.m */, 13D9FEE91CDCCECF00158BD7 /* RCTEventEmitter.h */, 13D9FEEA1CDCCECF00158BD7 /* RCTEventEmitter.m */, E9B20B791B500126007A2DA7 /* RCTAccessibilityManager.h */, @@ -1031,6 +1036,7 @@ 13B080061A6947C200A75B9A /* RCTScrollViewManager.m in Sources */, 14200DAA1AC179B3008EE6BA /* RCTJavaScriptLoader.m in Sources */, 137327EA1AA5CF210034F82E /* RCTTabBarManager.m in Sources */, + 369123E11DDC75850095B341 /* JSCSamplingProfiler.m in Sources */, 13B080261A694A8400A75B9A /* RCTWrapperViewController.m in Sources */, 13B080051A6947C200A75B9A /* RCTScrollView.m in Sources */, E9B20B7B1B500126007A2DA7 /* RCTAccessibilityManager.m in Sources */,