Skip to content

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

chore(ios/sdk): remove bridge references

Calin-Teodor18335f9ec576
diff --git a/ios/sdk/src/ExternalAPI.h b/ios/sdk/src/ExternalAPI.h
index 2e29db0a8a..2812babcea 100644
--- a/ios/sdk/src/ExternalAPI.h
+++ b/ios/sdk/src/ExternalAPI.h
@@ -20,6 +20,8 @@ static NSString * const sendEventNotificationName = @"org.jitsi.meet.SendEvent";
@interface ExternalAPI : RCTEventEmitter<RCTBridgeModule>
++ (ExternalAPI *)sharedInstance;
+
- (void)sendHangUp;
- (void)sendSetAudioMuted:(BOOL)muted;
- (void)sendEndpointTextMessage:(NSString*)message :(NSString*)to;
diff --git a/ios/sdk/src/ExternalAPI.m b/ios/sdk/src/ExternalAPI.m
index b818f71a50..2636e71be8 100644
--- a/ios/sdk/src/ExternalAPI.m
+++ b/ios/sdk/src/ExternalAPI.m
@@ -46,6 +46,21 @@ static void initializeViewsMap(void) {
RCT_EXPORT_MODULE();
+static __weak ExternalAPI *_sharedExternalAPI = nil;
+
+- (instancetype)init {
+ self = [super init];
+ if (self) {
+ _sharedExternalAPI = self;
+ }
+
+ return self;
+}
+
++ (ExternalAPI *)sharedInstance {
+ return _sharedExternalAPI;
+}
+
- (NSDictionary *)constantsToExport {
return @{
@"HANG_UP": hangUpAction,
diff --git a/ios/sdk/src/JitsiMeet+Private.h b/ios/sdk/src/JitsiMeet+Private.h
index b61c437564..3affeaeb77 100644
--- a/ios/sdk/src/JitsiMeet+Private.h
+++ b/ios/sdk/src/JitsiMeet+Private.h
@@ -14,7 +14,6 @@
* limitations under the License.
*/
-#import <React/RCTBridge.h>
#import <RCTReactNativeFactory.h>
#import "ExternalAPI.h"
diff --git a/ios/sdk/src/JitsiMeet.h b/ios/sdk/src/JitsiMeet.h
index 30e338d41f..3f79001d79 100644
--- a/ios/sdk/src/JitsiMeet.h
+++ b/ios/sdk/src/JitsiMeet.h
@@ -86,16 +86,6 @@ typedef NS_ENUM(NSInteger, WebRTCLoggingSeverity) {
#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 5be0ae9160..eab930ea52 100644
--- a/ios/sdk/src/JitsiMeet.m
+++ b/ios/sdk/src/JitsiMeet.m
@@ -151,27 +151,13 @@
NSLog(@"Creating RCTReactNativeFactory with delegate");
_reactNativeFactory = [[RCTReactNativeFactory alloc] initWithDelegate:_reactFactoryDelegate];
NSLog(@"RCTReactNativeFactory created: %@", _reactNativeFactory);
-}
-- (void)instantiateReactNativeBridge {
- if (_reactNativeFactory == nil) {
- [self createReactNativeFactory];
- }
-
// Initialize WebRTC options.
WebRTCModuleOptions *options = [WebRTCModuleOptions sharedInstance];
options.audioDevice = _rtcAudioDevice;
options.loggingSeverity = (RTCLoggingSeverity)_webRtcLoggingSeverity;
-
- // Accessing bridge forces lazy initialization.
- [_reactNativeFactory bridge];
}
-
-- (void)destroyReactNativeBridge {
- [_reactNativeFactory.bridge invalidate];
- _reactNativeFactory.bridge = nil;
-}
-
+
- (JitsiMeetConferenceOptions *)getInitialConferenceOptions {
if (_launchOptions[UIApplicationLaunchOptionsURLKey]) {
NSURL *url = _launchOptions[UIApplicationLaunchOptionsURLKey];
@@ -279,14 +265,6 @@
return _defaultConferenceOptions == nil ? @{} : [_defaultConferenceOptions asProps];
}
-- (RCTBridge *)getReactBridge {
- // Initialize bridge lazily.
- [self instantiateReactNativeBridge];
-
- // Get bridge directly from factory
- return _reactNativeFactory.bridge;
-}
-
- (RCTReactNativeFactory *)getReactNativeFactory {
if (_reactNativeFactory == nil) {
[self createReactNativeFactory];
@@ -296,8 +274,8 @@
}
- (ExternalAPI *)getExternalAPI {
- RCTBridge *bridge = [self getReactBridge];
- return [bridge moduleForClass:ExternalAPI.class];
+ ExternalAPI *api = [ExternalAPI sharedInstance];
+ return api;
}
@end
diff --git a/ios/sdk/src/JitsiReactFactoryDelegate.m b/ios/sdk/src/JitsiReactFactoryDelegate.m
index 7e1750256f..4d7061e964 100644
--- a/ios/sdk/src/JitsiReactFactoryDelegate.m
+++ b/ios/sdk/src/JitsiReactFactoryDelegate.m
@@ -3,7 +3,6 @@
#import "JitsiMeet.h"
#import <React/RCTBundleURLProvider.h>
-#import <React/RCTBridge.h>
static NSString *RCTReadMetroHostFromBundle(NSBundle *bundle) {
NSString *ipPath = [bundle pathForResource:@"ip" ofType:@"txt"];
@@ -23,10 +22,6 @@ static NSString *RCTReadMetroHostFromBundle(NSBundle *bundle) {
@implementation JitsiReactFactoryDelegate
-- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge {
- return [self bundleURL];
-}
-
- (NSURL *_Nullable)bundleURL {
#if DEBUG
RCTBundleURLProvider *provider = [RCTBundleURLProvider sharedSettings];