Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
Coding style
Lyubo Marinovfcca15c8271d
diff --git a/react/features/app/components/AbstractApp.js b/react/features/app/components/AbstractApp.jsindex 353cacbc5f..9b3ebb6982 100644--- a/react/features/app/components/AbstractApp.js+++ b/react/features/app/components/AbstractApp.js@@ -386,14 +386,13 @@ export class AbstractApp extends Component {* @returns {Store} - The redux store to be used by this* {@code AbstractApp}.*/- _maybeCreateStore(props) {+ _maybeCreateStore({ store }) {// The application Jitsi Meet is architected with redux. However, I do// not want consumers of the App React Component to be forced into// dealing with redux. If the consumer did not provide an external redux// store, utilize an internal redux store.- let store = props.store;-if (typeof store === 'undefined') {+ // eslint-disable-next-line no-param-reassignstore = this._createStore();// This is temporary workaround to be able to dispatch actions fromdiff --git a/react/features/base/participants/middleware.js b/react/features/base/participants/middleware.jsindex 6c4c645055..6198667cdc 100644--- a/react/features/base/participants/middleware.js+++ b/react/features/base/participants/middleware.js@@ -1,13 +1,9 @@// @flow-import UIEvents from '../../../../service/UI/UIEvents';-import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../../app';-import {- CONFERENCE_WILL_JOIN,- CONFERENCE_LEFT-} from '../conference';+import { CONFERENCE_LEFT, CONFERENCE_WILL_JOIN } from '../conference';import { MiddlewareRegistry } from '../redux';+import UIEvents from '../../../../service/UI/UIEvents';import { playSound, registerSound, unregisterSound } from '../sounds';import {@@ -43,17 +39,10 @@ declare var APP: Object;* Middleware that captures CONFERENCE_JOINED and CONFERENCE_LEFT actions and* updates respectively ID of local participant.*- * @param {Store} store - Redux store.+ * @param {Store} store - The redux store.* @returns {Function}*/MiddlewareRegistry.register(store => next => action => {- const { conference } = store.getState()['features/base/conference'];-- if (action.type === PARTICIPANT_JOINED- || action.type === PARTICIPANT_LEFT) {- _maybePlaySounds(store, action);- }-switch (action.type) {case APP_WILL_MOUNT:_registerSounds(store);@@ -77,29 +66,34 @@ MiddlewareRegistry.register(store => next => action => {const participant = getLocalParticipant(store.getState());if (participant) {- const local = participant.id === action.participant.id;+ const { id } = action.participant;store.dispatch(participantUpdated({- id: action.participant.id,- local,+ id,+ local: participant.id === id,raisedHand: false}));}- if (typeof APP === 'object') {- APP.UI.markDominantSpeaker(action.participant.id);- }+ typeof APP === 'object'+ && APP.UI.markDominantSpeaker(action.participant.id);break;}- case KICK_PARTICIPANT:+ case KICK_PARTICIPANT: {+ const { conference } = store.getState()['features/base/conference'];+conference.kickParticipant(action.id);break;+ }++ case MUTE_REMOTE_PARTICIPANT: {+ const { conference } = store.getState()['features/base/conference'];- case MUTE_REMOTE_PARTICIPANT:conference.muteParticipant(action.id);break;+ }// TODO Remove this middleware when the local display name update flow is// fully brought into redux.@@ -116,63 +110,16 @@ MiddlewareRegistry.register(store => next => action => {}case PARTICIPANT_JOINED:- case PARTICIPANT_UPDATED: {- const { participant } = action;- const { id, local, raisedHand } = participant;-- // Send an external update of the local participant's raised hand state- // if a new raised hand state is defined in the action.- if (typeof raisedHand !== 'undefined') {- if (local) {- conference.setLocalParticipantProperty(- 'raisedHand',- raisedHand);- }-- if (typeof APP === 'object') {- if (local) {- APP.UI.onLocalRaiseHandChanged(raisedHand);- APP.UI.setLocalRaisedHandStatus(raisedHand);- } else {- const remoteParticipant- = getParticipantById(store.getState(), id);-- remoteParticipant- && APP.UI.setRaisedHandStatus(- remoteParticipant.id,- remoteParticipant.name,- raisedHand);- }- }- }-- // Notify external listeners of potential avatarURL changes.- if (typeof APP === 'object') {- const preUpdateAvatarURL- = getAvatarURLByParticipantId(store.getState(), id);-- // Allow the redux update to go through and compare the old avatar- // to the new avatar and emit out change events if necessary.- const result = next(action);-- const postUpdateAvatarURL- = getAvatarURLByParticipantId(store.getState(), id);-- if (preUpdateAvatarURL !== postUpdateAvatarURL) {- const currentKnownId = local- ? APP.conference.getMyUserId() : id;-- APP.UI.refreshAvatarDisplay(- currentKnownId, postUpdateAvatarURL);- APP.API.notifyAvatarChanged(- currentKnownId, postUpdateAvatarURL);- }+ _maybePlaySounds(store, action);- return result;- }+ return _participantJoinedOrUpdated(store, next, action);+ case PARTICIPANT_LEFT:+ _maybePlaySounds(store, action);break;- }++ case PARTICIPANT_UPDATED:+ return _participantJoinedOrUpdated(store, next, action);}return next(action);@@ -182,7 +129,7 @@ MiddlewareRegistry.register(store => next => action => {* Initializes the local participant and signals that it joined.** @private- * @param {Store} store - The Redux store.+ * @param {Store} store - The redux store.* @param {Dispatch} next - The redux dispatch function to dispatch the* specified action to the specified store.* @param {Action} action - The redux action which is being dispatched@@ -208,8 +155,8 @@ function _localParticipantJoined({ getState, dispatch }, next, action) {/*** Plays sounds when participants join/leave conference.*- * @param {Store} store - The Redux store.- * @param {Action} action - The Redux action. Should be either+ * @param {Store} store - The redux store.+ * @param {Action} action - The redux action. Should be either* {@link PARTICIPANT_JOINED} or {@link PARTICIPANT_LEFT}.* @private* @returns {void}@@ -223,8 +170,8 @@ function _maybePlaySounds({ getState, dispatch }, action) {// The intention there was to not play user joined notification in big// conferences where 100th person is joining.if (!action.participant.local- && (!startAudioMuted- || getParticipantCount(state) < startAudioMuted)) {+ && (!startAudioMuted+ || getParticipantCount(state) < startAudioMuted)) {if (action.type === PARTICIPANT_JOINED) {dispatch(playSound(PARTICIPANT_JOINED_SOUND_ID));} else if (action.type === PARTICIPANT_LEFT) {@@ -233,30 +180,92 @@ function _maybePlaySounds({ getState, dispatch }, action) {}}+/**+ * Notifies the feature base/participants that the action+ * {@code PARTICIPANT_JOINED} or {@code PARTICIPANT_UPDATED} is being dispatched+ * within a specific redux store.+ *+ * @param {Store} store - The redux store in which the specified {@code action}+ * is being dispatched.+ * @param {Dispatch} next - The redux {@code dispatch} function to dispatch the+ * specified {@code action} in the specified {@code store}.+ * @param {Action} action - The redux action {@code PARTICIPANT_JOINED} or+ * {@code PARTICIPANT_UPDATED} which is being dispatched in the specified+ * {@code store}.+ * @private+ * @returns {Object} The value returned by {@code next(action)}.+ */+function _participantJoinedOrUpdated({ getState }, next, action) {+ const { participant: { id, local, raisedHand } } = action;++ // Send an external update of the local participant's raised hand state+ // if a new raised hand state is defined in the action.+ if (typeof raisedHand !== 'undefined') {+ if (local) {+ const { conference } = getState()['features/base/conference'];++ conference.setLocalParticipantProperty('raisedHand', raisedHand);+ }++ if (typeof APP === 'object') {+ if (local) {+ APP.UI.onLocalRaiseHandChanged(raisedHand);+ APP.UI.setLocalRaisedHandStatus(raisedHand);+ } else {+ const remoteParticipant = getParticipantById(getState(), id);++ remoteParticipant+ && APP.UI.setRaisedHandStatus(+ remoteParticipant.id,+ remoteParticipant.name,+ raisedHand);+ }+ }+ }++ // Notify external listeners of potential avatarURL changes.+ if (typeof APP === 'object') {+ const oldAvatarURL = getAvatarURLByParticipantId(getState(), id);++ // Allow the redux update to go through and compare the old avatar+ // to the new avatar and emit out change events if necessary.+ const result = next(action);+ const newAvatarURL = getAvatarURLByParticipantId(getState(), id);++ if (oldAvatarURL !== newAvatarURL) {+ const currentKnownId = local ? APP.conference.getMyUserId() : id;++ APP.UI.refreshAvatarDisplay(currentKnownId, newAvatarURL);+ APP.API.notifyAvatarChanged(currentKnownId, newAvatarURL);+ }++ return result;+ }++ return next(action);+}+/*** Registers sounds related with the participants feature.*- * @param {Store} store - The Redux store.+ * @param {Store} store - The redux store.* @private* @returns {void}*/function _registerSounds({ dispatch }) {dispatch(registerSound(PARTICIPANT_JOINED_SOUND_ID, PARTICIPANT_JOINED_FILE));- dispatch(- registerSound(PARTICIPANT_LEFT_SOUND_ID, PARTICIPANT_LEFT_FILE));+ dispatch(registerSound(PARTICIPANT_LEFT_SOUND_ID, PARTICIPANT_LEFT_FILE));}/*** Unregisters sounds related with the participants feature.*- * @param {Store} store - The Redux store.+ * @param {Store} store - The redux store.* @private* @returns {void}*/function _unregisterSounds({ dispatch }) {- dispatch(- unregisterSound(PARTICIPANT_JOINED_SOUND_ID));- dispatch(- unregisterSound(PARTICIPANT_LEFT_SOUND_ID));+ dispatch(unregisterSound(PARTICIPANT_JOINED_SOUND_ID));+ dispatch(unregisterSound(PARTICIPANT_LEFT_SOUND_ID));}