Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

[iOS] Fix joining initial URL if app was closed

Saúl Ibarra Corretgé99b856233dae
diff --git a/ios/app/src/AppDelegate.m b/ios/app/src/AppDelegate.m
index 495508bd4c..3073dc84a3 100644
--- a/ios/app/src/AppDelegate.m
+++ b/ios/app/src/AppDelegate.m
@@ -22,14 +22,15 @@
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
- return YES;
+ return [JitsiMeetView application:application
+ didFinishLaunchingWithOptions:launchOptions];
}
#pragma mark Linking delegate methods
-- (BOOL)application:(UIApplication *)application
-continueUserActivity:(NSUserActivity *)userActivity
- restorationHandler:(void (^)(NSArray *restorableObjects))restorationHandler {
+- (BOOL)application:(UIApplication *)application
+ continueUserActivity:(NSUserActivity *)userActivity
+ restorationHandler:(void (^)(NSArray *restorableObjects))restorationHandler {
return [JitsiMeetView application:application
continueUserActivity:userActivity
restorationHandler:restorationHandler];
diff --git a/ios/sdk/src/JitsiMeetView.h b/ios/sdk/src/JitsiMeetView.h
index e9b330338f..685dcc52bc 100644
--- a/ios/sdk/src/JitsiMeetView.h
+++ b/ios/sdk/src/JitsiMeetView.h
@@ -25,6 +25,9 @@
@property (nonatomic) BOOL welcomePageEnabled;
++ (BOOL)application:(UIApplication *_Nonnull)application
+ didFinishLaunchingWithOptions:(NSDictionary *_Nonnull)launchOptions;
+
+ (BOOL)application:(UIApplication * _Nonnull)application
continueUserActivity:(NSUserActivity * _Nonnull)userActivity
restorationHandler:(void (^ _Nullable)(NSArray * _Nullable))restorationHandler;
diff --git a/ios/sdk/src/JitsiMeetView.m b/ios/sdk/src/JitsiMeetView.m
index eed5dd8bfa..1f89300ad6 100644
--- a/ios/sdk/src/JitsiMeetView.m
+++ b/ios/sdk/src/JitsiMeetView.m
@@ -35,7 +35,8 @@ RCTFatalHandler _RCTFatal = ^(NSError *error) {
@try {
NSString *name
= [NSString stringWithFormat:@"%@: %@",
- RCTFatalExceptionName, error.localizedDescription];
+ RCTFatalExceptionName,
+ error.localizedDescription];
NSString *message
= RCTFormatError(error.localizedDescription, jsStackTrace, 75);
[NSException raise:name format:@"%@", message];
@@ -110,12 +111,27 @@ void registerFatalErrorHandler() {
static RCTBridgeWrapper *bridgeWrapper;
+/**
+ * Copy of the {@code launchOptions} dictionary that the application was started
+ * with. It is required for the initial URL to be used if a (Universal) link was
+ * used to launch a new instance of the application.
+ */
+static NSDictionary *_launchOptions;
+
/**
* The {@code JitsiMeetView}s associated with their {@code ExternalAPI} scopes
* (i.e. unique identifiers within the process).
*/
static NSMapTable<NSString *, JitsiMeetView *> *views;
++ (BOOL)application:(UIApplication *)application
+ didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
+ // Store launch options, will be used when we create the bridge.
+ _launchOptions = [launchOptions copy];
+
+ return YES;
+}
+
#pragma mark Linking delegate helpers
// https://facebook.github.io/react-native/docs/linking.html
@@ -201,7 +217,7 @@ static NSMapTable<NSString *, JitsiMeetView *> *views;
/**
* Internal initialization:
*
- * - sets the backgroudn color
+ * - sets the background color
* - creates the React bridge
* - loads the necessary custom fonts
* - registers a custom fatal error error handler for React
@@ -211,7 +227,8 @@ static NSMapTable<NSString *, JitsiMeetView *> *views;
dispatch_once(&dispatchOncePredicate, ^{
// Initialize the static state of JitsiMeetView.
- bridgeWrapper = [[RCTBridgeWrapper alloc] init];
+ bridgeWrapper
+ = [[RCTBridgeWrapper alloc] initWithLaunchOptions:_launchOptions];
views = [NSMapTable strongToWeakObjectsMapTable];
// Dynamically load custom bundled fonts.
diff --git a/ios/sdk/src/RCTBridgeWrapper.h b/ios/sdk/src/RCTBridgeWrapper.h
index f201281505..8e599124d7 100644
--- a/ios/sdk/src/RCTBridgeWrapper.h
+++ b/ios/sdk/src/RCTBridgeWrapper.h
@@ -34,4 +34,6 @@
@property (nonatomic, readonly, strong) RCTBridge *bridge;
+- (instancetype)initWithLaunchOptions:(NSDictionary *)launchOptions;
+
@end
diff --git a/ios/sdk/src/RCTBridgeWrapper.m b/ios/sdk/src/RCTBridgeWrapper.m
index 052bb81107..4fc5b03aa4 100644
--- a/ios/sdk/src/RCTBridgeWrapper.m
+++ b/ios/sdk/src/RCTBridgeWrapper.m
@@ -22,10 +22,12 @@
*/
@implementation RCTBridgeWrapper
-- (instancetype)init {
+- (instancetype)initWithLaunchOptions:(NSDictionary *)launchOptions {
self = [super init];
if (self) {
- _bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:nil];
+ _bridge
+ = [[RCTBridge alloc] initWithDelegate:self
+ launchOptions:launchOptions];
}
return self;