瀏覽代碼

[iOS] Use loadURL in the app

j8
Lyubo Marinov 8 年之前
父節點
當前提交
6b2a93909b
共有 1 個文件被更改,包括 38 次插入0 次删除
  1. 38
    0
      ios/sdk/src/JitsiMeetView.m

+ 38
- 0
ios/sdk/src/JitsiMeetView.m 查看文件

139
   continueUserActivity:(NSUserActivity *)userActivity
139
   continueUserActivity:(NSUserActivity *)userActivity
140
     restorationHandler:(void (^)(NSArray *restorableObjects))restorationHandler
140
     restorationHandler:(void (^)(NSArray *restorableObjects))restorationHandler
141
 {
141
 {
142
+    // XXX At least twice we received bug reports about malfunctioning loadURL
143
+    // in the Jitsi Meet SDK while the Jitsi Meet app seemed to functioning as
144
+    // expected in our testing. But that was to be expected because the app does
145
+    // not exercise loadURL. In order to increase the test coverage of loadURL,
146
+    // channel Universal linking through loadURL.
147
+    if ([userActivity.activityType
148
+                isEqualToString:NSUserActivityTypeBrowsingWeb]
149
+            && [JitsiMeetView loadURLInViews:userActivity.webpageURL]) {
150
+        return YES;
151
+    }
152
+
142
     return [RCTLinkingManager application:application
153
     return [RCTLinkingManager application:application
143
                      continueUserActivity:userActivity
154
                      continueUserActivity:userActivity
144
                        restorationHandler:restorationHandler];
155
                        restorationHandler:restorationHandler];
148
             openURL:(NSURL *)url
159
             openURL:(NSURL *)url
149
   sourceApplication:(NSString *)sourceApplication
160
   sourceApplication:(NSString *)sourceApplication
150
          annotation:(id)annotation {
161
          annotation:(id)annotation {
162
+    // XXX At least twice we received bug reports about malfunctioning loadURL
163
+    // in the Jitsi Meet SDK while the Jitsi Meet app seemed to functioning as
164
+    // expected in our testing. But that was to be expected because the app does
165
+    // not exercise loadURL. In order to increase the test coverage of loadURL,
166
+    // channel Universal linking through loadURL.
167
+    if ([JitsiMeetView loadURLInViews:url]) {
168
+        return YES;
169
+    }
170
+
151
     return [RCTLinkingManager application:application
171
     return [RCTLinkingManager application:application
152
                                   openURL:url
172
                                   openURL:url
153
                         sourceApplication:sourceApplication
173
                         sourceApplication:sourceApplication
249
 
269
 
250
 #pragma mark Private methods
270
 #pragma mark Private methods
251
 
271
 
272
++ (BOOL)loadURLInViews:(NSURL *)url {
273
+    BOOL handled = NO;
274
+
275
+    if (views) {
276
+        for (NSString *externalAPIScope in views) {
277
+            JitsiMeetView *view
278
+                = [JitsiMeetView viewForExternalAPIScope:externalAPIScope];
279
+
280
+            if (view) {
281
+                [view loadURL:url];
282
+                handled = YES;
283
+            }
284
+        }
285
+    }
286
+
287
+    return handled;
288
+}
289
+
252
 + (instancetype)viewForExternalAPIScope:(NSString *)externalAPIScope {
290
 + (instancetype)viewForExternalAPIScope:(NSString *)externalAPIScope {
253
     return [views objectForKey:externalAPIScope];
291
     return [views objectForKey:externalAPIScope];
254
 }
292
 }

Loading…
取消
儲存