Ver código fonte

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

master
Alex Bumbu 4 anos atrás
pai
commit
af9958ad66
Nenhuma conta vinculada ao e-mail do autor do commit
2 arquivos alterados com 23 adições e 2 exclusões
  1. 10
    0
      ios/sdk/src/JitsiMeet.h
  2. 13
    2
      ios/sdk/src/JitsiMeet.m

+ 10
- 0
ios/sdk/src/JitsiMeet.h Ver arquivo

@@ -59,6 +59,16 @@
59 59
 
60 60
 #pragma mark - Utility methods
61 61
 
62
+/**
63
+ * Once  the react native bridge is destroyed you are responsible for reinstantiating it back. Use this method to do so.
64
+ */
65
+- (void)instantiateReactNativeBridge;
66
+
67
+/**
68
+ * 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.
69
+ */
70
+- (void)destroyReactNativeBridge;
71
+
62 72
 - (JitsiMeetConferenceOptions *_Nonnull)getInitialConferenceOptions;
63 73
 
64 74
 - (BOOL)isCrashReportingDisabled;

+ 13
- 2
ios/sdk/src/JitsiMeet.m Ver arquivo

@@ -28,7 +28,6 @@
28 28
 #import <RNGoogleSignin/RNGoogleSignin.h>
29 29
 #import <WebRTC/RTCLogging.h>
30 30
 
31
-
32 31
 @implementation JitsiMeet {
33 32
     RCTBridgeWrapper *_bridgeWrapper;
34 33
     NSDictionary *_launchOptions;
@@ -50,7 +49,7 @@
50 49
 
51 50
 - (instancetype)init {
52 51
     if (self = [super init]) {
53
-        // Initialize the on and only bridge for interfacing with React Native.
52
+        // Initialize the one and only bridge for interfacing with React Native.
54 53
         _bridgeWrapper = [[RCTBridgeWrapper alloc] init];
55 54
         
56 55
         // Initialize the listener for handling start/stop screensharing notifications.
@@ -119,6 +118,18 @@
119 118
 
120 119
 #pragma mark - Utility methods
121 120
 
121
+- (void)instantiateReactNativeBridge {
122
+    if (_bridgeWrapper != nil) {
123
+        return;
124
+    };
125
+    
126
+    _bridgeWrapper = [[RCTBridgeWrapper alloc] init];
127
+}
128
+
129
+- (void)destroyReactNativeBridge {
130
+    _bridgeWrapper = nil;
131
+}
132
+
122 133
 - (JitsiMeetConferenceOptions *)getInitialConferenceOptions {
123 134
     if (_launchOptions[UIApplicationLaunchOptionsURLKey]) {
124 135
         NSURL *url = _launchOptions[UIApplicationLaunchOptionsURLKey];

Carregando…
Cancelar
Salvar