Skip to content

Commit 2bb6d93

Browse files
authored
Disable dev mode on ship builds (#888)
* revert dev mode on ship builds * rctuicolor * remove unused variable * pod install
1 parent 8b8f01b commit 2bb6d93

File tree

8 files changed

+14
-44
lines changed

8 files changed

+14
-44
lines changed

Libraries/Image/RCTImageLoader.mm

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -966,15 +966,13 @@ - (RCTImageLoaderCancellationBlock)decodeImageData:(NSData *)data
966966
UIImage *image = RCTDecodeImageWithData(data, size, scale, resizeMode);
967967

968968
#if !TARGET_OS_OSX && RCT_DEV // TODO(macOS GH#774)
969-
if ([[self->_bridge devSettings] isDevModeEnabled]) { // TODO(OSS Candidate ISS#2710739)
970-
CGSize imagePixelSize = RCTSizeInPixels(image.size, UIImageGetScale(image)); // TODO(macOS GH#774)
971-
CGSize screenPixelSize = RCTSizeInPixels(RCTScreenSize(), RCTScreenScale());
972-
if (imagePixelSize.width * imagePixelSize.height >
973-
screenPixelSize.width * screenPixelSize.height) {
974-
RCTLogInfo(@"[PERF ASSETS] Loading image at size %@, which is larger "
975-
"than the screen size %@", NSStringFromCGSize(imagePixelSize),
976-
NSStringFromCGSize(screenPixelSize));
977-
}
969+
CGSize imagePixelSize = RCTSizeInPixels(image.size, UIImageGetScale(image)); // TODO(macOS GH#774)
970+
CGSize screenPixelSize = RCTSizeInPixels(RCTScreenSize(), RCTScreenScale());
971+
if (imagePixelSize.width * imagePixelSize.height >
972+
screenPixelSize.width * screenPixelSize.height) {
973+
RCTLogInfo(@"[PERF ASSETS] Loading image at size %@, which is larger "
974+
"than the screen size %@", NSStringFromCGSize(imagePixelSize),
975+
NSStringFromCGSize(screenPixelSize));
978976
}
979977
#endif
980978

React/Base/RCTDefines.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@
4242
#if DEBUG
4343
#define RCT_DEV 1
4444
#else
45-
// Dev Mode is now enabled or disabled at runtime via the -[RCTDevSettings isDevModeEnabled] property
46-
#define RCT_DEV 1
45+
#define RCT_DEV 0
4746
#endif
4847
#endif
4948

React/Base/RCTRootView.m

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -467,9 +467,7 @@ - (NSMenu *)menuForEvent:(NSEvent *)event
467467
{
468468
NSMenu *menu = nil;
469469
#if __has_include("RCTDevMenu.h") && RCT_DEV
470-
if ([[_bridge devSettings] isDevModeEnabled]) {
471-
menu = [[_bridge devMenu] menu];
472-
}
470+
menu = [[_bridge devMenu] menu];
473471
#endif
474472
if (menu == nil) {
475473
menu = [super menuForEvent:event];

React/CoreModules/RCTDevLoadingView.mm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ - (void)setBridge:(RCTBridge *)bridge
7171
name:RCTJavaScriptDidFailToLoadNotification
7272
object:nil];
7373

74-
if ([[bridge devSettings] isDevModeEnabled] && bridge.loading) { // TODO(OSS Candidate ISS#2710739)
74+
if (bridge.loading) {
7575
[self showWithURL:bridge.bundleURL];
7676
}
7777
}
@@ -339,7 +339,7 @@ + (NSString *)moduleName
339339
+ (void)setEnabled:(BOOL)enabled
340340
{
341341
}
342-
- (void)showMessage:(NSString *)message color:(UIColor *)color backgroundColor:(UIColor *)backgroundColor
342+
- (void)showMessage:(NSString *)message color:(RCTUIColor *)color backgroundColor:(RCTUIColor *)backgroundColor // TODO(macOS GH#774) RCTUIColor
343343
{
344344
}
345345
- (void)showMessage:(NSString *)message withColor:(NSNumber *)color withBackgroundColor:(NSNumber *)backgroundColor

React/CoreModules/RCTDevMenu.mm

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,6 @@ - (void)setDefaultJSBundle
511511
#if TARGET_OS_OSX // [TODO(macOS GH#774)
512512
- (NSMenu *)menu
513513
{
514-
NSMenu *menu = nil;
515514
if ([_bridge.devSettings isSecondaryClickToShowDevMenuEnabled]) {
516515
NSMenu *menu = nil;
517516
if (_bridge) {

React/CoreModules/RCTDevSettings.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,6 @@
4141

4242
- (instancetype)initWithDataSource:(id<RCTDevSettingsDataSource>)dataSource;
4343

44-
// [TODO(OSS Candidate ISS#2710739)
45-
/**
46-
* Whether Dev Mode is enabled meaning the development tools
47-
* such as the debug executors, dev menu, red box, etc. are available.
48-
*/
49-
@property (nonatomic, assign, setter=setDevModeEnabled:) BOOL isDevModeEnabled;
50-
// ]TODO(OSS Candidate ISS#2710739)
51-
5244
@property (nonatomic, readonly) BOOL isHotLoadingAvailable;
5345
@property (nonatomic, readonly) BOOL isLiveReloadAvailable;
5446
@property (nonatomic, readonly) BOOL isRemoteDebuggingAvailable;

React/CoreModules/RCTDevSettings.mm

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -250,18 +250,6 @@ - (BOOL)isDeviceDebuggingAvailable
250250
#endif // RCT_ENABLE_INSPECTOR
251251
}
252252

253-
// [TODO(OSS Candidate ISS#2710739)
254-
RCT_EXPORT_METHOD(setDevModeEnabled:(BOOL)enabled)
255-
{
256-
[self _updateSettingWithValue:@(enabled) forKey:kRCTDevSettingDevModeEnabled];
257-
}
258-
259-
- (BOOL)isDevModeEnabled
260-
{
261-
return [[self settingForKey:kRCTDevSettingDevModeEnabled] boolValue];
262-
}
263-
// ]TODO(OSS Candidate ISS#2710739)
264-
265253
- (BOOL)isRemoteDebuggingAvailable
266254
{
267255
if (RCTTurboModuleEnabled()) {

React/CxxBridge/RCTCxxBridge.mm

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ - (void)start
470470
#if (RCT_DEV | RCT_ENABLE_LOADING_VIEW) && __has_include(<React/RCTDevLoadingViewProtocol.h>)
471471
// [TODO(OSS Candidate ISS#2710739)
472472
// Note: RCTDevLoadingView should have been loaded at this point, so no need to allow lazy loading.
473-
if ([weakSelf isValid] && [[weakSelf devSettings] isDevModeEnabled]) {
473+
if ([weakSelf isValid]) {
474474
id<RCTDevLoadingViewProtocol> loadingView = [weakSelf moduleForName:@"DevLoadingView"
475475
lazilyLoadIfNecessary:YES];
476476
[loadingView updateProgress:progressData];
@@ -673,9 +673,7 @@ - (void)_initializeBridge:(std::shared_ptr<JSExecutorFactory>)executorFactory
673673
// This can only be false if the bridge was invalidated before startup completed
674674
if (_reactInstance) {
675675
#if RCT_DEV
676-
if ([[self devSettings] isDevModeEnabled]) { // TODO(OSS Candidate ISS#2710739)
677-
executorFactory = std::make_shared<GetDescAdapter>(self, executorFactory);
678-
} // TODO(OSS Candidate ISS#2710739)
676+
executorFactory = std::make_shared<GetDescAdapter>(self, executorFactory);
679677
#endif
680678

681679
[self _initializeBridgeLocked:executorFactory];
@@ -1037,9 +1035,7 @@ - (void)executeSourceCode:(NSData *)sourceCode sync:(BOOL)sync
10371035
[self enqueueApplicationScript:sourceCode url:self.bundleURL onComplete:completion];
10381036
}
10391037

1040-
if (self.devSettings.isDevModeEnabled) { // TODO(OSS Candidate ISS#2710739)
1041-
[self.devSettings setupHMRClientWithBundleURL:self.bundleURL];
1042-
}
1038+
[self.devSettings setupHMRClientWithBundleURL:self.bundleURL];
10431039
}
10441040

10451041
#if RCT_DEV_MENU

0 commit comments

Comments
 (0)