mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
bundledSourceURLForBridge always return bundle path
Differential Revision: D6215467 fbshipit-source-id: 49d818cfdb776dd849a809440a1e592e5cb2231a
This commit is contained in:
committed by
Facebook Github Bot
parent
a75fef48bf
commit
90a00a66e2
@@ -43,8 +43,6 @@
|
||||
/**
|
||||
* The location of bundle path, this should be a `file://` url
|
||||
* pointing to a path inside the bundle resources, e.g. `file://..//main.jsbundle`.
|
||||
* When running from the packager this should be an absolute URL,
|
||||
* e.g. `http://localhost:8081/index.ios.bundle`.
|
||||
*/
|
||||
- (NSURL *)bundledSourceURLForBridge:(RCTBridge *)bridge;
|
||||
|
||||
|
||||
@@ -42,6 +42,14 @@ extern const NSUInteger kRCTBundleURLProviderDefaultPort;
|
||||
- (NSURL *)jsBundleURLForBundleRoot:(NSString *)bundleRoot
|
||||
fallbackResource:(NSString *)resourceName;
|
||||
|
||||
/**
|
||||
* Returns the jsBundleURL for a given bundle entrypoint and
|
||||
* the fallback offline JS bundle. If resourceName or extension
|
||||
* are nil, "main" and "jsbundle" will be used, respectively.
|
||||
*/
|
||||
- (NSURL *)jsBundleURLForFallbackResource:(NSString *)resourceName
|
||||
fallbackExtension:(NSString *)extension;
|
||||
|
||||
/**
|
||||
* Returns the resourceURL for a given bundle entrypoint and
|
||||
* the fallback offline resource file if the packager is not running.
|
||||
|
||||
@@ -121,9 +121,7 @@ static NSURL *serverRootWithHost(NSString *host)
|
||||
{
|
||||
NSString *packagerServerHost = [self packagerServerHost];
|
||||
if (!packagerServerHost) {
|
||||
resourceName = resourceName ?: @"main";
|
||||
extension = extension ?: @"jsbundle";
|
||||
return [[NSBundle mainBundle] URLForResource:resourceName withExtension:extension];
|
||||
return [self jsBundleURLForFallbackResource:resourceName fallbackExtension:extension];
|
||||
} else {
|
||||
return [RCTBundleURLProvider jsBundleURLForBundleRoot:bundleRoot
|
||||
packagerHost:packagerServerHost
|
||||
@@ -137,6 +135,14 @@ static NSURL *serverRootWithHost(NSString *host)
|
||||
return [self jsBundleURLForBundleRoot:bundleRoot fallbackResource:resourceName fallbackExtension:nil];
|
||||
}
|
||||
|
||||
- (NSURL *)jsBundleURLForFallbackResource:(NSString *)resourceName
|
||||
fallbackExtension:(NSString *)extension
|
||||
{
|
||||
resourceName = resourceName ?: @"main";
|
||||
extension = extension ?: @"jsbundle";
|
||||
return [[NSBundle mainBundle] URLForResource:resourceName withExtension:extension];
|
||||
}
|
||||
|
||||
- (NSURL *)resourceURLForResourceRoot:(NSString *)root
|
||||
resourceName:(NSString *)name
|
||||
resourceExtension:(NSString *)extension
|
||||
|
||||
Reference in New Issue
Block a user