Skip to content

Commit 22e9877

Browse files
committed
add universal links snippet for iOS
1 parent 682c776 commit 22e9877

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

examples/demo/ios/Example/AppDelegate.swift

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,28 @@ class AppDelegate: UIResponder, UIApplicationDelegate,
5656
return false
5757
}
5858

59+
func application(
60+
_ application: UIApplication,
61+
continue userActivity: NSUserActivity,
62+
restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void
63+
) -> Bool {
64+
65+
// Handle Universal-Link–style OAuth redirects first
66+
if userActivity.activityType == NSUserActivityTypeBrowsingWeb,
67+
let delegate = authorizationFlowManagerDelegate,
68+
delegate.resumeExternalUserAgentFlow(with: userActivity.webpageURL)
69+
{
70+
return true
71+
}
72+
73+
// Fall back to React Native’s own Linking logic
74+
return RCTLinkingManager.application(
75+
application,
76+
continue: userActivity,
77+
restorationHandler: restorationHandler
78+
)
79+
}
80+
5981
}
6082

6183
class ReactNativeDelegate: RCTDefaultReactNativeFactoryDelegate {

0 commit comments

Comments
 (0)