Skip to content

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

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

Alex Bumbuaf9958ad66c2
diff --git a/ios/sdk/src/JitsiMeet.h b/ios/sdk/src/JitsiMeet.h
index 0b5b7f4307..d9e6ddd169 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 a7e4b8848c..34b37e1d18 100644
--- a/ios/sdk/src/JitsiMeet.m
+++ b/ios/sdk/src/JitsiMeet.m
@@ -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];