Coding style: commends, formatting, sorting order
This commit is contained in:
parent
9650404099
commit
22ce001f14
|
@ -53,15 +53,15 @@ declare var APP: Object;
|
||||||
*/
|
*/
|
||||||
MiddlewareRegistry.register(store => next => action => {
|
MiddlewareRegistry.register(store => next => action => {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case CONNECTION_ESTABLISHED:
|
|
||||||
return _connectionEstablished(store, next, action);
|
|
||||||
|
|
||||||
case CONFERENCE_FAILED:
|
case CONFERENCE_FAILED:
|
||||||
return _conferenceFailed(next, action);
|
return _conferenceFailed(store, next, action);
|
||||||
|
|
||||||
case CONFERENCE_JOINED:
|
case CONFERENCE_JOINED:
|
||||||
return _conferenceJoined(store, next, action);
|
return _conferenceJoined(store, next, action);
|
||||||
|
|
||||||
|
case CONNECTION_ESTABLISHED:
|
||||||
|
return _connectionEstablished(store, next, action);
|
||||||
|
|
||||||
case DATA_CHANNEL_OPENED:
|
case DATA_CHANNEL_OPENED:
|
||||||
return _syncReceiveVideoQuality(store, next, action);
|
return _syncReceiveVideoQuality(store, next, action);
|
||||||
|
|
||||||
|
@ -88,53 +88,31 @@ MiddlewareRegistry.register(store => next => action => {
|
||||||
return next(action);
|
return next(action);
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
|
||||||
* Notifies the feature base/conference that the action CONNECTION_ESTABLISHED
|
|
||||||
* is being dispatched within a specific redux store.
|
|
||||||
*
|
|
||||||
* @param {Store} store - The redux store in which the specified action is being
|
|
||||||
* dispatched.
|
|
||||||
* @param {Dispatch} next - The redux dispatch function to dispatch the
|
|
||||||
* specified action to the specified store.
|
|
||||||
* @param {Action} action - The redux action CONNECTION_ESTABLISHED which is
|
|
||||||
* being dispatched in the specified store.
|
|
||||||
* @private
|
|
||||||
* @returns {Object} The value returned by {@code next(action)}.
|
|
||||||
*/
|
|
||||||
function _connectionEstablished({ dispatch }, next, action) {
|
|
||||||
const result = next(action);
|
|
||||||
|
|
||||||
// FIXME: workaround for the web version. Currently the creation of the
|
|
||||||
// conference is handled by /conference.js
|
|
||||||
if (typeof APP === 'undefined') {
|
|
||||||
dispatch(createConference());
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Makes sure to leave a failed conference in order to release any allocated
|
* Makes sure to leave a failed conference in order to release any allocated
|
||||||
* resources like peerconnections, emit participant left events etc.
|
* resources like peer connections, emit participant left events, etc.
|
||||||
*
|
*
|
||||||
* @param {Dispatch} next - The redux dispatch function to dispatch the
|
* @param {Store} store - The redux store in which the specified {@code action}
|
||||||
* specified action to the specified store.
|
* is being dispatched.
|
||||||
* @param {Action} action - The redux action CONFERENCE_FAILED which is being
|
* @param {Dispatch} next - The redux {@code dispatch} function to dispatch the
|
||||||
* dispatched in the specified store.
|
* specified {@code action} to the specified {@code store}.
|
||||||
|
* @param {Action} action - The redux action {@code CONFERENCE_FAILED} which is
|
||||||
|
* being dispatched in the specified {@code store}.
|
||||||
* @private
|
* @private
|
||||||
* @returns {Object} The value returned by {@code next(action)}.
|
* @returns {Object} The value returned by {@code next(action)}.
|
||||||
*/
|
*/
|
||||||
function _conferenceFailed(next, action) {
|
function _conferenceFailed(store, next, action) {
|
||||||
const result = next(action);
|
const result = next(action);
|
||||||
|
|
||||||
|
// XXX After next(action), it is clear whether the error is recoverable.
|
||||||
const { conference, error } = action;
|
const { conference, error } = action;
|
||||||
|
|
||||||
!error.recoverable
|
!error.recoverable
|
||||||
&& conference
|
&& conference
|
||||||
&& conference.leave().catch(leaveError => {
|
&& conference.leave().catch(reason => {
|
||||||
// Even though we don't care too much about the failure it may be
|
// Even though we don't care too much about the failure, it may be
|
||||||
// good to now that it happen, so log it on the info level.
|
// good to know that it happen, so log it (on the info level).
|
||||||
logger.info(
|
logger.info('JitsiConference.leave() rejected with:', reason);
|
||||||
'There was an error leaving a failed conference: ', leaveError);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -144,12 +122,12 @@ function _conferenceFailed(next, action) {
|
||||||
* Does extra sync up on properties that may need to be updated after the
|
* Does extra sync up on properties that may need to be updated after the
|
||||||
* conference was joined.
|
* conference was joined.
|
||||||
*
|
*
|
||||||
* @param {Store} store - The redux store in which the specified action is being
|
* @param {Store} store - The redux store in which the specified {@code action}
|
||||||
* dispatched.
|
* is being dispatched.
|
||||||
* @param {Dispatch} next - The redux dispatch function to dispatch the
|
* @param {Dispatch} next - The redux {@code dispatch} function to dispatch the
|
||||||
* specified action to the specified store.
|
* specified {@code action} to the specified {@code store}.
|
||||||
* @param {Action} action - The redux action CONFERENCE_JOINED which is being
|
* @param {Action} action - The redux action {@code CONFERENCE_JOINED} which is
|
||||||
* dispatched in the specified store.
|
* being dispatched in the specified {@code store}.
|
||||||
* @private
|
* @private
|
||||||
* @returns {Object} The value returned by {@code next(action)}.
|
* @returns {Object} The value returned by {@code next(action)}.
|
||||||
*/
|
*/
|
||||||
|
@ -161,22 +139,46 @@ function _conferenceJoined({ dispatch, getState }, next, action) {
|
||||||
// FIXME On Web the audio only mode for "start audio only" is toggled before
|
// FIXME On Web the audio only mode for "start audio only" is toggled before
|
||||||
// conference is added to the redux store ("on conference joined" action)
|
// conference is added to the redux store ("on conference joined" action)
|
||||||
// and the LastN value needs to be synchronized here.
|
// and the LastN value needs to be synchronized here.
|
||||||
audioOnly && (conference.getLastN() !== 0) && dispatch(setLastN(0));
|
audioOnly && conference.getLastN() !== 0 && dispatch(setLastN(0));
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notifies the feature base/conference that the action PIN_PARTICIPANT is being
|
* Notifies the feature base/conference that the action
|
||||||
* dispatched within a specific redux store. Pins the specified remote
|
* {@code CONNECTION_ESTABLISHED} 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} to the specified {@code store}.
|
||||||
|
* @param {Action} action - The redux action {@code CONNECTION_ESTABLISHED}
|
||||||
|
* which is being dispatched in the specified {@code store}.
|
||||||
|
* @private
|
||||||
|
* @returns {Object} The value returned by {@code next(action)}.
|
||||||
|
*/
|
||||||
|
function _connectionEstablished({ dispatch }, next, action) {
|
||||||
|
const result = next(action);
|
||||||
|
|
||||||
|
// FIXME: Workaround for the web version. Currently, the creation of the
|
||||||
|
// conference is handled by /conference.js.
|
||||||
|
typeof APP === 'undefined' && dispatch(createConference());
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notifies the feature base/conference that the action {@code PIN_PARTICIPANT}
|
||||||
|
* is being dispatched within a specific redux store. Pins the specified remote
|
||||||
* participant in the associated conference, ignores the local participant.
|
* participant in the associated conference, ignores the local participant.
|
||||||
*
|
*
|
||||||
* @param {Store} store - The redux store in which the specified action is being
|
* @param {Store} store - The redux store in which the specified {@code action}
|
||||||
* dispatched.
|
* is being dispatched.
|
||||||
* @param {Dispatch} next - The redux dispatch function to dispatch the
|
* @param {Dispatch} next - The redux {@code dispatch} function to dispatch the
|
||||||
* specified action to the specified store.
|
* specified {@code action} to the specified {@code store}.
|
||||||
* @param {Action} action - The redux action PIN_PARTICIPANT which is being
|
* @param {Action} action - The redux action {@code PIN_PARTICIPANT} which is
|
||||||
* dispatched in the specified store.
|
* being dispatched in the specified {@code store}.
|
||||||
* @private
|
* @private
|
||||||
* @returns {Object} The value returned by {@code next(action)}.
|
* @returns {Object} The value returned by {@code next(action)}.
|
||||||
*/
|
*/
|
||||||
|
@ -239,12 +241,12 @@ function _pinParticipant({ getState }, next, action) {
|
||||||
* Sets the audio-only flag for the current conference. When audio-only is set,
|
* Sets the audio-only flag for the current conference. When audio-only is set,
|
||||||
* local video is muted and last N is set to 0 to avoid receiving remote video.
|
* local video is muted and last N is set to 0 to avoid receiving remote video.
|
||||||
*
|
*
|
||||||
* @param {Store} store - The redux store in which the specified action is being
|
* @param {Store} store - The redux store in which the specified {@code action}
|
||||||
* dispatched.
|
* is being dispatched.
|
||||||
* @param {Dispatch} next - The redux dispatch function to dispatch the
|
* @param {Dispatch} next - The redux {@code dispatch} function to dispatch the
|
||||||
* specified action to the specified store.
|
* specified {@code action} to the specified {@code store}.
|
||||||
* @param {Action} action - The redux action SET_AUDIO_ONLY which is being
|
* @param {Action} action - The redux action {@code SET_AUDIO_ONLY} which is
|
||||||
* dispatched in the specified store.
|
* being dispatched in the specified {@code store}.
|
||||||
* @private
|
* @private
|
||||||
* @returns {Object} The value returned by {@code next(action)}.
|
* @returns {Object} The value returned by {@code next(action)}.
|
||||||
*/
|
*/
|
||||||
|
@ -274,8 +276,8 @@ function _setAudioOnly({ dispatch, getState }, next, action) {
|
||||||
/* ensureTrack */ true));
|
/* ensureTrack */ true));
|
||||||
|
|
||||||
if (typeof APP !== 'undefined') {
|
if (typeof APP !== 'undefined') {
|
||||||
// TODO This should be a temporary solution that lasts only until
|
// TODO This should be a temporary solution that lasts only until video
|
||||||
// video tracks and all ui is moved into react/redux on the web.
|
// tracks and all ui is moved into react/redux on the web.
|
||||||
APP.UI.emitEvent(UIEvents.TOGGLE_AUDIO_ONLY, newValue);
|
APP.UI.emitEvent(UIEvents.TOGGLE_AUDIO_ONLY, newValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -285,12 +287,12 @@ function _setAudioOnly({ dispatch, getState }, next, action) {
|
||||||
/**
|
/**
|
||||||
* Sets the last N (value) of the video channel in the conference.
|
* Sets the last N (value) of the video channel in the conference.
|
||||||
*
|
*
|
||||||
* @param {Store} store - The redux store in which the specified action is being
|
* @param {Store} store - The redux store in which the specified {@code action}
|
||||||
* dispatched.
|
* is being dispatched.
|
||||||
* @param {Dispatch} next - The redux dispatch function to dispatch the
|
* @param {Dispatch} next - The redux {@code dispatch} function to dispatch the
|
||||||
* specified action to the specified store.
|
* specified {@code action} to the specified {@code store}.
|
||||||
* @param {Action} action - The redux action SET_LASTN which is being dispatched
|
* @param {Action} action - The redux action {@code SET_LASTN} which is being
|
||||||
* in the specified store.
|
* dispatched in the specified {@code store}.
|
||||||
* @private
|
* @private
|
||||||
* @returns {Object} The value returned by {@code next(action)}.
|
* @returns {Object} The value returned by {@code next(action)}.
|
||||||
*/
|
*/
|
||||||
|
@ -312,12 +314,12 @@ function _setLastN({ getState }, next, action) {
|
||||||
* Sets the maximum receive video quality and will turn off audio only mode if
|
* Sets the maximum receive video quality and will turn off audio only mode if
|
||||||
* enabled.
|
* enabled.
|
||||||
*
|
*
|
||||||
* @param {Store} store - The redux store in which the specified action is being
|
* @param {Store} store - The redux store in which the specified {@code action}
|
||||||
* dispatched.
|
* is being dispatched.
|
||||||
* @param {Dispatch} next - The redux dispatch function to dispatch the
|
* @param {Dispatch} next - The redux {@code dispatch} function to dispatch the
|
||||||
* specified action to the specified store.
|
* specified {@code action} to the specified {@code store}.
|
||||||
* @param {Action} action - The redux action SET_RECEIVE_VIDEO_QUALITY which is
|
* @param {Action} action - The redux action {@code SET_RECEIVE_VIDEO_QUALITY}
|
||||||
* being dispatched in the specified store.
|
* which is being dispatched in the specified {@code store}.
|
||||||
* @private
|
* @private
|
||||||
* @returns {Object} The value returned by {@code next(action)}.
|
* @returns {Object} The value returned by {@code next(action)}.
|
||||||
*/
|
*/
|
||||||
|
@ -336,12 +338,12 @@ function _setReceiveVideoQuality({ dispatch, getState }, next, action) {
|
||||||
* Notifies the feature {@code base/conference} that the redix action
|
* Notifies the feature {@code base/conference} that the redix action
|
||||||
* {@link SET_ROOM} is being dispatched within a specific redux store.
|
* {@link SET_ROOM} is being dispatched within a specific redux store.
|
||||||
*
|
*
|
||||||
* @param {Store} store - The redux store in which the specified action is being
|
* @param {Store} store - The redux store in which the specified {@code action}
|
||||||
* dispatched.
|
* is being dispatched.
|
||||||
* @param {Dispatch} next - The redux dispatch function to dispatch the
|
* @param {Dispatch} next - The redux {@code dispatch} function to dispatch the
|
||||||
* specified action to the specified store.
|
* specified {@code action} to the specified {@code store}.
|
||||||
* @param {Action} action - The redux action {@code SET_ROOM} which is being
|
* @param {Action} action - The redux action {@code SET_ROOM} which is being
|
||||||
* dispatched in the specified store.
|
* dispatched in the specified {@code store}.
|
||||||
* @private
|
* @private
|
||||||
* @returns {Object} The value returned by {@code next(action)}.
|
* @returns {Object} The value returned by {@code next(action)}.
|
||||||
*/
|
*/
|
||||||
|
@ -420,12 +422,12 @@ function _syncConferenceLocalTracksWithState({ getState }, action) {
|
||||||
/**
|
/**
|
||||||
* Sets the maximum receive video quality.
|
* Sets the maximum receive video quality.
|
||||||
*
|
*
|
||||||
* @param {Store} store - The redux store in which the specified action is being
|
* @param {Store} store - The redux store in which the specified {@code action}
|
||||||
* dispatched.
|
* is being dispatched.
|
||||||
* @param {Dispatch} next - The redux dispatch function to dispatch the
|
* @param {Dispatch} next - The redux {@code dispatch} function to dispatch the
|
||||||
* specified action to the specified store.
|
* specified {@code action} to the specified {@code store}.
|
||||||
* @param {Action} action - The redux action DATA_CHANNEL_STATUS_CHANGED which
|
* @param {Action} action - The redux action {@code DATA_CHANNEL_STATUS_CHANGED}
|
||||||
* is being dispatched in the specified store.
|
* which is being dispatched in the specified {@code store}.
|
||||||
* @private
|
* @private
|
||||||
* @returns {Object} The value returned by {@code next(action)}.
|
* @returns {Object} The value returned by {@code next(action)}.
|
||||||
*/
|
*/
|
||||||
|
@ -438,15 +440,16 @@ function _syncReceiveVideoQuality({ getState }, next, action) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notifies the feature base/conference that the action TRACK_ADDED
|
* Notifies the feature base/conference that the action {@code TRACK_ADDED}
|
||||||
* or TRACK_REMOVED is being dispatched within a specific redux store.
|
* or {@code TRACK_REMOVED} is being dispatched within a specific redux store.
|
||||||
*
|
*
|
||||||
* @param {Store} store - The redux store in which the specified action is being
|
* @param {Store} store - The redux store in which the specified {@code action}
|
||||||
* dispatched.
|
* is being dispatched.
|
||||||
* @param {Dispatch} next - The redux dispatch function to dispatch the
|
* @param {Dispatch} next - The redux {@code dispatch} function to dispatch the
|
||||||
* specified action to the specified store.
|
* specified {@code action} to the specified {@code store}.
|
||||||
* @param {Action} action - The redux action TRACK_ADDED or TRACK_REMOVED which
|
* @param {Action} action - The redux action {@code TRACK_ADDED} or
|
||||||
* is being dispatched in the specified store.
|
* {@code TRACK_REMOVED} which is being dispatched in the specified
|
||||||
|
* {@code store}.
|
||||||
* @private
|
* @private
|
||||||
* @returns {Object} The value returned by {@code next(action)}.
|
* @returns {Object} The value returned by {@code next(action)}.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -62,7 +62,7 @@ export type ConnectionFailedError = {
|
||||||
* Indicates whether this event is recoverable or not.
|
* Indicates whether this event is recoverable or not.
|
||||||
*/
|
*/
|
||||||
recoverable?: boolean
|
recoverable?: boolean
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens new connection.
|
* Opens new connection.
|
||||||
|
@ -100,7 +100,7 @@ export function connect(id: ?string, password: ?string) {
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dispatches CONNECTION_DISCONNECTED action when connection is
|
* Dispatches {@code CONNECTION_DISCONNECTED} action when connection is
|
||||||
* disconnected.
|
* disconnected.
|
||||||
*
|
*
|
||||||
* @param {string} message - Disconnect reason.
|
* @param {string} message - Disconnect reason.
|
||||||
|
@ -153,8 +153,8 @@ export function connect(id: ?string, password: ?string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unsubscribes connection instance from CONNECTION_ESTABLISHED
|
* Unsubscribes connection instance from {@code CONNECTION_ESTABLISHED}
|
||||||
* and CONNECTION_FAILED events.
|
* and {@code CONNECTION_FAILED} events.
|
||||||
*
|
*
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
|
@ -172,7 +172,8 @@ export function connect(id: ?string, password: ?string) {
|
||||||
/**
|
/**
|
||||||
* Create an action for when the signaling connection has been lost.
|
* Create an action for when the signaling connection has been lost.
|
||||||
*
|
*
|
||||||
* @param {JitsiConnection} connection - The JitsiConnection which disconnected.
|
* @param {JitsiConnection} connection - The {@code JitsiConnection} which
|
||||||
|
* disconnected.
|
||||||
* @param {string} message - Error message.
|
* @param {string} message - Error message.
|
||||||
* @private
|
* @private
|
||||||
* @returns {{
|
* @returns {{
|
||||||
|
@ -189,27 +190,10 @@ function _connectionDisconnected(connection: Object, message: string) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Create an action for when a connection will connect.
|
|
||||||
*
|
|
||||||
* @param {JitsiConnection} connection - The JitsiConnection which will connect.
|
|
||||||
* @private
|
|
||||||
* @returns {{
|
|
||||||
* type: CONNECTION_WILL_CONNECT,
|
|
||||||
* connection: JitsiConnection
|
|
||||||
* }}
|
|
||||||
*/
|
|
||||||
function _connectionWillConnect(connection) {
|
|
||||||
return {
|
|
||||||
type: CONNECTION_WILL_CONNECT,
|
|
||||||
connection
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an action for when the signaling connection has been established.
|
* Create an action for when the signaling connection has been established.
|
||||||
*
|
*
|
||||||
* @param {JitsiConnection} connection - The JitsiConnection which was
|
* @param {JitsiConnection} connection - The {@code JitsiConnection} which was
|
||||||
* established.
|
* established.
|
||||||
* @public
|
* @public
|
||||||
* @returns {{
|
* @returns {{
|
||||||
|
@ -227,7 +211,8 @@ export function connectionEstablished(connection: Object) {
|
||||||
/**
|
/**
|
||||||
* Create an action for when the signaling connection could not be created.
|
* Create an action for when the signaling connection could not be created.
|
||||||
*
|
*
|
||||||
* @param {JitsiConnection} connection - The JitsiConnection which failed.
|
* @param {JitsiConnection} connection - The {@code JitsiConnection} which
|
||||||
|
* failed.
|
||||||
* @param {ConnectionFailedError} error - Error.
|
* @param {ConnectionFailedError} error - Error.
|
||||||
* @public
|
* @public
|
||||||
* @returns {{
|
* @returns {{
|
||||||
|
@ -252,6 +237,24 @@ export function connectionFailed(
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an action for when a connection will connect.
|
||||||
|
*
|
||||||
|
* @param {JitsiConnection} connection - The {@code JitsiConnection} which will
|
||||||
|
* connect.
|
||||||
|
* @private
|
||||||
|
* @returns {{
|
||||||
|
* type: CONNECTION_WILL_CONNECT,
|
||||||
|
* connection: JitsiConnection
|
||||||
|
* }}
|
||||||
|
*/
|
||||||
|
function _connectionWillConnect(connection) {
|
||||||
|
return {
|
||||||
|
type: CONNECTION_WILL_CONNECT,
|
||||||
|
connection
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs options to be passed to the constructor of {@code JitsiConnection}
|
* Constructs options to be passed to the constructor of {@code JitsiConnection}
|
||||||
* based on the redux state.
|
* based on the redux state.
|
||||||
|
@ -326,7 +329,7 @@ export function disconnect() {
|
||||||
= conference_.leave()
|
= conference_.leave()
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
logger.warn(
|
logger.warn(
|
||||||
'JitsiConference.leave() rejected with: ',
|
'JitsiConference.leave() rejected with:',
|
||||||
error);
|
error);
|
||||||
|
|
||||||
// The library lib-jitsi-meet failed to make the
|
// The library lib-jitsi-meet failed to make the
|
||||||
|
|
Loading…
Reference in New Issue