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
Simplify, comply w/ coding style
Lyubo Marinovbce161079457
diff --git a/react/features/base/conference/reducer.js b/react/features/base/conference/reducer.jsindex f4355f9cc2..51d7bb8902 100644--- a/react/features/base/conference/reducer.js+++ b/react/features/base/conference/reducer.js@@ -1,11 +1,7 @@import { LOCKED_LOCALLY, LOCKED_REMOTELY } from '../../room-lock';import { JitsiConferenceErrors } from '../lib-jitsi-meet';-import {- ReducerRegistry,- setStateProperties,- setStateProperty-} from '../redux';+import { assign, ReducerRegistry, set } from '../redux';import {CONFERENCE_FAILED,@@ -80,7 +76,7 @@ function _conferenceFailed(state, action) {: undefined;return (- setStateProperties(state, {+ assign(state, {audioOnly: undefined,audioOnlyVideoMuted: undefined,conference: undefined,@@ -125,7 +121,7 @@ function _conferenceJoined(state, action) {const locked = conference.room.locked ? LOCKED_REMOTELY : undefined;return (- setStateProperties(state, {+ assign(state, {/*** The JitsiConference instance represented by the Redux state of* the feature base/conference.@@ -163,7 +159,7 @@ function _conferenceLeft(state, action) {}return (- setStateProperties(state, {+ assign(state, {audioOnly: undefined,audioOnlyVideoMuted: undefined,conference: undefined,@@ -192,7 +188,7 @@ function _conferenceWillLeave(state, action) {}return (- setStateProperties(state, {+ assign(state, {/*** The JitsiConference instance which is currently in the process of* being left.@@ -225,7 +221,7 @@ function _lockStateChanged(state, action) {locked = state.locked || LOCKED_REMOTELY;}- return setStateProperties(state, {+ return assign(state, {locked,password: action.locked ? state.password : null});@@ -242,7 +238,7 @@ function _lockStateChanged(state, action) {* reduction of the specified action.*/function _setAudioOnly(state, action) {- return setStateProperty(state, 'audioOnly', action.audioOnly);+ return set(state, 'audioOnly', action.audioOnly);}/**@@ -257,7 +253,7 @@ function _setAudioOnly(state, action) {* reduction of the specified action.*/function _setAudioOnlyVideoMuted(state, action) {- return setStateProperty(state, 'audioOnlyVideoMuted', action.muted);+ return set(state, 'audioOnlyVideoMuted', action.muted);}/**@@ -276,7 +272,7 @@ function _setPassword(state, action) {case conference.join:if (state.passwordRequired === conference) {return (- setStateProperties(state, {+ assign(state, {locked: LOCKED_REMOTELY,/**@@ -291,7 +287,7 @@ function _setPassword(state, action) {break;case conference.lock:- return setStateProperties(state, {+ return assign(state, {locked: action.password ? LOCKED_LOCALLY : undefined,password: action.password});@@ -324,5 +320,5 @@ function _setRoom(state, action) {** @type {string}*/- return setStateProperty(state, 'room', room);+ return set(state, 'room', room);}diff --git a/react/features/base/connection/reducer.js b/react/features/base/connection/reducer.jsindex 49bb5925cf..405dd7ea88 100644--- a/react/features/base/connection/reducer.js+++ b/react/features/base/connection/reducer.js@@ -1,6 +1,6 @@/* @flow */-import { ReducerRegistry, setStateProperty } from '../redux';+import { ReducerRegistry, set } from '../redux';import {CONNECTION_DISCONNECTED,@@ -40,7 +40,7 @@ ReducerRegistry.register(*/function _connectionDisconnected(state: Object, action: Object) {if (state.connection === action.connection) {- return setStateProperty(state, 'connection', undefined);+ return set(state, 'connection', undefined);}return state;@@ -57,7 +57,7 @@ function _connectionDisconnected(state: Object, action: Object) {* reduction of the specified action.*/function _connectionEstablished(state: Object, action: Object) {- return setStateProperty(state, 'connection', action.connection);+ return set(state, 'connection', action.connection);}/**diff --git a/react/features/base/dialog/reducer.js b/react/features/base/dialog/reducer.jsindex b67ac6ee74..071ed44777 100644--- a/react/features/base/dialog/reducer.js+++ b/react/features/base/dialog/reducer.js@@ -1,27 +1,26 @@-import { ReducerRegistry, setStateProperties } from '../redux';+import { assign, ReducerRegistry } from '../redux';-import {- HIDE_DIALOG,- OPEN_DIALOG-} from './actionTypes';+import { HIDE_DIALOG, OPEN_DIALOG } from './actionTypes';/**- * Listen for actions which show or hide dialogs.+ * Reduces redux actions which show or hide dialogs.*- * @param {Object[]} state - Current state.- * @param {Object} action - Action object.- * @param {string} action.type - Type of action.- * @returns {{}}+ * @param {State} state - The current redux state.+ * @param {Action} action - The redux action to reduce.+ * @param {string} action.type - The type of the redux action to reduce..+ * @returns {State} The next redux state that is the result of reducing the+ * specified action.*/ReducerRegistry.register('features/base/dialog', (state = {}, action) => {switch (action.type) {case HIDE_DIALOG:- return setStateProperties(state, {+ return assign(state, {component: undefined,componentProps: undefined});+case OPEN_DIALOG:- return setStateProperties(state, {+ return assign(state, {component: action.component,componentProps: action.componentProps});diff --git a/react/features/base/lib-jitsi-meet/functions.js b/react/features/base/lib-jitsi-meet/functions.jsindex 8941d1d416..62e2bd7d55 100644--- a/react/features/base/lib-jitsi-meet/functions.js+++ b/react/features/base/lib-jitsi-meet/functions.js@@ -70,14 +70,14 @@ export function loadConfig(host: string, path: string = '/config.js') {* @returns {Promise<JitsiLocalTrack>}*/export function createLocalTrack(type, deviceId) {- return JitsiMeetJS- .createLocalTracks({- devices: [ type ],- micDeviceId: deviceId,- cameraDeviceId: deviceId,+ return JitsiMeetJS.createLocalTracks({+ cameraDeviceId: deviceId,+ devices: [ type ],- // eslint-disable-next-line camelcase- firefox_fake_device: window.config- && window.config.firefox_fake_device- }).then(([ jitsiLocalTrack ]) => jitsiLocalTrack);+ // eslint-disable-next-line camelcase+ firefox_fake_device:+ window.config && window.config.firefox_fake_device,+ micDeviceId: deviceId+ })+ .then(([ jitsiLocalTrack ]) => jitsiLocalTrack);}diff --git a/react/features/base/lib-jitsi-meet/middleware.js b/react/features/base/lib-jitsi-meet/middleware.jsindex 7acee29e3a..0b60ac041b 100644--- a/react/features/base/lib-jitsi-meet/middleware.js+++ b/react/features/base/lib-jitsi-meet/middleware.js@@ -12,8 +12,8 @@ import { WEBRTC_NOT_READY, WEBRTC_NOT_SUPPORTED } from './constants';* lib-jitsi-meet, and initializes a new one with new config.** @param {Store} store - Redux store.- * @returns {Function}* @private+ * @returns {Function}*/MiddlewareRegistry.register(store => next => action => {switch (action.type) {@@ -45,14 +45,14 @@ MiddlewareRegistry.register(store => next => action => {* specified action to the specified store.* @param {Action} action - The Redux action LIB_INIT_ERROR which is being* dispatched in the specified store.+ * @private* @returns {Object} The new state that is the result of the reduction of the* specified action.- * @private*/function _libInitError(store, next, action) {const nextState = next(action);- const error = action.error;+ const { error } = action;if (error) {let webRTCReady;@@ -83,16 +83,15 @@ function _libInitError(store, next, action) {* specified action to the specified store.* @param {Action} action - The Redux action SET_CONFIG which is being* dispatched in the specified store.+ * @private* @returns {Object} The new state that is the result of the reduction of the* specified action.- * @private*/-function _setConfig(store, next, action) {- const { dispatch, getState } = store;+function _setConfig({ dispatch, getState }, next, action) {const { initialized } = getState()['features/base/lib-jitsi-meet'];// XXX Since the config is changing, the library lib-jitsi-meet must be- // initialized again with the new config. Consequntly, it may need to be+ // initialized again with the new config. Consequently, it may need to be// disposed of first.// TODO Currently, disposeLib actually does not dispose of lib-jitsi-meet// because lib-jitsi-meet does not implement such functionality.diff --git a/react/features/base/participants/reducer.js b/react/features/base/participants/reducer.jsindex 0e3526ca88..4a08577722 100644--- a/react/features/base/participants/reducer.js+++ b/react/features/base/participants/reducer.js@@ -1,4 +1,4 @@-import { ReducerRegistry, setStateProperty } from '../redux';+import { ReducerRegistry, set } from '../redux';import { randomHexString } from '../util';import {@@ -55,10 +55,7 @@ function _participant(state, action) {case DOMINANT_SPEAKER_CHANGED:// Only one dominant speaker is allowed.return (- setStateProperty(- state,- 'dominantSpeaker',- state.id === action.participant.id));+ set(state, 'dominantSpeaker', state.id === action.participant.id));case PARTICIPANT_ID_CHANGED:if (state.id === action.oldValue) {@@ -145,11 +142,7 @@ function _participant(state, action) {case PIN_PARTICIPANT:// Currently, only one pinned participant is allowed.- return (- setStateProperty(- state,- 'pinned',- state.id === action.participant.id));+ return set(state, 'pinned', state.id === action.participant.id);}return state;diff --git a/react/features/base/redux/functions.js b/react/features/base/redux/functions.jsindex 9198e37b8d..99aa182ac9 100644--- a/react/features/base/redux/functions.js+++ b/react/features/base/redux/functions.js@@ -11,11 +11,11 @@* from the specified target by setting the specified properties to the* specified values.*/-export function setStateProperties(target, source) {+export function assign(target, source) {let t = target;for (const property in source) { // eslint-disable-line guard-for-in- t = setStateProperty(t, property, source[property], t === target);+ t = set(t, property, source[property], t === target);}return t;@@ -37,8 +37,8 @@ export function setStateProperties(target, source) {* constructed from the specified <tt>state</tt> by setting the specified* <tt>property</tt> to the specified <tt>value</tt>.*/-export function setStateProperty(state, property, value) {- return _setStateProperty(state, property, value, /* copyOnWrite */ true);+export function set(state, property, value) {+ return _set(state, property, value, /* copyOnWrite */ true);}/* eslint-disable max-params */@@ -62,7 +62,7 @@ export function setStateProperty(state, property, value) {* <tt>state</tt> by setting the specified <tt>property</tt> to the specified* <tt>value</tt>.*/-function _setStateProperty(state, property, value, copyOnWrite) {+function _set(state, property, value, copyOnWrite) {// Delete state properties that are to be set to undefined. (It is a matter// of personal preference, mostly.)if (typeof value === 'undefined'diff --git a/react/features/overlay/reducer.js b/react/features/overlay/reducer.jsindex 987276f9dd..6666d3deb0 100644--- a/react/features/overlay/reducer.js+++ b/react/features/overlay/reducer.js@@ -1,18 +1,11 @@import { CONFERENCE_FAILED } from '../base/conference';-import {- CONNECTION_ESTABLISHED,- CONNECTION_FAILED-} from '../base/connection';+import { CONNECTION_ESTABLISHED, CONNECTION_FAILED } from '../base/connection';import {isFatalJitsiConnectionError,JitsiConferenceErrors,JitsiConnectionErrors} from '../base/lib-jitsi-meet';-import {- ReducerRegistry,- setStateProperties,- setStateProperty-} from '../base/redux';+import { assign, ReducerRegistry, set } from '../base/redux';import {MEDIA_PERMISSION_PROMPT_VISIBILITY_CHANGED,@@ -59,7 +52,7 @@ function _conferenceFailed(state, action) {if (error === JitsiConferenceErrors.FOCUS_LEFT|| error === JitsiConferenceErrors.VIDEOBRIDGE_NOT_AVAILABLE) {- return setStateProperties(state, {+ return assign(state, {haveToReload: true,isNetworkFailure: false,reason: action.errorMessage@@ -79,7 +72,7 @@ function _conferenceFailed(state, action) {* @private*/function _connectionEstablished(state) {- return setStateProperty(state, 'connectionEstablished', true);+ return set(state, 'connectionEstablished', true);}/**@@ -99,10 +92,9 @@ function _connectionFailed(state, action) {logger.error(`XMPP connection error: ${errorMessage}`);- return setStateProperties(state, {+ return assign(state, {haveToReload: true,-// From all of the cases above only CONNECTION_DROPPED_ERROR is// considered a network type of failure.isNetworkFailure:@@ -125,7 +117,7 @@ function _connectionFailed(state, action) {* @private*/function _mediaPermissionPromptVisibilityChanged(state, action) {- return setStateProperties(state, {+ return assign(state, {browser: action.browser,isMediaPermissionPromptVisible: action.isVisible});@@ -140,5 +132,5 @@ function _mediaPermissionPromptVisibilityChanged(state, action) {* @private*/function _suspendDetected(state) {- return setStateProperty(state, 'suspendDetected', true);+ return set(state, 'suspendDetected', true);}