feat(ios) support for destroying & reinitializing the react native bridge

This commit is contained in:
Alex Bumbu 2021-07-30 12:53:30 +03:00 committed by GitHub
parent efc5c9dabe
commit af9958ad66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 2 deletions

View File

@ -59,6 +59,16 @@
#pragma mark - Utility methods
/**
* Once the react native bridge is destroyed you are responsible for reinstantiating it back. Use this method to do so.
*/
- (void)instantiateReactNativeBridge;
/**
* Helper method to destroy the react native bridge, cleaning up resources in the process. Once the react native bridge is destroyed you are responsible for reinstantiating it back using `instantiateReactNativeBridge` method.
*/
- (void)destroyReactNativeBridge;
- (JitsiMeetConferenceOptions *_Nonnull)getInitialConferenceOptions;
- (BOOL)isCrashReportingDisabled;

View File

@ -28,7 +28,6 @@
#import <RNGoogleSignin/RNGoogleSignin.h>
#import <WebRTC/RTCLogging.h>
@implementation JitsiMeet {
RCTBridgeWrapper *_bridgeWrapper;
NSDictionary *_launchOptions;
@ -50,7 +49,7 @@
- (instancetype)init {
if (self = [super init]) {
// Initialize the on and only bridge for interfacing with React Native.
// Initialize the one and only bridge for interfacing with React Native.
_bridgeWrapper = [[RCTBridgeWrapper alloc] init];
// Initialize the listener for handling start/stop screensharing notifications.
@ -119,6 +118,18 @@
#pragma mark - Utility methods
- (void)instantiateReactNativeBridge {
if (_bridgeWrapper != nil) {
return;
};
_bridgeWrapper = [[RCTBridgeWrapper alloc] init];
}
- (void)destroyReactNativeBridge {
_bridgeWrapper = nil;
}
- (JitsiMeetConferenceOptions *)getInitialConferenceOptions {
if (_launchOptions[UIApplicationLaunchOptionsURLKey]) {
NSURL *url = _launchOptions[UIApplicationLaunchOptionsURLKey];