ios: add ability to control deep / universal linking
Since the SDK may be embedded with other apps, we need to recognize our custom URL scheme and universal links in order to tell the user if we will process the request or not. Make them configurable with sane defaults.
This commit is contained in:
parent
405905be82
commit
f3abca6462
|
@ -37,9 +37,10 @@
|
||||||
[Fabric with:@[[Crashlytics class]]];
|
[Fabric with:@[[Crashlytics class]]];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the conference activity type defined in this application.
|
|
||||||
// This cannot be defined by the SDK.
|
|
||||||
[JitsiMeet sharedInstance].conferenceActivityType = JitsiMeetConferenceActivityType;
|
[JitsiMeet sharedInstance].conferenceActivityType = JitsiMeetConferenceActivityType;
|
||||||
|
[JitsiMeet sharedInstance].customUrlScheme = @"org.jitsi.meet";
|
||||||
|
[JitsiMeet sharedInstance].universalLinkDomains = @[@"meet.jit.si", @"beta.meet.jit.si"];
|
||||||
|
|
||||||
[[JitsiMeet sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions];
|
[[JitsiMeet sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions];
|
||||||
|
|
||||||
return YES;
|
return YES;
|
||||||
|
|
|
@ -18,9 +18,12 @@
|
||||||
#import <JitsiMeet/JitsiMeetView.h>
|
#import <JitsiMeet/JitsiMeetView.h>
|
||||||
#import <JitsiMeet/JitsiMeetViewDelegate.h>
|
#import <JitsiMeet/JitsiMeetViewDelegate.h>
|
||||||
|
|
||||||
|
|
||||||
@interface JitsiMeet : NSObject
|
@interface JitsiMeet : NSObject
|
||||||
|
|
||||||
@property (copy, nonatomic, nullable) NSString *conferenceActivityType;
|
@property (copy, nonatomic, nullable) NSString *conferenceActivityType;
|
||||||
|
@property (copy, nonatomic, nullable) NSString *customUrlScheme;
|
||||||
|
@property (copy, nonatomic, nullable) NSArray<NSString *> *universalLinkDomains;
|
||||||
|
|
||||||
#pragma mak - This class is a singleton
|
#pragma mak - This class is a singleton
|
||||||
|
|
||||||
|
|
|
@ -91,6 +91,10 @@
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (![_customUrlScheme isEqualToString:url.scheme]) {
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
return [JitsiMeetView loadURLInViews:@{ @"url" : url.absoluteString }];
|
return [JitsiMeetView loadURLInViews:@{ @"url" : url.absoluteString }];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,7 +122,10 @@
|
||||||
|
|
||||||
if ([activityType isEqualToString:NSUserActivityTypeBrowsingWeb]) {
|
if ([activityType isEqualToString:NSUserActivityTypeBrowsingWeb]) {
|
||||||
// App was started by opening a URL in the browser
|
// App was started by opening a URL in the browser
|
||||||
return @{ @"url" : userActivity.webpageURL.absoluteString };
|
NSURL *url = userActivity.webpageURL;
|
||||||
|
if ([_universalLinkDomains containsObject:url.host]) {
|
||||||
|
return @{ @"url" : url.absoluteString };
|
||||||
|
}
|
||||||
} else if ([activityType isEqualToString:@"INStartAudioCallIntent"]
|
} else if ([activityType isEqualToString:@"INStartAudioCallIntent"]
|
||||||
|| [activityType isEqualToString:@"INStartVideoCallIntent"]) {
|
|| [activityType isEqualToString:@"INStartVideoCallIntent"]) {
|
||||||
// App was started by a CallKit Intent
|
// App was started by a CallKit Intent
|
||||||
|
@ -152,6 +159,16 @@
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma mark - Property getter / setters
|
||||||
|
|
||||||
|
- (NSString *)customUrlScheme {
|
||||||
|
return _customUrlScheme ? _customUrlScheme : @"org.jitsi.meet";
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSArray<NSString *> *)universalLinkDomains {
|
||||||
|
return _universalLinkDomains ? _universalLinkDomains : @[@"meet.jit.si"];
|
||||||
|
}
|
||||||
|
|
||||||
#pragma mark - Private API methods
|
#pragma mark - Private API methods
|
||||||
|
|
||||||
- (RCTBridge *)getReactBridge {
|
- (RCTBridge *)getReactBridge {
|
||||||
|
|
Loading…
Reference in New Issue