Skip to content

Commit 2cf9909

Browse files
committed
Adds UIApplicationLaunchOptionsURLKey to fetch the deeplink url when is killed state
1 parent 9623a0c commit 2cf9909

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

example/ios/IntercomReactNativeExample/AppDelegate.m

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,18 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
4646
#ifdef FB_SONARKIT_ENABLED
4747
InitializeFlipper(application);
4848
#endif
49-
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
49+
50+
NSMutableDictionary *newLaunchOptions = [NSMutableDictionary dictionaryWithDictionary:launchOptions];
51+
if (launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey]) {
52+
NSDictionary *remoteNotif = launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey];
53+
if (remoteNotif[@"uri"]) {
54+
NSString *initialURL = remoteNotif[@"uri"];
55+
if (!launchOptions[UIApplicationLaunchOptionsURLKey]) {
56+
newLaunchOptions[UIApplicationLaunchOptionsURLKey] = [NSURL URLWithString:initialURL];
57+
}
58+
}
59+
}
60+
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:newLaunchOptions];
5061
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
5162
moduleName:@"IntercomReactNativeExample"
5263
initialProperties:nil];

0 commit comments

Comments
 (0)