Skip to content

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

refactor(rnsdk): remove redundant audio and video actions (#14066)

Abbas Al-Mansooriab08eb2f9994
diff --git a/react/features/base/conference/actionTypes.ts b/react/features/base/conference/actionTypes.ts
index f03312dded..6ea2748393 100644
--- a/react/features/base/conference/actionTypes.ts
+++ b/react/features/base/conference/actionTypes.ts
@@ -72,24 +72,6 @@ export const CONFERENCE_BLURRED = 'CONFERENCE_BLURRED';
*/
export const CONFERENCE_FOCUSED = 'CONFERENCE_FOCUSED';
-/**
- * The type of (redux) action which signals that the audio mute state is changed.
- *
- * {
- * type: AUDIO_MUTED_CHANGED,
- * }
- */
-export const AUDIO_MUTED_CHANGED = 'AUDIO_MUTED_CHANGED';
-
-/**
- * The type of (redux) action which signals that the video mute state is changed.
- *
- * {
- * type: VIDEO_MUTED_CHANGED,
- * }
- */
-export const VIDEO_MUTED_CHANGED = 'VIDEO_MUTED_CHANGED';
-
/**
* The type of (redux) action, which indicates conference local subject changes.
*
diff --git a/react/features/mobile/external-api/middleware.ts b/react/features/mobile/external-api/middleware.ts
index 31ef385236..ef28d47c31 100644
--- a/react/features/mobile/external-api/middleware.ts
+++ b/react/features/mobile/external-api/middleware.ts
@@ -10,15 +10,13 @@ import { appNavigate } from '../../app/actions.native';
import { IStore } from '../../app/types';
import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../../base/app/actionTypes';
import {
- AUDIO_MUTED_CHANGED,
CONFERENCE_BLURRED,
CONFERENCE_FAILED,
CONFERENCE_FOCUSED,
CONFERENCE_JOINED,
CONFERENCE_LEFT,
CONFERENCE_WILL_JOIN,
- SET_ROOM,
- VIDEO_MUTED_CHANGED
+ SET_ROOM
} from '../../base/conference/actionTypes';
import { JITSI_CONFERENCE_URL_KEY } from '../../base/conference/constants';
import {
@@ -160,16 +158,6 @@ externalAPIEnabled && MiddlewareRegistry.register(store => next => action => {
sendEvent(store, CONFERENCE_BLURRED, {});
break;
- case AUDIO_MUTED_CHANGED:
- sendEvent(store, AUDIO_MUTED_CHANGED,
- /* data */ { muted: action.muted });
- break;
-
- case VIDEO_MUTED_CHANGED:
- sendEvent(store, VIDEO_MUTED_CHANGED,
- /* data */ { muted: action.muted });
- break;
-
case CONFERENCE_FOCUSED:
sendEvent(store, CONFERENCE_FOCUSED, {});
break;
diff --git a/react/features/mobile/react-native-sdk/middleware.js b/react/features/mobile/react-native-sdk/middleware.js
index ab6bf18073..6051af9a25 100644
--- a/react/features/mobile/react-native-sdk/middleware.js
+++ b/react/features/mobile/react-native-sdk/middleware.js
@@ -2,14 +2,13 @@ import { NativeModules } from 'react-native';
import { getAppProp } from '../../base/app/functions';
import {
- AUDIO_MUTED_CHANGED,
CONFERENCE_BLURRED,
CONFERENCE_FOCUSED,
CONFERENCE_JOINED,
CONFERENCE_LEFT,
- CONFERENCE_WILL_JOIN,
- VIDEO_MUTED_CHANGED
+ 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 MiddlewareRegistry from '../../base/redux/MiddlewareRegistry';
import StateListenerRegistry from '../../base/redux/StateListenerRegistry';
@@ -33,11 +32,11 @@ const { JMOngoingConference } = NativeModules;
const rnSdkHandlers = getAppProp(store, 'rnSdkHandlers');
switch (type) {
- case AUDIO_MUTED_CHANGED:
+ case SET_AUDIO_MUTED:
rnSdkHandlers?.onAudioMutedChanged && rnSdkHandlers?.onAudioMutedChanged(action.muted);
break;
- case VIDEO_MUTED_CHANGED:
- rnSdkHandlers?.onVideoMutedChanged && rnSdkHandlers?.onVideoMutedChanged(action.muted);
+ case SET_VIDEO_MUTED:
+ rnSdkHandlers?.onVideoMutedChanged && rnSdkHandlers?.onVideoMutedChanged(Boolean(action.muted));
break;
case CONFERENCE_BLURRED:
rnSdkHandlers?.onConferenceBlurred && rnSdkHandlers?.onConferenceBlurred();
diff --git a/react/features/toolbox/components/native/AudioMuteButton.tsx b/react/features/toolbox/components/native/AudioMuteButton.tsx
index fddd4c6a26..9aa75fbf75 100644
--- a/react/features/toolbox/components/native/AudioMuteButton.tsx
+++ b/react/features/toolbox/components/native/AudioMuteButton.tsx
@@ -1,30 +1,6 @@
import { connect } from 'react-redux';
-import { AUDIO_MUTED_CHANGED } from '../../../base/conference/actionTypes';
import { translate } from '../../../base/i18n/functions';
import AbstractAudioMuteButton, { IProps, mapStateToProps } from '../AbstractAudioMuteButton';
-/**
- * Component that renders native toolbar button for toggling audio mute.
- *
- * @augments AbstractAudioMuteButton
- */
-class AudioMuteButton extends AbstractAudioMuteButton<IProps> {
- /**
- * Changes audio muted state and dispatches the state to redux.
- *
- * @param {boolean} audioMuted - Whether audio should be muted or not.
- * @protected
- * @returns {void}
- */
- _setAudioMuted(audioMuted: boolean) {
- this.props.dispatch?.({
- type: AUDIO_MUTED_CHANGED,
- muted: audioMuted
- });
-
- super._setAudioMuted(audioMuted);
- }
-}
-
-export default translate(connect(mapStateToProps)(AudioMuteButton));
+export default translate(connect(mapStateToProps)(AbstractAudioMuteButton<IProps>));
diff --git a/react/features/toolbox/components/native/VideoMuteButton.tsx b/react/features/toolbox/components/native/VideoMuteButton.tsx
index 334dedb496..9b92b0e49a 100644
--- a/react/features/toolbox/components/native/VideoMuteButton.tsx
+++ b/react/features/toolbox/components/native/VideoMuteButton.tsx
@@ -1,31 +1,7 @@
import { connect } from 'react-redux';
-import { VIDEO_MUTED_CHANGED } from '../../../base/conference/actionTypes';
import { translate } from '../../../base/i18n/functions';
import AbstractVideoMuteButton, { IProps, mapStateToProps } from '../AbstractVideoMuteButton';
-/**
- * Component that renders native toolbar button for toggling video mute.
- *
- * @augments AbstractVideoMuteButton
- */
-class VideoMuteButton extends AbstractVideoMuteButton<IProps> {
- /**
- * Changes video muted state and dispatches the state to redux.
- *
- * @override
- * @param {boolean} videoMuted - Whether video should be muted or not.
- * @protected
- * @returns {void}
- */
- _setVideoMuted(videoMuted: boolean) {
- this.props.dispatch?.({
- type: VIDEO_MUTED_CHANGED,
- muted: videoMuted
- });
- super._setVideoMuted(videoMuted);
- }
-}
-
-export default translate(connect(mapStateToProps)(VideoMuteButton));
+export default translate(connect(mapStateToProps)(AbstractVideoMuteButton<IProps>));