[iOS] Use loadURL in the app

This commit is contained in:
Lyubo Marinov 2017-07-31 19:43:27 -05:00
parent c259551d9a
commit 6b2a93909b
1 changed files with 38 additions and 0 deletions

View File

@ -139,6 +139,17 @@ static NSMapTable<NSString *, JitsiMeetView *> *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<NSString *, JitsiMeetView *> *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<NSString *, JitsiMeetView *> *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];
}