From 60b5225ffd0952f7a822d82b041c639760df1c25 Mon Sep 17 00:00:00 2001 From: Abbas Al-Mansoori Date: Tue, 12 Dec 2023 08:48:06 +0100 Subject: [PATCH] feat(rn-sdk): add onParticipantLeft event listener --- react-native-sdk/index.tsx | 2 ++ react/features/mobile/react-native-sdk/middleware.js | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/react-native-sdk/index.tsx b/react-native-sdk/index.tsx index f7de9aa429..6b0434186e 100644 --- a/react-native-sdk/index.tsx +++ b/react-native-sdk/index.tsx @@ -28,6 +28,7 @@ interface IEventListeners { onConferenceWillJoin?: Function; onEnterPictureInPicture?: Function; onParticipantJoined?: Function; + onParticipantLeft?: ({ id }: { id: string }) => void; onReadyToClose?: Function; } @@ -118,6 +119,7 @@ export const JitsiMeeting = forwardRef((props: IAppProps, ref) => { onConferenceLeft: eventListeners?.onConferenceLeft, onEnterPictureInPicture: eventListeners?.onEnterPictureInPicture, onParticipantJoined: eventListeners?.onParticipantJoined, + onParticipantLeft: eventListeners?.onParticipantLeft, onReadyToClose: eventListeners?.onReadyToClose }, 'url': urlProps, diff --git a/react/features/mobile/react-native-sdk/middleware.js b/react/features/mobile/react-native-sdk/middleware.js index a27185986c..21b2f34d10 100644 --- a/react/features/mobile/react-native-sdk/middleware.js +++ b/react/features/mobile/react-native-sdk/middleware.js @@ -9,7 +9,7 @@ import { CONFERENCE_WILL_JOIN } from '../../base/conference/actionTypes'; import { SET_AUDIO_MUTED, SET_VIDEO_MUTED } from '../../base/media/actionTypes'; -import { PARTICIPANT_JOINED } from '../../base/participants/actionTypes'; +import { PARTICIPANT_JOINED, PARTICIPANT_LEFT } from '../../base/participants/actionTypes'; import MiddlewareRegistry from '../../base/redux/MiddlewareRegistry'; import StateListenerRegistry from '../../base/redux/StateListenerRegistry'; import { READY_TO_CLOSE } from '../external-api/actionTypes'; @@ -63,6 +63,14 @@ const { JMOngoingConference } = NativeModules; rnSdkHandlers?.onParticipantJoined && rnSdkHandlers?.onParticipantJoined(participantInfo); break; } + case PARTICIPANT_LEFT: { + const { participant } = action; + + const { id } = participant ?? {}; + + rnSdkHandlers?.onParticipantLeft && rnSdkHandlers?.onParticipantLeft({ id }); + break; + } case READY_TO_CLOSE: rnSdkHandlers?.onReadyToClose && rnSdkHandlers?.onReadyToClose(); break;