diff --git a/ios/sdk/src/JitsiMeet.h b/ios/sdk/src/JitsiMeet.h index 0b5b7f430..d9e6ddd16 100644 --- a/ios/sdk/src/JitsiMeet.h +++ b/ios/sdk/src/JitsiMeet.h @@ -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; diff --git a/ios/sdk/src/JitsiMeet.m b/ios/sdk/src/JitsiMeet.m index a7e4b8848..34b37e1d1 100644 --- a/ios/sdk/src/JitsiMeet.m +++ b/ios/sdk/src/JitsiMeet.m @@ -28,7 +28,6 @@ #import #import - @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];