Skip to content

Commit f5d2699

Browse files
Read launchOptions from injection in RCTLinkingManager (#59259)
Summary: Synthesize the injected launchOptions property and read getInitialURL state from it instead of self.bridge. Drops the last bridge read in this module along with its direct bridge header import. Changelog: [Internal] Reviewed By: shwanton Differential Revision: D126567470
1 parent 9d7447a commit f5d2699

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

‎packages/react-native/Libraries/LinkingIOS/RCTLinkingManager.mm‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#import <React/RCTLinkingManager.h>
99

1010
#import <FBReactNativeSpec/FBReactNativeSpec.h>
11-
#import <React/RCTBridge.h>
1211
#import <React/RCTConvert.h>
1312
#import <React/RCTLog.h>
1413
#import <React/RCTUtils.h>
@@ -36,6 +35,8 @@ @implementation RCTLinkingManager
3635

3736
RCT_EXPORT_MODULE()
3837

38+
@synthesize launchOptions = _launchOptions;
39+
3940
+ (void)postNotificationWithURL:(NSURL *)URL
4041
{
4142
NSDictionary<NSString *, id> *payload = @{@"url" : URL.absoluteString};
@@ -207,11 +208,10 @@ - (void)canOpenURL:(NSString *)urlString
207208
- (void)getInitialURL:(RCTPromiseResolveBlock)resolve reject:(__unused RCTPromiseRejectBlock)reject
208209
{
209210
NSURL *initialURL = nil;
210-
if (self.bridge.launchOptions[UIApplicationLaunchOptionsURLKey] != nullptr) {
211-
initialURL = self.bridge.launchOptions[UIApplicationLaunchOptionsURLKey];
211+
if (self.launchOptions[UIApplicationLaunchOptionsURLKey] != nullptr) {
212+
initialURL = self.launchOptions[UIApplicationLaunchOptionsURLKey];
212213
} else {
213-
NSDictionary *userActivityDictionary =
214-
self.bridge.launchOptions[UIApplicationLaunchOptionsUserActivityDictionaryKey];
214+
NSDictionary *userActivityDictionary = self.launchOptions[UIApplicationLaunchOptionsUserActivityDictionaryKey];
215215
if ([userActivityDictionary[UIApplicationLaunchOptionsUserActivityTypeKey] isEqual:NSUserActivityTypeBrowsingWeb]) {
216216
initialURL = ((NSUserActivity *)userActivityDictionary[@"UIApplicationLaunchOptionsUserActivityKey"]).webpageURL;
217217
}

0 commit comments

Comments
 (0)