Skip to content

Commit 34795cb

Browse files
Delete dead sourceURLForBridge delegate chain (#59452)
Summary: `sourceURLForBridge:` has no callers: the factory reads `bundleURL` directly, and the default delegate's implementations only threw or forwarded to each other. Delete the protocol method with those implementations and the factory's dead configuration assignment. The `RCTJavaScriptLoader.h` import stays: removing it breaks every `RCTBridge.h` importer that uses the loader types. Changelog: [iOS][Removed] - Remove deprecated `RCTBridgeDelegate` `sourceURLForBridge:` Reviewed By: javache Differential Revision: D127294778 Pull Request resolved: #59452
1 parent f754dbd commit 34795cb

8 files changed

Lines changed: 1 addition & 38 deletions

File tree

‎packages/react-native/Libraries/AppDelegate/RCTDefaultReactNativeFactoryDelegate.mm‎

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,6 @@ @implementation RCTDefaultReactNativeFactoryDelegate {
2626

2727
@synthesize dependencyProvider;
2828

29-
- (NSURL *_Nullable)sourceURLForBridge:(nonnull RCTBridge *)bridge
30-
{
31-
[NSException raise:@"RCTBridgeDelegate::sourceURLForBridge not implemented"
32-
format:@"Subclasses must implement a valid sourceURLForBridge method"];
33-
return nil;
34-
}
35-
3629
- (UIViewController *)createRootViewController
3730
{
3831
return [UIViewController new];
@@ -126,11 +119,4 @@ - (Class)getModuleClassFromName:(const char *)name
126119
return nullptr;
127120
}
128121

129-
- (void)loadSourceForBridge:(RCTBridge *)bridge
130-
onProgress:(RCTSourceLoadProgressBlock)onProgress
131-
onComplete:(RCTSourceLoadBlock)loadCallback
132-
{
133-
[RCTJavaScriptLoader loadBundleAtURL:[self sourceURLForBridge:bridge] onProgress:onProgress onComplete:loadCallback];
134-
}
135-
136122
@end

‎packages/react-native/Libraries/AppDelegate/RCTReactNativeFactory.mm‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -295,11 +295,6 @@ - (RCTRootViewFactory *)createRCTRootViewFactory
295295
[weakSelf.delegate customizeRootView:(RCTRootView *)rootView];
296296
};
297297

298-
configuration.sourceURLForBridge = ^NSURL *_Nullable(RCTBridge *_Nonnull bridge)
299-
{
300-
return [weakSelf.delegate bundleURL];
301-
};
302-
303298
if ([self.delegate respondsToSelector:@selector(extraModulesForBridge:)]) {
304299
configuration.extraModulesForBridge = ^NSArray<id<RCTBridgeModule>> *_Nonnull(RCTBridge *_Nonnull bridge)
305300
{

‎packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77

88
#import <React/RCTBridge.h>
9+
#import <React/RCTJavaScriptLoader.h>
910
#import <React/RCTRootView.h>
1011
#import <React/RCTUtils.h>
1112
#import "RCTJSRuntimeConfiguratorProtocol.h"

‎packages/react-native/React/Base/RCTBridgeDelegate.h‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,6 @@
1313
NS_ASSUME_NONNULL_BEGIN
1414

1515
@protocol RCTBridgeDelegate <NSObject>
16-
#ifndef RCT_REMOVE_LEGACY_ARCH
17-
18-
/**
19-
* The location of the JavaScript source file. When running from the packager
20-
* this should be an absolute URL, e.g. `http://localhost:8081/index.ios.bundle`.
21-
* When running from a locally bundled JS file, this should be a `file://` url
22-
* pointing to a path inside the app resources, e.g. `file://.../main.jsbundle`.
23-
*/
24-
- (NSURL *__nullable)sourceURLForBridge:(RCTBridge *)bridge
25-
__deprecated_msg("This API will be removed along with the legacy architecture.");
26-
#endif
2716
@end
2817

2918
NS_ASSUME_NONNULL_END

‎packages/rn-tester/RNTester/SceneDelegate.mm‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,6 @@ - (void)scene:(UIScene *)scene continueUserActivity:(NSUserActivity *)userActivi
8989
[RCTLinkingManager scene:scene continueUserActivity:userActivity];
9090
}
9191

92-
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
93-
{
94-
return [self bundleURL];
95-
}
96-
9792
- (NSURL *)bundleURL
9893
{
9994
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:kBundlePath];

‎scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2525,7 +2525,6 @@ protocol RCTBackedTextInputViewProtocol : public UITextInput {
25252525
}
25262526

25272527
protocol RCTBridgeDelegate : public NSObject {
2528-
public virtual NSURL* _Nullable sourceURLForBridge:(RCTBridge* bridge);
25292528
}
25302529

25312530
protocol RCTBridgeMethod : public NSObject {

‎scripts/cxx-api/api-snapshots/ReactAppleFrameworksCxx.api‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2583,7 +2583,6 @@ protocol RCTBackedTextInputViewProtocol : public UITextInput {
25832583
}
25842584

25852585
protocol RCTBridgeDelegate : public NSObject {
2586-
public virtual NSURL* _Nullable sourceURLForBridge:(RCTBridge* bridge);
25872586
}
25882587

25892588
protocol RCTBridgeMethod : public NSObject {

‎scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2525,7 +2525,6 @@ protocol RCTBackedTextInputViewProtocol : public UITextInput {
25252525
}
25262526

25272527
protocol RCTBridgeDelegate : public NSObject {
2528-
public virtual NSURL* _Nullable sourceURLForBridge:(RCTBridge* bridge);
25292528
}
25302529

25312530
protocol RCTBridgeMethod : public NSObject {

0 commit comments

Comments
 (0)