Bläddra i källkod

[iOS] Use loadURL in the app

master
Lyubo Marinov 7 år sedan
förälder
incheckning
6b2a93909b
1 ändrade filer med 38 tillägg och 0 borttagningar
  1. 38
    0
      ios/sdk/src/JitsiMeetView.m

+ 38
- 0
ios/sdk/src/JitsiMeetView.m Visa fil

@@ -139,6 +139,17 @@ static NSMapTable<NSString *, JitsiMeetView *> *views;
139 139
   continueUserActivity:(NSUserActivity *)userActivity
140 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 153
     return [RCTLinkingManager application:application
143 154
                      continueUserActivity:userActivity
144 155
                        restorationHandler:restorationHandler];
@@ -148,6 +159,15 @@ static NSMapTable<NSString *, JitsiMeetView *> *views;
148 159
             openURL:(NSURL *)url
149 160
   sourceApplication:(NSString *)sourceApplication
150 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 171
     return [RCTLinkingManager application:application
152 172
                                   openURL:url
153 173
                         sourceApplication:sourceApplication
@@ -249,6 +269,24 @@ static NSMapTable<NSString *, JitsiMeetView *> *views;
249 269
 
250 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 290
 + (instancetype)viewForExternalAPIScope:(NSString *)externalAPIScope {
253 291
     return [views objectForKey:externalAPIScope];
254 292
 }

Laddar…
Avbryt
Spara