Cleanup RCTSourceCode
Reviewed By: mmmulani Differential Revision: D4124428 fbshipit-source-id: 0db5bfd5897c37c11374fe90516ac7aeb2ae5d53
This commit is contained in:
Родитель
4530da87e2
Коммит
bcac6e7d39
|
@ -55,8 +55,8 @@
|
|||
|
||||
- (NSURL *)sourceURLForBridge:(__unused RCTBridge *)bridge
|
||||
{
|
||||
NSURL *jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"Examples/UIExplorer/js/UIExplorerApp.ios" fallbackResource:nil];
|
||||
|
||||
NSURL *jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"Examples/UIExplorer/js/UIExplorerApp.ios"
|
||||
fallbackResource:nil];
|
||||
if (!getenv("CI_USE_PACKAGER")) {
|
||||
jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#import "RCTModuleData.h"
|
||||
#import "RCTPerformanceLogger.h"
|
||||
#import "RCTProfile.h"
|
||||
#import "RCTSourceCode.h"
|
||||
#import "RCTUtils.h"
|
||||
#import "RCTRedBox.h"
|
||||
#import "RCTDevLoadingView.h"
|
||||
|
@ -497,9 +496,6 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithDelegate:(id<RCTBridgeDelegate>)dele
|
|||
return;
|
||||
}
|
||||
|
||||
RCTSourceCode *sourceCodeModule = [self moduleForClass:[RCTSourceCode class]];
|
||||
sourceCodeModule.scriptURL = self.bundleURL;
|
||||
|
||||
[self enqueueApplicationScript:sourceCode url:self.bundleURL onComplete:^(NSError *loadError) {
|
||||
if (!self->_valid) {
|
||||
return;
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#import "RCTBridge.h"
|
||||
#import "RCTConvert.h"
|
||||
#import "RCTJSCWrapper.h"
|
||||
#import "RCTSourceCode.h"
|
||||
#import "RCTUtils.h"
|
||||
#import "RCTPerformanceLogger.h"
|
||||
#import "RCTMultipartDataTask.h"
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#import "RCTKeyCommands.h"
|
||||
#import "RCTLog.h"
|
||||
#import "RCTPerformanceLogger.h"
|
||||
#import "RCTSourceCode.h"
|
||||
#import "RCTTouchHandler.h"
|
||||
#import "RCTUIManager.h"
|
||||
#import "RCTUtils.h"
|
||||
|
|
|
@ -27,8 +27,6 @@
|
|||
#import "RCTPerformanceLogger.h"
|
||||
#import "RCTUtils.h"
|
||||
#import "RCTJSCProfiler.h"
|
||||
#import "RCTRedBox.h"
|
||||
#import "RCTSourceCode.h"
|
||||
#import "RCTJSCWrapper.h"
|
||||
#import "RCTJSCErrorHandling.h"
|
||||
#import "JSCSamplingProfiler.h"
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#import "RCTLog.h"
|
||||
#import "RCTProfile.h"
|
||||
#import "RCTRootView.h"
|
||||
#import "RCTSourceCode.h"
|
||||
#import "RCTUtils.h"
|
||||
#import "RCTWebSocketProxy.h"
|
||||
|
||||
|
@ -376,17 +375,12 @@ RCT_EXPORT_MODULE()
|
|||
_jsLoaded = YES;
|
||||
|
||||
// Check if live reloading is available
|
||||
_liveReloadURL = nil;
|
||||
RCTSourceCode *sourceCodeModule = [_bridge moduleForClass:[RCTSourceCode class]];
|
||||
if (!sourceCodeModule.scriptURL) {
|
||||
if (!sourceCodeModule) {
|
||||
RCTLogWarn(@"RCTSourceCode module not found");
|
||||
} else if (!RCTRunningInTestEnvironment()) {
|
||||
RCTLogWarn(@"RCTSourceCode module scriptURL has not been set");
|
||||
}
|
||||
} else if (!sourceCodeModule.scriptURL.fileURL) {
|
||||
NSURL *scriptURL = _bridge.bundleURL;
|
||||
if (![scriptURL isFileURL]) {
|
||||
// Live reloading is disabled when running from bundled JS file
|
||||
_liveReloadURL = [[NSURL alloc] initWithString:@"/onchange" relativeToURL:sourceCodeModule.scriptURL];
|
||||
_liveReloadURL = [[NSURL alloc] initWithString:@"/onchange" relativeToURL:scriptURL];
|
||||
} else {
|
||||
_liveReloadURL = nil;
|
||||
}
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
|
|
|
@ -13,6 +13,4 @@
|
|||
|
||||
@interface RCTSourceCode : NSObject <RCTBridgeModule>
|
||||
|
||||
@property (nonatomic, copy) NSURL *scriptURL;
|
||||
|
||||
@end
|
||||
|
|
|
@ -9,10 +9,7 @@
|
|||
|
||||
#import "RCTSourceCode.h"
|
||||
|
||||
#import "RCTDefines.h"
|
||||
#import "RCTAssert.h"
|
||||
#import "RCTBridge.h"
|
||||
#import "RCTUtils.h"
|
||||
|
||||
@implementation RCTSourceCode
|
||||
|
||||
|
@ -22,8 +19,9 @@ RCT_EXPORT_MODULE()
|
|||
|
||||
- (NSDictionary<NSString *, id> *)constantsToExport
|
||||
{
|
||||
NSString *URL = self.bridge.bundleURL.absoluteString ?: @"";
|
||||
return @{@"scriptURL": URL};
|
||||
return @{
|
||||
@"scriptURL": self.bridge.bundleURL.absoluteString ?: @""
|
||||
};
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Загрузка…
Ссылка в новой задаче