浏览代码

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

master
Alex Bumbu 4 年前
父节点
当前提交
af9958ad66
没有帐户链接到提交者的电子邮件
共有 2 个文件被更改,包括 23 次插入2 次删除
  1. 10
    0
      ios/sdk/src/JitsiMeet.h
  2. 13
    2
      ios/sdk/src/JitsiMeet.m

+ 10
- 0
ios/sdk/src/JitsiMeet.h 查看文件

59
 
59
 
60
 #pragma mark - Utility methods
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
 - (JitsiMeetConferenceOptions *_Nonnull)getInitialConferenceOptions;
72
 - (JitsiMeetConferenceOptions *_Nonnull)getInitialConferenceOptions;
63
 
73
 
64
 - (BOOL)isCrashReportingDisabled;
74
 - (BOOL)isCrashReportingDisabled;

+ 13
- 2
ios/sdk/src/JitsiMeet.m 查看文件

28
 #import <RNGoogleSignin/RNGoogleSignin.h>
28
 #import <RNGoogleSignin/RNGoogleSignin.h>
29
 #import <WebRTC/RTCLogging.h>
29
 #import <WebRTC/RTCLogging.h>
30
 
30
 
31
-
32
 @implementation JitsiMeet {
31
 @implementation JitsiMeet {
33
     RCTBridgeWrapper *_bridgeWrapper;
32
     RCTBridgeWrapper *_bridgeWrapper;
34
     NSDictionary *_launchOptions;
33
     NSDictionary *_launchOptions;
50
 
49
 
51
 - (instancetype)init {
50
 - (instancetype)init {
52
     if (self = [super init]) {
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
         _bridgeWrapper = [[RCTBridgeWrapper alloc] init];
53
         _bridgeWrapper = [[RCTBridgeWrapper alloc] init];
55
         
54
         
56
         // Initialize the listener for handling start/stop screensharing notifications.
55
         // Initialize the listener for handling start/stop screensharing notifications.
119
 
118
 
120
 #pragma mark - Utility methods
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
 - (JitsiMeetConferenceOptions *)getInitialConferenceOptions {
133
 - (JitsiMeetConferenceOptions *)getInitialConferenceOptions {
123
     if (_launchOptions[UIApplicationLaunchOptionsURLKey]) {
134
     if (_launchOptions[UIApplicationLaunchOptionsURLKey]) {
124
         NSURL *url = _launchOptions[UIApplicationLaunchOptionsURLKey];
135
         NSURL *url = _launchOptions[UIApplicationLaunchOptionsURLKey];

正在加载...
取消
保存