diff --git a/react/features/audio-mode/middleware.js b/react/features/audio-mode/middleware.js index 716185623..bce9efe58 100644 --- a/react/features/audio-mode/middleware.js +++ b/react/features/audio-mode/middleware.js @@ -22,19 +22,19 @@ MiddlewareRegistry.register(store => next => action => { // The react-native module AudioMode is implemented on iOS at the time of // this writing. if (AudioMode) { - let audioMode; + let mode; switch (action.type) { case APP_WILL_MOUNT: case CONFERENCE_FAILED: case CONFERENCE_LEFT: - audioMode = AudioMode.DEFAULT; + mode = AudioMode.DEFAULT; break; case CONFERENCE_WILL_JOIN: { const conference = store.getState()['features/base/conference']; - audioMode + mode = conference.audioOnly ? AudioMode.AUDIO_CALL : AudioMode.VIDEO_CALL; @@ -42,14 +42,14 @@ MiddlewareRegistry.register(store => next => action => { } default: - audioMode = null; + mode = null; break; } - if (audioMode !== null) { - AudioMode.setMode(audioMode).catch(err => { - console.error(`Failed to set audio mode ${audioMode}: ${err}`); - }); + if (mode !== null) { + AudioMode.setMode(mode) + .catch(err => + console.error(`Failed to set audio mode ${mode}: ${err}`)); } } diff --git a/react/features/base/lib-jitsi-meet/native/RTCPeerConnection.js b/react/features/base/lib-jitsi-meet/native/RTCPeerConnection.js index 5fd450fef..2c5aa7969 100644 --- a/react/features/base/lib-jitsi-meet/native/RTCPeerConnection.js +++ b/react/features/base/lib-jitsi-meet/native/RTCPeerConnection.js @@ -106,6 +106,7 @@ _RTCPeerConnection.prototype.setRemoteDescription = function( /** * Logs at error level. * + * @private * @returns {void} */ function _LOGE(...args) { @@ -119,6 +120,8 @@ function _LOGE(...args) { * * @param {RTCSessionDescription} sessionDescription - The RTCSessionDescription * which specifies the configuration of the remote end of the connection. + * @private + * @private * @returns {Promise} */ function _setRemoteDescription(sessionDescription) { @@ -160,6 +163,7 @@ function _setRemoteDescription(sessionDescription) { * * @param {RTCSessionDescription} sdp - The RTCSessionDescription which * specifies the configuration of the remote end of the connection. + * @private * @returns {Promise} */ function _synthesizeIPv6Addresses(sdp) { @@ -184,6 +188,7 @@ function _synthesizeIPv6Addresses(sdp) { * * @param {RTCSessionDescription} sessionDescription - The RTCSessionDescription * for which IPv6 addresses will be synthesized. + * @private * @returns {{ * ips: Map, * lines: Array @@ -278,6 +283,7 @@ function _synthesizeIPv6Addresses0(sessionDescription) { * @param {Map} ips - A Map of IPv4 addresses found in the specified * sessionDescription to synthesized IPv6 addresses. * @param {Array} lines - The lines of the specified sessionDescription. + * @private * @returns {RTCSessionDescription} A RTCSessionDescription that represents the * result of the synthesis of IPv6 addresses. */ diff --git a/react/features/base/media/components/native/VideoTrack.js b/react/features/base/media/components/native/VideoTrack.js index bdad9f1e4..444b9d053 100644 --- a/react/features/base/media/components/native/VideoTrack.js +++ b/react/features/base/media/components/native/VideoTrack.js @@ -140,9 +140,10 @@ class VideoTrack extends AbstractVideoTrack { // eslint-disable-next-line valid-jsdoc /** - * @inheritdoc - * * Animate the setting of the video track to be rendered by this instance. + * + * @inheritdoc + * @protected */ _setVideoTrack(videoTrack) { // If JitsiTrack instance didn't change, that means some other track's diff --git a/react/features/base/media/middleware.js b/react/features/base/media/middleware.js index b8c8e6cd6..31da9e2b7 100644 --- a/react/features/base/media/middleware.js +++ b/react/features/base/media/middleware.js @@ -21,11 +21,11 @@ MiddlewareRegistry.register(store => next => action => { switch (action.type) { case CONFERENCE_LEFT: - resetInitialMediaState(store); + _resetInitialMediaState(store); break; case TRACK_ADDED: - action.track.local && syncTrackMutedState(store, action.track); + action.track.local && _syncTrackMutedState(store, action.track); break; } @@ -36,9 +36,10 @@ MiddlewareRegistry.register(store => next => action => { * Resets initial media state. * * @param {Store} store - Redux store. + * @private * @returns {void} */ -function resetInitialMediaState(store) { +function _resetInitialMediaState(store) { const { dispatch, getState } = store; const state = getState()['features/base/media']; @@ -53,9 +54,10 @@ function resetInitialMediaState(store) { * * @param {Store} store - Redux store. * @param {Track} track - Local media track. + * @private * @returns {void} */ -function syncTrackMutedState(store, track) { +function _syncTrackMutedState(store, track) { const state = store.getState()['features/base/media']; const muted = state[track.mediaType].muted; diff --git a/react/features/base/media/reducer.js b/react/features/base/media/reducer.js index 5d0f8dd12..f9d52fd8d 100644 --- a/react/features/base/media/reducer.js +++ b/react/features/base/media/reducer.js @@ -31,9 +31,10 @@ const AUDIO_INITIAL_MEDIA_STATE = { * @param {AudioMediaState} state - Media state of local audio. * @param {Object} action - Action object. * @param {string} action.type - Type of action. + * @private * @returns {AudioMediaState} */ -function audio(state = AUDIO_INITIAL_MEDIA_STATE, action) { +function _audio(state = AUDIO_INITIAL_MEDIA_STATE, action) { switch (action.type) { case SET_AUDIO_MUTED: return { @@ -70,9 +71,10 @@ const VIDEO_INITIAL_MEDIA_STATE = { * @param {VideoMediaState} state - Media state of local video. * @param {Object} action - Action object. * @param {string} action.type - Type of action. + * @private * @returns {VideoMediaState} */ -function video(state = VIDEO_INITIAL_MEDIA_STATE, action) { +function _video(state = VIDEO_INITIAL_MEDIA_STATE, action) { switch (action.type) { case SET_CAMERA_FACING_MODE: return { @@ -102,6 +104,6 @@ function video(state = VIDEO_INITIAL_MEDIA_STATE, action) { * @returns {Object} */ ReducerRegistry.register('features/base/media', combineReducers({ - audio, - video + audio: _audio, + video: _video })); diff --git a/react/features/base/navigator/RouteRegistry.js b/react/features/base/navigator/RouteRegistry.js index 0374ed0a4..f4e6d0939 100644 --- a/react/features/base/navigator/RouteRegistry.js +++ b/react/features/base/navigator/RouteRegistry.js @@ -20,7 +20,7 @@ class RouteRegistry { * * @private */ - this._routeRegistry = new Set(); + this._elements = new Set(); } /** @@ -57,7 +57,7 @@ class RouteRegistry { // We use the destructuring operator to 'clone' the route object to // prevent modifications from outside (e.g. React Native's Navigator // extends it with additional properties). - return [ ...this._routeRegistry ].map(r => { + return [ ...this._elements ].map(r => { return { ...r }; }); } @@ -71,7 +71,7 @@ class RouteRegistry { */ getRouteByComponent(component) { const route - = [ ...this._routeRegistry ].find(r => r.component === component); + = [ ...this._elements ].find(r => r.component === component); // We use destructuring operator to 'clone' route object to prevent // modifications from outside (e.g. React Native's Navigator extends @@ -86,11 +86,11 @@ class RouteRegistry { * @returns {void} */ register(route) { - if (this._routeRegistry.has(route)) { + if (this._elements.has(route)) { throw new Error(`Route ${route.component} is registered already!`); } - this._routeRegistry.add(route); + this._elements.add(route); } } diff --git a/react/features/base/participants/reducer.js b/react/features/base/participants/reducer.js index efb6be753..beca0eaf5 100644 --- a/react/features/base/participants/reducer.js +++ b/react/features/base/participants/reducer.js @@ -48,9 +48,10 @@ const PARTICIPANT_PROPS_TO_OMIT_WHEN_UPDATE * @param {Participant} action.participant - Information about participant to be * added/modified. * @param {JitsiConference} action.conference - Conference instance. + * @private * @returns {Participant|undefined} */ -function participant(state, action) { +function _participant(state, action) { switch (action.type) { case DOMINANT_SPEAKER_CHANGED: // Only one dominant speaker is allowed. @@ -146,7 +147,7 @@ function participant(state, action) { ReducerRegistry.register('features/base/participants', (state = [], action) => { switch (action.type) { case PARTICIPANT_JOINED: - return [ ...state, participant(undefined, action) ]; + return [ ...state, _participant(undefined, action) ]; case PARTICIPANT_LEFT: return state.filter(p => p.id !== action.participant.id); @@ -155,7 +156,7 @@ ReducerRegistry.register('features/base/participants', (state = [], action) => { case PARTICIPANT_ID_CHANGED: case PARTICIPANT_UPDATED: case PIN_PARTICIPANT: - return state.map(p => participant(p, action)); + return state.map(p => _participant(p, action)); default: return state; diff --git a/react/features/base/redux/MiddlewareRegistry.js b/react/features/base/redux/MiddlewareRegistry.js index c38ce4bca..5cfdd44e5 100644 --- a/react/features/base/redux/MiddlewareRegistry.js +++ b/react/features/base/redux/MiddlewareRegistry.js @@ -12,7 +12,7 @@ class MiddlewareRegistry { /** * The set of registered middleware. */ - this.middlewareRegistry = new Set(); + this._elements = new Set(); } /** @@ -25,7 +25,7 @@ class MiddlewareRegistry { */ applyMiddleware(...additional) { return applyMiddleware( - ...this.middlewareRegistry, + ...this._elements, ...additional ); } @@ -39,7 +39,7 @@ class MiddlewareRegistry { * @returns {void} */ register(middleware) { - this.middlewareRegistry.add(middleware); + this._elements.add(middleware); } } diff --git a/react/features/base/redux/ReducerRegistry.js b/react/features/base/redux/ReducerRegistry.js index 0f474c5d9..4e9563cf7 100644 --- a/react/features/base/redux/ReducerRegistry.js +++ b/react/features/base/redux/ReducerRegistry.js @@ -13,7 +13,7 @@ class ReducerRegistry { * The set of registered reducers, keyed based on the field each reducer * will manage. */ - this.reducerRegistry = {}; + this._elements = {}; } /** @@ -25,7 +25,7 @@ class ReducerRegistry { */ combineReducers(additional = {}) { return combineReducers({ - ...this.reducerRegistry, + ...this._elements, ...additional }); } @@ -41,7 +41,7 @@ class ReducerRegistry { * @returns {void} */ register(name, reducer) { - this.reducerRegistry[name] = reducer; + this._elements[name] = reducer; } } diff --git a/react/features/base/tracks/actions.js b/react/features/base/tracks/actions.js index 747b5d3c0..93a9b7bc3 100644 --- a/react/features/base/tracks/actions.js +++ b/react/features/base/tracks/actions.js @@ -53,39 +53,6 @@ export function destroyLocalTracks() { .map(t => t.jitsiTrack))); } -/** - * Returns true if the provided JitsiTrack should be rendered as a mirror. - * - * We only want to show a video in mirrored mode when: - * 1) The video source is local, and not remote. - * 2) The video source is a camera, not a desktop (capture). - * 3) The camera is capturing the user, not the environment. - * - * TODO Similar functionality is part of lib-jitsi-meet. This function should be - * removed after https://github.com/jitsi/lib-jitsi-meet/pull/187 is merged. - * - * @param {(JitsiLocalTrack|JitsiRemoteTrack)} track - JitsiTrack instance. - * @private - * @returns {boolean} - */ -function _shouldMirror(track) { - return ( - track - && track.isLocal() - && track.isVideoTrack() - - // XXX Type of the return value of - // JitsiLocalTrack#getCameraFacingMode() happens to be named - // CAMERA_FACING_MODE as well, it's defined by lib-jitsi-meet. Note - // though that the type of the value on the right side of the - // equality check is defined by jitsi-meet-react. The type - // definitions are surely compatible today but that may not be the - // case tomorrow. - && track.getCameraFacingMode() === CAMERA_FACING_MODE.USER - && !track.isScreenSharing() - ); -} - /** * Create an action for when a new track has been signaled to be added to the * conference. @@ -240,6 +207,7 @@ function _disposeAndRemoveTracks(tracks) { * through. * @param {MEDIA_TYPE} mediaType - The MEDIA_TYPE of the first * JitsiLocalTrack to be returned. + * @private * @returns {JitsiLocalTrack} The first JitsiLocalTrack, if any, in the * specified tracks of the specified mediaType. */ @@ -287,12 +255,46 @@ function _getLocalTracksToChange(currentTracks, newTracks) { }; } +/** + * Returns true if the provided JitsiTrack should be rendered as a mirror. + * + * We only want to show a video in mirrored mode when: + * 1) The video source is local, and not remote. + * 2) The video source is a camera, not a desktop (capture). + * 3) The camera is capturing the user, not the environment. + * + * TODO Similar functionality is part of lib-jitsi-meet. This function should be + * removed after https://github.com/jitsi/lib-jitsi-meet/pull/187 is merged. + * + * @param {(JitsiLocalTrack|JitsiRemoteTrack)} track - JitsiTrack instance. + * @private + * @returns {boolean} + */ +function _shouldMirror(track) { + return ( + track + && track.isLocal() + && track.isVideoTrack() + + // XXX Type of the return value of + // JitsiLocalTrack#getCameraFacingMode() happens to be named + // CAMERA_FACING_MODE as well, it's defined by lib-jitsi-meet. Note + // though that the type of the value on the right side of the + // equality check is defined by jitsi-meet-react. The type + // definitions are surely compatible today but that may not be the + // case tomorrow. + && track.getCameraFacingMode() === CAMERA_FACING_MODE.USER + && !track.isScreenSharing() + ); +} + /** * Set new local tracks replacing any existing tracks that were previously * available. Currently only one audio and one video local tracks are allowed. * * @param {(JitsiLocalTrack|JitsiRemoteTrack)[]} [newTracks=[]] - List of new * media tracks. + * @private * @returns {Function} */ function _updateLocalTracks(newTracks = []) { diff --git a/react/features/film-strip/components/Thumbnail.js b/react/features/film-strip/components/Thumbnail.js index eab1d00c7..3728908e2 100644 --- a/react/features/film-strip/components/Thumbnail.js +++ b/react/features/film-strip/components/Thumbnail.js @@ -45,18 +45,6 @@ class Thumbnail extends Component { this._onClick = this._onClick.bind(this); } - /** - * Handles click/tap event on the thumbnail. - * - * @returns {void} - */ - _onClick() { - const { dispatch, participant } = this.props; - - // TODO The following currently ignores interfaceConfig.filmStripOnly. - dispatch(pinParticipant(participant.pinned ? null : participant.id)); - } - /** * Implements React's {@link Component#render()}. * @@ -126,6 +114,18 @@ class Thumbnail extends Component { ); } + + /** + * Handles click/tap event on the thumbnail. + * + * @returns {void} + */ + _onClick() { + const { dispatch, participant } = this.props; + + // TODO The following currently ignores interfaceConfig.filmStripOnly. + dispatch(pinParticipant(participant.pinned ? null : participant.id)); + } } /** diff --git a/react/features/wake-lock/middleware.js b/react/features/wake-lock/middleware.js index 50642cc58..cb8750258 100644 --- a/react/features/wake-lock/middleware.js +++ b/react/features/wake-lock/middleware.js @@ -22,14 +22,14 @@ MiddlewareRegistry.register(store => next => action => { // TODO(saghul): Implement audio-only mode. if (!state.audioOnly) { - setWakeLock(true); + _setWakeLock(true); } break; } case CONFERENCE_FAILED: case CONFERENCE_LEFT: - setWakeLock(false); + _setWakeLock(false); break; } @@ -42,9 +42,10 @@ MiddlewareRegistry.register(store => next => action => { * * @param {boolean} wakeLock - True to active the wake lock or false to * deactivate it. + * @private * @returns {void} */ -function setWakeLock(wakeLock) { +function _setWakeLock(wakeLock) { if (wakeLock) { KeepAwake.activate(); } else {