From 6b2a93909b4d5d523f996d6fbc7e619f782e328c Mon Sep 17 00:00:00 2001 From: Lyubo Marinov Date: Mon, 31 Jul 2017 19:43:27 -0500 Subject: [PATCH] [iOS] Use loadURL in the app --- ios/sdk/src/JitsiMeetView.m | 38 +++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/ios/sdk/src/JitsiMeetView.m b/ios/sdk/src/JitsiMeetView.m index ca1f74507..2d0edb2b6 100644 --- a/ios/sdk/src/JitsiMeetView.m +++ b/ios/sdk/src/JitsiMeetView.m @@ -139,6 +139,17 @@ static NSMapTable *views; continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *restorableObjects))restorationHandler { + // XXX At least twice we received bug reports about malfunctioning loadURL + // in the Jitsi Meet SDK while the Jitsi Meet app seemed to functioning as + // expected in our testing. But that was to be expected because the app does + // not exercise loadURL. In order to increase the test coverage of loadURL, + // channel Universal linking through loadURL. + if ([userActivity.activityType + isEqualToString:NSUserActivityTypeBrowsingWeb] + && [JitsiMeetView loadURLInViews:userActivity.webpageURL]) { + return YES; + } + return [RCTLinkingManager application:application continueUserActivity:userActivity restorationHandler:restorationHandler]; @@ -148,6 +159,15 @@ static NSMapTable *views; openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { + // XXX At least twice we received bug reports about malfunctioning loadURL + // in the Jitsi Meet SDK while the Jitsi Meet app seemed to functioning as + // expected in our testing. But that was to be expected because the app does + // not exercise loadURL. In order to increase the test coverage of loadURL, + // channel Universal linking through loadURL. + if ([JitsiMeetView loadURLInViews:url]) { + return YES; + } + return [RCTLinkingManager application:application openURL:url sourceApplication:sourceApplication @@ -249,6 +269,24 @@ static NSMapTable *views; #pragma mark Private methods ++ (BOOL)loadURLInViews:(NSURL *)url { + BOOL handled = NO; + + if (views) { + for (NSString *externalAPIScope in views) { + JitsiMeetView *view + = [JitsiMeetView viewForExternalAPIScope:externalAPIScope]; + + if (view) { + [view loadURL:url]; + handled = YES; + } + } + } + + return handled; +} + + (instancetype)viewForExternalAPIScope:(NSString *)externalAPIScope { return [views objectForKey:externalAPIScope]; }