remove fallbackResource from RCTBundleURLProvider api

Summary:
if you xgbs for `fallbackResource:`, you'll find only one place is actually passing a non-nil value to this parameter.

https://www.internalfb.com/code/fbsource/fbobjc/Apps/Wilde/FBReactModule2/FBReactModuleAPI/FBReactModuleAPI/FBReactSourceLoaderProd.mm?lines=79

but if we look at the implementation, `@"main"` is the fallback value...

https://www.internalfb.com/code/fbsource/[cd930f5f15cca0feb732317147de318ce6aa1db3]/xplat/js/react-native-github/React/Base/RCTBundleURLProvider.mm?lines=224

let's just simplify this api and get rid of this parameter.

Changelog: [Internal]

Reviewed By: raedle

Differential Revision: D32641476

fbshipit-source-id: 637a8c0f7bea834bfecd804a521155f41aaaff7e
This commit is contained in:
Phillip Pan
2021-12-16 00:46:14 -08:00
committed by Facebook GitHub Bot
parent 7dfb08a785
commit 0912ee179c
5 changed files with 18 additions and 27 deletions
+1 -2
View File
@@ -121,8 +121,7 @@
- (NSURL *)sourceURLForBridge:(__unused RCTBridge *)bridge
{
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"packages/rn-tester/js/RNTesterApp.ios"
fallbackResource:nil];
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"packages/rn-tester/js/RNTesterApp.ios"];
}
- (void)initializeFlipper:(UIApplication *)application
@@ -98,7 +98,7 @@ static NSURL *ipBundleURL()
{
RCTBundleURLProvider *settings = [RCTBundleURLProvider sharedSettings];
settings.jsLocation = nil;
NSURL *URL = [settings jsBundleURLForBundleRoot:testFile fallbackResource:nil];
NSURL *URL = [settings jsBundleURLForBundleRoot:testFile];
if (!getenv("CI_USE_PACKAGER")) {
XCTAssertEqualObjects(URL, mainBundleURL());
} else {
@@ -112,7 +112,7 @@ static NSURL *ipBundleURL()
[[[classMock stub] andReturnValue:@YES] isPackagerRunning:[OCMArg any] scheme:[OCMArg any]];
RCTBundleURLProvider *settings = [RCTBundleURLProvider sharedSettings];
settings.jsLocation = @"localhost";
NSURL *URL = [settings jsBundleURLForBundleRoot:testFile fallbackResource:nil];
NSURL *URL = [settings jsBundleURLForBundleRoot:testFile];
XCTAssertEqualObjects(URL, localhostBundleURL());
}
@@ -122,7 +122,7 @@ static NSURL *ipBundleURL()
[[[classMock stub] andReturnValue:@YES] isPackagerRunning:[OCMArg any] scheme:[OCMArg any]];
RCTBundleURLProvider *settings = [RCTBundleURLProvider sharedSettings];
settings.jsLocation = @"192.168.1.1";
NSURL *URL = [settings jsBundleURLForBundleRoot:testFile fallbackResource:nil];
NSURL *URL = [settings jsBundleURLForBundleRoot:testFile];
XCTAssertEqualObjects(URL, ipBundleURL());
}