@@ -81,6 +81,52 @@ + (BOOL)application:(UIApplication *)application
81
81
return YES ;
82
82
}
83
83
84
+ // iOS 13+ - Corresponding apis for SceneDelegate
85
+
86
+ // Both Deep Links and Universal Links - called when the app was previously NOT running
87
+ + (BOOL )scene : (UIScene *)scene
88
+ willConnectTo : (UISceneSession *)session
89
+ options : (UISceneConnectionOptions *) connectionOptions
90
+ {
91
+
92
+ // Deep Links
93
+ for (UIOpenURLContext *urlContext in connectionOptions.URLContexts ) {
94
+ if (urlContext) {
95
+ postNotificationWithURL (urlContext.URL , self);
96
+ }
97
+ }
98
+
99
+ // Universal Links
100
+ for (NSUserActivity *userActivity in connectionOptions.userActivities ) {
101
+ if ([userActivity.activityType isEqualToString: NSUserActivityTypeBrowsingWeb ]) {
102
+ postNotificationWithURL (userActivity.webpageURL , self);
103
+ }
104
+ }
105
+
106
+ return YES ;
107
+ }
108
+
109
+ // Deep Links - called when the app was previously running or suspended
110
+ + (BOOL )scene : (UIScene *)scene
111
+ openURLContexts : (NSSet <UIOpenURLContext *> *)URLContexts
112
+ {
113
+ for (UIOpenURLContext *urlContext in URLContexts) {
114
+ if (urlContext) {
115
+ postNotificationWithURL (urlContext.URL , self);
116
+ }
117
+ }
118
+
119
+ return YES ;
120
+ }
121
+
122
+ // Universal Links - called when the app was previously running or suspended
123
+ // Called from SwiftUI's onOpenURL(perform:)
124
+ + (BOOL )onOpenURL : (NSURL *)url
125
+ {
126
+ postNotificationWithURL (url, self);
127
+ return YES ;
128
+ }
129
+
84
130
- (void )handleOpenURLNotification : (NSNotification *)notification
85
131
{
86
132
[self sendEventWithName: @" url" body: notification.userInfo];
0 commit comments