Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: [react-native-sdk] Adds screen share support on iOS #14929

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 33 additions & 17 deletions ios/sdk/sdk.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objectVersion = 54;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -33,8 +33,8 @@
4E0EF63A28CA4069005D1B03 /* JMCallKitProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E0EF63728CA4069005D1B03 /* JMCallKitProxy.h */; settings = {ATTRIBUTES = (Public, ); }; };
4E0EF63B28CA4069005D1B03 /* JMCallKitProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E0EF63828CA4069005D1B03 /* JMCallKitProxy.m */; };
4E0EF63C28CA4069005D1B03 /* JMCallKitProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E0EF63828CA4069005D1B03 /* JMCallKitProxy.m */; };
4E51B76425E5345E0038575A /* ScheenshareEventEmiter.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E51B76225E5345E0038575A /* ScheenshareEventEmiter.h */; };
4E51B76525E5345E0038575A /* ScheenshareEventEmiter.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E51B76325E5345E0038575A /* ScheenshareEventEmiter.m */; };
4E51B76425E5345E0038575A /* ScreenShareEventEmitter.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E51B76225E5345E0038575A /* ScreenShareEventEmitter.h */; };
4E51B76525E5345E0038575A /* ScreenShareEventEmitter.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E51B76325E5345E0038575A /* ScreenShareEventEmitter.m */; };
4E812F3328F9A4290087ACC9 /* JitsiMeetView+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E812F3228F9A4290087ACC9 /* JitsiMeetView+Private.h */; };
4E812F3428F9A4290087ACC9 /* JitsiMeetView+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E812F3228F9A4290087ACC9 /* JitsiMeetView+Private.h */; };
4E812F3928F9A4ED0087ACC9 /* JitsiMeetView+Private.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E812F3628F9A4ED0087ACC9 /* JitsiMeetView+Private.m */; };
Expand Down Expand Up @@ -66,7 +66,7 @@
DE9A0132289A9A9A00E41CBB /* RCTBridgeWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 0B93EF7C1EC9DDCD0030D24D /* RCTBridgeWrapper.h */; };
DE9A0133289A9A9A00E41CBB /* JitsiMeetBaseLogHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = DE81A2DC2317ED5400AE1940 /* JitsiMeetBaseLogHandler.h */; settings = {ATTRIBUTES = (Public, ); }; };
DE9A0134289A9A9A00E41CBB /* JitsiMeetSDK.h in Headers */ = {isa = PBXBuildFile; fileRef = DEA9F283258A5D9900D4CD74 /* JitsiMeetSDK.h */; settings = {ATTRIBUTES = (Public, ); }; };
DE9A0135289A9A9A00E41CBB /* ScheenshareEventEmiter.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E51B76225E5345E0038575A /* ScheenshareEventEmiter.h */; };
DE9A0135289A9A9A00E41CBB /* ScreenShareEventEmitter.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E51B76225E5345E0038575A /* ScreenShareEventEmitter.h */; };
DE9A0136289A9A9A00E41CBB /* JitsiMeetBaseLogHandler+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = DE65AACB2318028300290BEC /* JitsiMeetBaseLogHandler+Private.h */; };
DE9A0138289A9A9A00E41CBB /* JitsiMeetViewDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 0B412F1B1EDEC80100B1A0A6 /* JitsiMeetViewDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
DE9A0139289A9A9A00E41CBB /* JitsiAudioSession.h in Headers */ = {isa = PBXBuildFile; fileRef = 4ED4FFF12721B9B90074E620 /* JitsiAudioSession.h */; settings = {ATTRIBUTES = (Public, ); }; };
Expand Down Expand Up @@ -94,7 +94,7 @@
DE9A0153289A9A9A00E41CBB /* Proximity.m in Sources */ = {isa = PBXBuildFile; fileRef = 0BCA495E1EC4B6C600B793EE /* Proximity.m */; };
DE9A0155289A9A9A00E41CBB /* ReactUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = DEFE535521FB2E8300011A3A /* ReactUtils.m */; };
DE9A0157289A9A9A00E41CBB /* DragGestureController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6A3425E204EF76800E062DD /* DragGestureController.swift */; };
DE9A0158289A9A9A00E41CBB /* ScheenshareEventEmiter.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E51B76325E5345E0038575A /* ScheenshareEventEmiter.m */; };
DE9A0158289A9A9A00E41CBB /* ScreenShareEventEmitter.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E51B76325E5345E0038575A /* ScreenShareEventEmitter.m */; };
DE9A015C289A9A9A00E41CBB /* JitsiMeetLogger.m in Sources */ = {isa = PBXBuildFile; fileRef = DE81A2D32316AC4D00AE1940 /* JitsiMeetLogger.m */; };
DE9A015E289A9A9A00E41CBB /* JitsiMeetView.m in Sources */ = {isa = PBXBuildFile; fileRef = 0B412F171EDEC65D00B1A0A6 /* JitsiMeetView.m */; };
DE9A015F289A9A9A00E41CBB /* JitsiMeet.m in Sources */ = {isa = PBXBuildFile; fileRef = DEFE535321FB1BF800011A3A /* JitsiMeet.m */; };
Expand Down Expand Up @@ -138,8 +138,8 @@
4E0EF63428CA317E005D1B03 /* JMCallKitListener.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JMCallKitListener.h; sourceTree = "<group>"; };
4E0EF63728CA4069005D1B03 /* JMCallKitProxy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JMCallKitProxy.h; sourceTree = "<group>"; };
4E0EF63828CA4069005D1B03 /* JMCallKitProxy.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JMCallKitProxy.m; sourceTree = "<group>"; };
4E51B76225E5345E0038575A /* ScheenshareEventEmiter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ScheenshareEventEmiter.h; sourceTree = "<group>"; };
4E51B76325E5345E0038575A /* ScheenshareEventEmiter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ScheenshareEventEmiter.m; sourceTree = "<group>"; };
4E51B76225E5345E0038575A /* ScreenShareEventEmitter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ScreenShareEventEmitter.h; sourceTree = "<group>"; };
4E51B76325E5345E0038575A /* ScreenShareEventEmitter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ScreenShareEventEmitter.m; sourceTree = "<group>"; };
4E812F3228F9A4290087ACC9 /* JitsiMeetView+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "JitsiMeetView+Private.h"; sourceTree = "<group>"; };
4E812F3628F9A4ED0087ACC9 /* JitsiMeetView+Private.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "JitsiMeetView+Private.m"; sourceTree = "<group>"; };
4ED4FFF12721B9B90074E620 /* JitsiAudioSession.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JitsiAudioSession.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -292,8 +292,8 @@
C8AFD27E2462C613000293D2 /* InfoPlistUtil.m */,
C81E9AB825AC5AD800B134D9 /* ExternalAPI.h */,
0BA13D301EE83FF8007BEF7F /* ExternalAPI.m */,
4E51B76225E5345E0038575A /* ScheenshareEventEmiter.h */,
4E51B76325E5345E0038575A /* ScheenshareEventEmiter.m */,
4E51B76225E5345E0038575A /* ScreenShareEventEmitter.h */,
4E51B76325E5345E0038575A /* ScreenShareEventEmitter.m */,
DE9A0170289A9A9A00E41CBB /* Lite-Info.plist */,
);
path = src;
Expand Down Expand Up @@ -367,7 +367,7 @@
0B93EF7E1EC9DDCD0030D24D /* RCTBridgeWrapper.h in Headers */,
DE81A2DE2317ED5400AE1940 /* JitsiMeetBaseLogHandler.h in Headers */,
DEA9F284258A5D9900D4CD74 /* JitsiMeetSDK.h in Headers */,
4E51B76425E5345E0038575A /* ScheenshareEventEmiter.h in Headers */,
4E51B76425E5345E0038575A /* ScreenShareEventEmitter.h in Headers */,
DE65AACC2318028300290BEC /* JitsiMeetBaseLogHandler+Private.h in Headers */,
0B412F221EDEF6EA00B1A0A6 /* JitsiMeetViewDelegate.h in Headers */,
4E0EF63528CA317E005D1B03 /* JMCallKitListener.h in Headers */,
Expand All @@ -393,7 +393,7 @@
DE9A0132289A9A9A00E41CBB /* RCTBridgeWrapper.h in Headers */,
DE9A0133289A9A9A00E41CBB /* JitsiMeetBaseLogHandler.h in Headers */,
DE9A0134289A9A9A00E41CBB /* JitsiMeetSDK.h in Headers */,
DE9A0135289A9A9A00E41CBB /* ScheenshareEventEmiter.h in Headers */,
DE9A0135289A9A9A00E41CBB /* ScreenShareEventEmitter.h in Headers */,
DE9A0136289A9A9A00E41CBB /* JitsiMeetBaseLogHandler+Private.h in Headers */,
DE9A0138289A9A9A00E41CBB /* JitsiMeetViewDelegate.h in Headers */,
4E0EF63628CA317E005D1B03 /* JMCallKitListener.h in Headers */,
Expand Down Expand Up @@ -678,7 +678,7 @@
4E0EF63228CA2FB3005D1B03 /* JMCallKitEmitter.m in Sources */,
DEFE535621FB2E8300011A3A /* ReactUtils.m in Sources */,
C6A34261204EF76800E062DD /* DragGestureController.swift in Sources */,
4E51B76525E5345E0038575A /* ScheenshareEventEmiter.m in Sources */,
4E51B76525E5345E0038575A /* ScreenShareEventEmitter.m in Sources */,
A4A934E9212F3ADB001E9388 /* Dropbox.m in Sources */,
DE81A2D52316AC4D00AE1940 /* JitsiMeetLogger.m in Sources */,
0B412F191EDEC65D00B1A0A6 /* JitsiMeetView.m in Sources */,
Expand Down Expand Up @@ -711,7 +711,7 @@
4E812F3A28F9A4ED0087ACC9 /* JitsiMeetView+Private.m in Sources */,
DE9A0155289A9A9A00E41CBB /* ReactUtils.m in Sources */,
DE9A0157289A9A9A00E41CBB /* DragGestureController.swift in Sources */,
DE9A0158289A9A9A00E41CBB /* ScheenshareEventEmiter.m in Sources */,
DE9A0158289A9A9A00E41CBB /* ScreenShareEventEmitter.m in Sources */,
DE9A015C289A9A9A00E41CBB /* JitsiMeetLogger.m in Sources */,
4E0EF63328CA2FB3005D1B03 /* JMCallKitEmitter.m in Sources */,
DE9A015E289A9A9A00E41CBB /* JitsiMeetView.m in Sources */,
Expand Down Expand Up @@ -873,7 +873,11 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "";
INFOPLIST_FILE = src/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = org.jitsi.JitsiMeetSDK.ios;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -902,7 +906,11 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "";
INFOPLIST_FILE = src/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = org.jitsi.JitsiMeetSDK.ios;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -935,7 +943,11 @@
"JITSI_MEET_SDK_LITE=1",
);
INFOPLIST_FILE = "src/Lite-Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = org.jitsi.JitsiMeetSDK.ios;
PRODUCT_NAME = JitsiMeetSDK;
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -969,7 +981,11 @@
JITSI_MEET_SDK_LITE,
);
INFOPLIST_FILE = "src/Lite-Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = org.jitsi.JitsiMeetSDK.ios;
PRODUCT_NAME = JitsiMeetSDK;
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
6 changes: 3 additions & 3 deletions ios/sdk/src/JitsiMeet.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#import "RCTBridgeWrapper.h"
#import "ReactUtils.h"
#import "RNSplashScreen.h"
#import "ScheenshareEventEmiter.h"
#import "ScreenShareEventEmitter.h"

#import <react-native-webrtc/WebRTCModuleOptions.h>

Expand All @@ -36,7 +36,7 @@
@implementation JitsiMeet {
RCTBridgeWrapper *_bridgeWrapper;
NSDictionary *_launchOptions;
ScheenshareEventEmiter *_screenshareEventEmiter;
ScreenShareEventEmitter *_screenShareEventEmitter;
}

#pragma mak - This class is a singleton
Expand Down Expand Up @@ -64,7 +64,7 @@ - (instancetype)init {
_bridgeWrapper = [[RCTBridgeWrapper alloc] init];

// Initialize the listener for handling start/stop screensharing notifications.
_screenshareEventEmiter = [[ScheenshareEventEmiter alloc] init];
_screenShareEventEmitter = [[ScreenShareEventEmitter alloc] init];

// Register a fatal error handler for React.
registerReactFatalErrorHandler();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN
#import <React/RCTBridgeModule.h>
#import <React/RCTEventEmitter.h>

@interface ScheenshareEventEmiter : NSObject
NS_ASSUME_NONNULL_BEGIN

@interface ScreenShareEventEmitter : RCTEventEmitter <RCTBridgeModule>
@end

NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,34 @@
* limitations under the License.
*/

#import "ScheenshareEventEmiter.h"
#import "JitsiMeet+Private.h"
#import "ExternalAPI.h"
#import "ScreenShareEventEmitter.h"
#import <React/RCTLog.h>
#import <React/RCTBridge.h>

NSNotificationName const kBroadcastStartedNotification = @"iOS_BroadcastStarted";
NSNotificationName const kBroadcastStoppedNotification = @"iOS_BroadcastStopped";

@implementation ScheenshareEventEmiter {
static NSString * const toggleScreenShareAction = @"org.jitsi.meet.TOGGLE_SCREEN_SHARE";

@implementation ScreenShareEventEmitter {
CFNotificationCenterRef _notificationCenter;
bool hasListeners;
}

RCT_EXPORT_MODULE();

- (NSDictionary *)constantsToExport {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check this warning

Module ScreenShareEventEmitter requires main queue setup since it overrides constantsToExport but doesn't implement requiresMainQueueSetup. In a future release React Native will default to initializing all native modules on a background thread unless explicitly opted-out of.

return @{
@"TOGGLE_SCREEN_SHARE": toggleScreenShareAction,
};
};

- (instancetype)init {
self = [super init];
if (self) {
_notificationCenter = CFNotificationCenterGetDarwinNotifyCenter();
[self setupObserver];
}

return self;
}

Expand All @@ -44,29 +54,46 @@ - (void)dealloc {
- (void)setupObserver {
CFNotificationCenterAddObserver(_notificationCenter, (__bridge const void *)(self), broadcastStartedNotificationCallback, (__bridge CFStringRef)kBroadcastStartedNotification, NULL, CFNotificationSuspensionBehaviorDeliverImmediately);
CFNotificationCenterAddObserver(_notificationCenter, (__bridge const void *)(self), broadcastStoppedNotificationCallback, (__bridge CFStringRef)kBroadcastStoppedNotification, NULL, CFNotificationSuspensionBehaviorDeliverImmediately);
hasListeners = YES;
}

- (void)clearObserver {
CFNotificationCenterRemoveObserver(_notificationCenter, (__bridge const void *)(self), (__bridge CFStringRef)kBroadcastStartedNotification, NULL);
CFNotificationCenterRemoveObserver(_notificationCenter, (__bridge const void *)(self), (__bridge CFStringRef)kBroadcastStoppedNotification, NULL);
hasListeners = NO;
}

void broadcastStartedNotificationCallback(CFNotificationCenterRef center,
void *observer,
CFStringRef name,
const void *object,
CFDictionaryRef userInfo) {
ExternalAPI *externalAPI = [[JitsiMeet sharedInstance] getExternalAPI];
[externalAPI toggleScreenShare:true];
ScreenShareEventEmitter *self = (__bridge ScreenShareEventEmitter *)observer;
[self handleBroadcastStarted];
}

void broadcastStoppedNotificationCallback(CFNotificationCenterRef center,
void *observer,
CFStringRef name,
const void *object,
CFDictionaryRef userInfo) {
ExternalAPI *externalAPI = [[JitsiMeet sharedInstance] getExternalAPI];
[externalAPI toggleScreenShare:false];
ScreenShareEventEmitter *self = (__bridge ScreenShareEventEmitter *)observer;
[self handleBroadcastStopped];
}

- (void)handleBroadcastStarted {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thread 1: "Error when sending event: org.jitsi.meet.TOGGLE_SCREEN_SHARE with body: {\n enabled = 1;\n}. RCTCallableJSModules is not set. This is probably because you've explicitly synthesized the RCTCallableJSModules in ScreenShareEventEmitter, even though it's inherited from RCTEventEmitter."

RCTLogInfo(@"Broadcast started");
[self sendEventWithName:toggleScreenShareAction body:@{@"enabled": @TRUE}];
}

- (void)handleBroadcastStopped {
RCTLogInfo(@"Broadcast stopped");
[self sendEventWithName:toggleScreenShareAction body:@{@"enabled": @FALSE}];
}

// Override the supportedEvents method
- (NSArray<NSString *> *)supportedEvents {
return @[toggleScreenShareAction];
}

@end
8 changes: 8 additions & 0 deletions react-native-sdk/prepare_sdk.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,14 @@ fs.copyFileSync(
`${iosSrcPath}/LocaleDetector.m`,
`${iosDestPath}/LocaleDetector.m`
);
fs.copyFileSync(
`${iosSrcPath}/ScreenShareEventEmitter.m`,
`${iosDestPath}/ScreenShareEventEmitter.m`
);
fs.copyFileSync(
`${iosSrcPath}/ScreenShareEventEmitter.h`,
`${iosDestPath}/ScreenShareEventEmitter.h`
);
fs.copyFileSync(
`${iosSrcPath}/POSIX.m`,
`${iosDestPath}/POSIX.m`
Expand Down
1 change: 1 addition & 0 deletions react/features/app/middlewares.native.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import '../mobile/permissions/middleware';
import '../mobile/proximity/middleware';
import '../mobile/wake-lock/middleware';
import '../mobile/react-native-sdk/middleware';
import '../mobile/screen-share/middleware';
import '../mobile/watchos/middleware';
import '../share-room/middleware';
import '../shared-video/middleware';
Expand Down
5 changes: 0 additions & 5 deletions react/features/mobile/external-api/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ import {
} from '../../base/participants/functions';
import MiddlewareRegistry from '../../base/redux/MiddlewareRegistry';
import StateListenerRegistry from '../../base/redux/StateListenerRegistry';
import { toggleScreensharing } from '../../base/tracks/actions.native';
import { getLocalTracks, isLocalTrackMuted } from '../../base/tracks/functions.native';
import { ITrack } from '../../base/tracks/types';
import { CLOSE_CHAT, OPEN_CHAT } from '../../chat/actionTypes';
Expand Down Expand Up @@ -373,10 +372,6 @@ function _registerForNativeEvents(store: IStore) {
}
});

eventEmitter.addListener(ExternalAPI.TOGGLE_SCREEN_SHARE, ({ enabled }: any) => {
dispatch(toggleScreensharing(enabled));
});

eventEmitter.addListener(ExternalAPI.RETRIEVE_PARTICIPANTS_INFO, ({ requestId }: any) => {

const participantsInfo = [];
Expand Down
1 change: 0 additions & 1 deletion react/features/mobile/react-native-sdk/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { isExternalAPIAvailable } from './functions';

const externalAPIEnabled = isExternalAPIAvailable();


/**
* Check if native modules are being used or not.
* If not, then the init of middleware doesn't happen.
Expand Down
12 changes: 12 additions & 0 deletions react/features/mobile/screen-share/functions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { NativeModules } from 'react-native';

/**
* Determines if the ScreenShareEventEmitter native module is available.
*
* @returns {boolean} If yes {@code true} otherwise {@code false}.
*/
export function isScreenShareAPIAvailable() {
const { ScreenShareEventEmitter } = NativeModules;

return ScreenShareEventEmitter !== null;
}
Loading