feat(react-native-sdk): add ENDPOINT_MESSAGE_RECEIVED to rnsdk events (#14889)

* feat(react-native-sdk): add ENDPOINT_MESSAGE_RECEIVED to react native SDK event listeners
pull/14908/head jitsi-meet_9620
Calinteodor 11 months ago committed by GitHub
parent 160d6a4c52
commit 782d46b4a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      react-native-sdk/index.tsx
  2. 5
      react-native-sdk/update_dependencies.js
  3. 32
      react/features/mobile/react-native-sdk/middleware.js

@ -30,6 +30,7 @@ interface IEventListeners {
onConferenceLeft?: Function; onConferenceLeft?: Function;
onConferenceWillJoin?: Function; onConferenceWillJoin?: Function;
onEnterPictureInPicture?: Function; onEnterPictureInPicture?: Function;
onEndpointMessageReceived?: Function;
onParticipantJoined?: Function; onParticipantJoined?: Function;
onParticipantLeft?: ({ id }: { id: string }) => void; onParticipantLeft?: ({ id }: { id: string }) => void;
onReadyToClose?: Function; onReadyToClose?: Function;
@ -133,6 +134,7 @@ export const JitsiMeeting = forwardRef<JitsiRefProps, IAppProps>((props, ref) =>
onConferenceWillJoin: eventListeners?.onConferenceWillJoin, onConferenceWillJoin: eventListeners?.onConferenceWillJoin,
onConferenceLeft: eventListeners?.onConferenceLeft, onConferenceLeft: eventListeners?.onConferenceLeft,
onEnterPictureInPicture: eventListeners?.onEnterPictureInPicture, onEnterPictureInPicture: eventListeners?.onEnterPictureInPicture,
onEndpointMessageReceived: eventListeners?.onEndpointMessageReceived,
onParticipantJoined: eventListeners?.onParticipantJoined, onParticipantJoined: eventListeners?.onParticipantJoined,
onParticipantLeft: eventListeners?.onParticipantLeft, onParticipantLeft: eventListeners?.onParticipantLeft,
onReadyToClose: eventListeners?.onReadyToClose onReadyToClose: eventListeners?.onReadyToClose

@ -21,11 +21,6 @@ function updateDependencies() {
for (const key in RNSDKpackageJSON.peerDependencies) { for (const key in RNSDKpackageJSON.peerDependencies) {
if (!packageJSON.dependencies.hasOwnProperty(key)) { if (!packageJSON.dependencies.hasOwnProperty(key)) {
if (packageJSON.devDependencies.hasOwnProperty('@react-native/metro-config')) {
continue;
}
packageJSON.dependencies[key] = RNSDKpackageJSON.peerDependencies[key]; packageJSON.dependencies[key] = RNSDKpackageJSON.peerDependencies[key];
updated = true; updated = true;
} }

@ -4,7 +4,8 @@ import {
CONFERENCE_FOCUSED, CONFERENCE_FOCUSED,
CONFERENCE_JOINED, CONFERENCE_JOINED,
CONFERENCE_LEFT, CONFERENCE_LEFT,
CONFERENCE_WILL_JOIN CONFERENCE_WILL_JOIN,
ENDPOINT_MESSAGE_RECEIVED
} from '../../base/conference/actionTypes'; } from '../../base/conference/actionTypes';
import { SET_AUDIO_MUTED, SET_VIDEO_MUTED } from '../../base/media/actionTypes'; import { SET_AUDIO_MUTED, SET_VIDEO_MUTED } from '../../base/media/actionTypes';
import { PARTICIPANT_JOINED, PARTICIPANT_LEFT } from '../../base/participants/actionTypes'; import { PARTICIPANT_JOINED, PARTICIPANT_LEFT } from '../../base/participants/actionTypes';
@ -29,34 +30,43 @@ const externalAPIEnabled = isExternalAPIAvailable();
switch (type) { switch (type) {
case SET_AUDIO_MUTED: case SET_AUDIO_MUTED:
rnSdkHandlers?.onAudioMutedChanged && rnSdkHandlers?.onAudioMutedChanged(action.muted); rnSdkHandlers?.onAudioMutedChanged?.(action.muted);
break; break;
case SET_VIDEO_MUTED: case SET_VIDEO_MUTED:
rnSdkHandlers?.onVideoMutedChanged && rnSdkHandlers?.onVideoMutedChanged(Boolean(action.muted)); rnSdkHandlers?.onVideoMutedChanged?.(Boolean(action.muted));
break; break;
case CONFERENCE_BLURRED: case CONFERENCE_BLURRED:
rnSdkHandlers?.onConferenceBlurred && rnSdkHandlers?.onConferenceBlurred(); rnSdkHandlers?.onConferenceBlurred?.();
break; break;
case CONFERENCE_FOCUSED: case CONFERENCE_FOCUSED:
rnSdkHandlers?.onConferenceFocused && rnSdkHandlers?.onConferenceFocused(); rnSdkHandlers?.onConferenceFocused?.();
break; break;
case CONFERENCE_JOINED: case CONFERENCE_JOINED:
rnSdkHandlers?.onConferenceJoined && rnSdkHandlers?.onConferenceJoined(); rnSdkHandlers?.onConferenceJoined?.();
break; break;
case CONFERENCE_LEFT: case CONFERENCE_LEFT:
// Props are torn down at this point, perhaps need to leave this one out // Props are torn down at this point, perhaps need to leave this one out
break; break;
case CONFERENCE_WILL_JOIN: case CONFERENCE_WILL_JOIN:
rnSdkHandlers?.onConferenceWillJoin && rnSdkHandlers?.onConferenceWillJoin(); rnSdkHandlers?.onConferenceWillJoin?.();
break; break;
case ENTER_PICTURE_IN_PICTURE: case ENTER_PICTURE_IN_PICTURE:
rnSdkHandlers?.onEnterPictureInPicture && rnSdkHandlers?.onEnterPictureInPicture(); rnSdkHandlers?.onEnterPictureInPicture?.();
break; break;
case ENDPOINT_MESSAGE_RECEIVED: {
const { data, participant } = action;
rnSdkHandlers?.onEndpointMessageReceived?.({
data,
participant
});
break;
}
case PARTICIPANT_JOINED: { case PARTICIPANT_JOINED: {
const { participant } = action; const { participant } = action;
const participantInfo = participantToParticipantInfo(participant); const participantInfo = participantToParticipantInfo(participant);
rnSdkHandlers?.onParticipantJoined && rnSdkHandlers?.onParticipantJoined(participantInfo); rnSdkHandlers?.onParticipantJoined?.(participantInfo);
break; break;
} }
case PARTICIPANT_LEFT: { case PARTICIPANT_LEFT: {
@ -64,11 +74,11 @@ const externalAPIEnabled = isExternalAPIAvailable();
const { id } = participant ?? {}; const { id } = participant ?? {};
rnSdkHandlers?.onParticipantLeft && rnSdkHandlers?.onParticipantLeft({ id }); rnSdkHandlers?.onParticipantLeft?.({ id });
break; break;
} }
case READY_TO_CLOSE: case READY_TO_CLOSE:
rnSdkHandlers?.onReadyToClose && rnSdkHandlers?.onReadyToClose(); rnSdkHandlers?.onReadyToClose?.();
break; break;
} }

Loading…
Cancel
Save