Make RCTDevSettings conform to RCTBundleHolderModule

Summary:
Changelog: [Internal]

This diff allows `RCTDevSettings` to access bundleURL directly instead of relying on the bridge.

Reviewed By: RSNara

Differential Revision: D26289592

fbshipit-source-id: e22e583e51323bfe66f6e424d9f47edf71b1ed9f
This commit is contained in:
Peter Argany authored and Facebook GitHub Bot committed 2021-02-19 13:47:26 -08:00
1 parent dd1ac9de24
commit 2548d424ce
1 file changed
+11 -4
+11 -4
View File
@@ -12,14 +12,14 @@
#import <FBReactNativeSpec/FBReactNativeSpec.h>
#import <React/RCTBridge+Private.h>
#import <React/RCTBridgeModule.h>
#import <React/RCTBundleHolderModule.h>
#import <React/RCTDevMenu.h>
#import <React/RCTEventDispatcherProtocol.h>
#import <React/RCTLog.h>
#import <React/RCTProfile.h>
#import <React/RCTReloadCommand.h>
#import <React/RCTUtils.h>
#import <React/RCTDevMenu.h>
#import "CoreModulesPlugins.h"
static NSString *const kRCTDevSettingProfilingEnabled = @"profilingEnabled";
@@ -114,7 +114,7 @@ void RCTDevSettingsSetEnabled(BOOL enabled)
@end
@interface RCTDevSettings () <RCTBridgeModule, RCTInvalidating, NativeDevSettingsSpec> {
@interface RCTDevSettings () <RCTBridgeModule, RCTInvalidating, NativeDevSettingsSpec, RCTBundleHolderModule> {
BOOL _isJSLoaded;
#if ENABLE_PACKAGER_CONNECTION
RCTHandlerToken _reloadToken;
@@ -128,6 +128,8 @@ void RCTDevSettingsSetEnabled(BOOL enabled)
@implementation RCTDevSettings
@synthesize bundleURL = _bundleURL;
RCT_EXPORT_MODULE()
- (instancetype)init
@@ -243,7 +245,12 @@ RCT_EXPORT_MODULE()
- (BOOL)isHotLoadingAvailable
{
return self.bridge.bundleURL && !self.bridge.bundleURL.fileURL; // Only works when running from server
if (self.bridge.bundleURL) {
return !self.bridge.bundleURL.fileURL; // Only works when running from server
} else if (self.bundleURL) {
return !self.bundleURL.fileURL;
}
return NO;
}
RCT_EXPORT_METHOD(reload)