[iOS] Fix joining initial URL if app was closed
On iOS, if the app is closed the startup options are only passed as the `launchOptions` dictionary of `applicationDidFinishLaunching`. Thus add a helper method to be called from there by embedding applications so we can copy that dictionary.
This commit is contained in:
parent
814d56c25c
commit
99b856233d
|
@ -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];
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -34,4 +34,6 @@
|
|||
|
||||
@property (nonatomic, readonly, strong) RCTBridge *bridge;
|
||||
|
||||
- (instancetype)initWithLaunchOptions:(NSDictionary *)launchOptions;
|
||||
|
||||
@end
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue