Skip to content

Commit d22aab1

Browse files
committed
Disable dev mode on ship builds (microsoft#888)
* revert dev mode on ship builds * rctuicolor * remove unused variable * pod install
1 parent f8e3166 commit d22aab1

File tree

8 files changed

+13
-43
lines changed

8 files changed

+13
-43
lines changed

Libraries/Image/RCTImageLoader.mm

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

950950
#if !TARGET_OS_OSX && RCT_DEV // TODO(macOS GH#774)
951-
if ([[self->_bridge devSettings] isDevModeEnabled]) { // TODO(OSS Candidate ISS#2710739)
952-
CGSize imagePixelSize = RCTSizeInPixels(image.size, UIImageGetScale(image)); // TODO(macOS GH#774)
953-
CGSize screenPixelSize = RCTSizeInPixels(RCTScreenSize(), RCTScreenScale());
954-
if (imagePixelSize.width * imagePixelSize.height >
955-
screenPixelSize.width * screenPixelSize.height) {
956-
RCTLogInfo(@"[PERF ASSETS] Loading image at size %@, which is larger "
957-
"than the screen size %@", NSStringFromCGSize(imagePixelSize),
958-
NSStringFromCGSize(screenPixelSize));
959-
}
951+
CGSize imagePixelSize = RCTSizeInPixels(image.size, UIImageGetScale(image)); // TODO(macOS GH#774)
952+
CGSize screenPixelSize = RCTSizeInPixels(RCTScreenSize(), RCTScreenScale());
953+
if (imagePixelSize.width * imagePixelSize.height >
954+
screenPixelSize.width * screenPixelSize.height) {
955+
RCTLogInfo(@"[PERF ASSETS] Loading image at size %@, which is larger "
956+
"than the screen size %@", NSStringFromCGSize(imagePixelSize),
957+
NSStringFromCGSize(screenPixelSize));
960958
}
961959
#endif
962960

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
@@ -475,9 +475,7 @@ - (NSMenu *)menuForEvent:(NSEvent *)event
475475
{
476476
NSMenu *menu = nil;
477477
#if __has_include("RCTDevMenu.h") && RCT_DEV
478-
if ([[_bridge devSettings] isDevModeEnabled]) {
479-
menu = [[_bridge devMenu] menu];
480-
}
478+
menu = [[_bridge devMenu] menu];
481479
#endif
482480
if (menu == nil) {
483481
menu = [super menuForEvent:event];

React/CoreModules/RCTDevLoadingView.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ + (NSString *)moduleName
334334
+ (void)setEnabled:(BOOL)enabled
335335
{
336336
}
337-
- (void)showMessage:(NSString *)message color:(UIColor *)color backgroundColor:(UIColor *)backgroundColor
337+
- (void)showMessage:(NSString *)message color:(RCTUIColor *)color backgroundColor:(RCTUIColor *)backgroundColor // TODO(macOS GH#774) RCTUIColor
338338
{
339339
}
340340
- (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
@@ -474,7 +474,6 @@ - (void)setDefaultJSBundle
474474
#if TARGET_OS_OSX // [TODO(macOS GH#774)
475475
- (NSMenu *)menu
476476
{
477-
NSMenu *menu = nil;
478477
if ([_bridge.devSettings isSecondaryClickToShowDevMenuEnabled]) {
479478
NSMenu *menu = nil;
480479
if (_bridge) {

React/CoreModules/RCTDevSettings.h

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

5353
- (instancetype)initWithDataSource:(id<RCTDevSettingsDataSource>)dataSource;
5454

55-
// [TODO(OSS Candidate ISS#2710739)
56-
/**
57-
* Whether Dev Mode is enabled meaning the development tools
58-
* such as the debug executors, dev menu, red box, etc. are available.
59-
*/
60-
@property (nonatomic, assign, setter=setDevModeEnabled:) BOOL isDevModeEnabled;
61-
// ]TODO(OSS Candidate ISS#2710739)
62-
6355
@property (nonatomic, readonly) BOOL isHotLoadingAvailable;
6456
@property (nonatomic, readonly) BOOL isRemoteDebuggingAvailable;
6557
@property (nonatomic, readonly) BOOL isDeviceDebuggingAvailable;

React/CoreModules/RCTDevSettings.mm

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -284,18 +284,6 @@ - (BOOL)isDeviceDebuggingAvailable
284284
#endif // RCT_ENABLE_INSPECTOR
285285
}
286286

287-
// [TODO(OSS Candidate ISS#2710739)
288-
RCT_EXPORT_METHOD(setDevModeEnabled:(BOOL)enabled)
289-
{
290-
[self _updateSettingWithValue:@(enabled) forKey:kRCTDevSettingDevModeEnabled];
291-
}
292-
293-
- (BOOL)isDevModeEnabled
294-
{
295-
return [[self settingForKey:kRCTDevSettingDevModeEnabled] boolValue];
296-
}
297-
// ]TODO(OSS Candidate ISS#2710739)
298-
299287
- (BOOL)isRemoteDebuggingAvailable
300288
{
301289
if (RCTTurboModuleEnabled()) {

React/CxxBridge/RCTCxxBridge.mm

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ - (void)start
537537
#if (RCT_DEV | RCT_ENABLE_LOADING_VIEW) && __has_include(<React/RCTDevLoadingViewProtocol.h>)
538538
// [TODO(OSS Candidate ISS#2710739)
539539
// Note: RCTDevLoadingView should have been loaded at this point, so no need to allow lazy loading.
540-
if ([weakSelf isValid] && [[weakSelf devSettings] isDevModeEnabled]) {
540+
if ([weakSelf isValid]) {
541541
id<RCTDevLoadingViewProtocol> loadingView = [weakSelf moduleForName:@"DevLoadingView"
542542
lazilyLoadIfNecessary:YES];
543543
[loadingView updateProgress:progressData];
@@ -740,9 +740,7 @@ - (void)_initializeBridge:(std::shared_ptr<JSExecutorFactory>)executorFactory
740740
// This can only be false if the bridge was invalidated before startup completed
741741
if (_reactInstance) {
742742
#if RCT_DEV
743-
if ([[self devSettings] isDevModeEnabled]) { // TODO(OSS Candidate ISS#2710739)
744-
executorFactory = std::make_shared<GetDescAdapter>(self, executorFactory);
745-
} // TODO(OSS Candidate ISS#2710739)
743+
executorFactory = std::make_shared<GetDescAdapter>(self, executorFactory);
746744
#endif
747745

748746
[self _initializeBridgeLocked:executorFactory];
@@ -1128,9 +1126,7 @@ - (void)executeSourceCode:(NSData *)sourceCode sync:(BOOL)sync
11281126
[self enqueueApplicationScript:sourceCode url:self.bundleURL onComplete:completion];
11291127
}
11301128

1131-
if (self.devSettings.isDevModeEnabled) { // TODO(OSS Candidate ISS#2710739)
1132-
[self.devSettings setupHMRClientWithBundleURL:self.bundleURL];
1133-
}
1129+
[self.devSettings setupHMRClientWithBundleURL:self.bundleURL];
11341130
}
11351131

11361132
#if RCT_DEV_MENU

0 commit comments

Comments
 (0)