mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2026-05-16 22:07:47 +00:00
* WiP(invite-ui): Initial move of invite UI to invite button * Adjusts styling to fit both horizontal and vertical filmstrip * Removes comment and functions not needed * [squash] Addressing various review comments * [squash] Move invite options to a separate config * [squash] Adjust invite button styles until we fix the whole UI theme * [squash] Fix the remote videos scroll * [squash]:Do not show popup menu when 1 option is available * [squash]: Disable the invite button in filmstrip mode * feat(connection-indicator): implement automatic hiding on good connection (#2009) * ref(connection-stats): use PropTypes package * feat(connection-stats): display a summary of the connection quality * feat(connection-indicator): show empty bars for interrupted connection * feat(connection-indicator): change background color based on status * feat(connection-indicator): implement automatic hiding on good connection * fix(connection-indicator): explicitly set font size Currently non-react code will set an icon size on ConnectionIndicator. This doesn't work on initial call join in vertical filmstrip after some changes to support hiding the indicator. The chosen fix is passing in the icon size to mirror what would happe with full filmstrip reactification. * ref(connection-stats): rename statuses * feat(connection-indicator): make hiding behavior configurable The original implementation made the auto hiding of the indicator configured in interfaceConfig. * fix(connection-indicator): readd class expected by torture tests * fix(connection-indicator): change connection quality display styling Bold the connection summary in the stats popover so it stands out. Change the summaries so there are only three--strong, nonoptimal, poor. * fix(connection-indicator): gray background on lost connection * feat(icons): add new gsm bars icon * feat(connection-indicator): use new 3-bar icon * ref(icons): remove icon-connection and icon-connection-lost Both have been replaced by icon-gsm-bars so they are not being referenced anymore. Mobile looks to have connect-lost as a separate icon in font-icons/jitsi.json. * fix(defaultToolbarButtons): Fixes unresolved InfoDialogButton component problem * [squash]: Makes invite button fit the container * [squash]:Addressing invite truncate, remote menu position and comment * [squash]:Fix z-index in horizontal mode, z-index in lonely call * [squash]: Fix filmstripOnly property, remove important from css
384 lines
11 KiB
JavaScript
384 lines
11 KiB
JavaScript
import { CONNECTION_WILL_CONNECT } from '../connection';
|
|
import { JitsiConferenceErrors } from '../lib-jitsi-meet';
|
|
import { assign, ReducerRegistry, set } from '../redux';
|
|
import { LOCKED_LOCALLY, LOCKED_REMOTELY } from '../../room-lock';
|
|
|
|
import {
|
|
CONFERENCE_FAILED,
|
|
CONFERENCE_JOINED,
|
|
CONFERENCE_LEFT,
|
|
CONFERENCE_WILL_JOIN,
|
|
CONFERENCE_WILL_LEAVE,
|
|
LOCK_STATE_CHANGED,
|
|
P2P_STATUS_CHANGED,
|
|
SET_AUDIO_ONLY,
|
|
SET_PASSWORD,
|
|
SET_RECEIVE_VIDEO_QUALITY,
|
|
SET_ROOM,
|
|
SET_SIP_GATEWAY_ENABLED
|
|
} from './actionTypes';
|
|
import { VIDEO_QUALITY_LEVELS } from './constants';
|
|
import { isRoomValid } from './functions';
|
|
|
|
/**
|
|
* Listen for actions that contain the conference object, so that it can be
|
|
* stored for use by other action creators.
|
|
*/
|
|
ReducerRegistry.register('features/base/conference', (state = {}, action) => {
|
|
switch (action.type) {
|
|
case CONFERENCE_FAILED:
|
|
return _conferenceFailed(state, action);
|
|
|
|
case CONFERENCE_JOINED:
|
|
return _conferenceJoined(state, action);
|
|
|
|
case CONFERENCE_LEFT:
|
|
return _conferenceLeft(state, action);
|
|
|
|
case CONFERENCE_WILL_JOIN:
|
|
return _conferenceWillJoin(state, action);
|
|
|
|
case CONFERENCE_WILL_LEAVE:
|
|
return _conferenceWillLeave(state, action);
|
|
|
|
case CONNECTION_WILL_CONNECT:
|
|
return set(state, 'authRequired', undefined);
|
|
|
|
case LOCK_STATE_CHANGED:
|
|
return _lockStateChanged(state, action);
|
|
|
|
case P2P_STATUS_CHANGED:
|
|
return _p2pStatusChanged(state, action);
|
|
|
|
case SET_AUDIO_ONLY:
|
|
return _setAudioOnly(state, action);
|
|
|
|
case SET_PASSWORD:
|
|
return _setPassword(state, action);
|
|
|
|
case SET_RECEIVE_VIDEO_QUALITY:
|
|
return _setReceiveVideoQuality(state, action);
|
|
|
|
case SET_ROOM:
|
|
return _setRoom(state, action);
|
|
|
|
case SET_SIP_GATEWAY_ENABLED:
|
|
return _setSIPGatewayEnabled(state, action);
|
|
}
|
|
|
|
return state;
|
|
});
|
|
|
|
/**
|
|
* Reduces a specific Redux action CONFERENCE_FAILED of the feature
|
|
* base/conference.
|
|
*
|
|
* @param {Object} state - The Redux state of the feature base/conference.
|
|
* @param {Action} action - The Redux action CONFERENCE_FAILED to reduce.
|
|
* @private
|
|
* @returns {Object} The new state of the feature base/conference after the
|
|
* reduction of the specified action.
|
|
*/
|
|
function _conferenceFailed(state, { conference, error }) {
|
|
if (state.conference && state.conference !== conference) {
|
|
return state;
|
|
}
|
|
|
|
let authRequired;
|
|
let passwordRequired;
|
|
|
|
switch (error) {
|
|
case JitsiConferenceErrors.AUTHENTICATION_REQUIRED:
|
|
authRequired = conference;
|
|
break;
|
|
|
|
case JitsiConferenceErrors.PASSWORD_REQUIRED:
|
|
passwordRequired = conference;
|
|
break;
|
|
}
|
|
|
|
return assign(state, {
|
|
authRequired,
|
|
conference: undefined,
|
|
joining: undefined,
|
|
leaving: undefined,
|
|
|
|
/**
|
|
* The indicator of how the conference/room is locked. If falsy, the
|
|
* conference/room is unlocked; otherwise, it's either
|
|
* {@code LOCKED_LOCALLY} or {@code LOCKED_REMOTELY}.
|
|
*
|
|
* @type {string}
|
|
*/
|
|
locked: passwordRequired ? LOCKED_REMOTELY : undefined,
|
|
password: undefined,
|
|
|
|
/**
|
|
* The JitsiConference instance which requires a password to join.
|
|
*
|
|
* @type {JitsiConference}
|
|
*/
|
|
passwordRequired
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reduces a specific Redux action CONFERENCE_JOINED of the feature
|
|
* base/conference.
|
|
*
|
|
* @param {Object} state - The Redux state of the feature base/conference.
|
|
* @param {Action} action - The Redux action CONFERENCE_JOINED to reduce.
|
|
* @private
|
|
* @returns {Object} The new state of the feature base/conference after the
|
|
* reduction of the specified action.
|
|
*/
|
|
function _conferenceJoined(state, { conference }) {
|
|
// FIXME The indicator which determines whether a JitsiConference is locked
|
|
// i.e. password-protected is private to lib-jitsi-meet. However, the
|
|
// library does not fire LOCK_STATE_CHANGED upon joining a JitsiConference
|
|
// with a password.
|
|
const locked = conference.room.locked ? LOCKED_REMOTELY : undefined;
|
|
|
|
return assign(state, {
|
|
authRequired: undefined,
|
|
|
|
/**
|
|
* The JitsiConference instance represented by the Redux state of the
|
|
* feature base/conference.
|
|
*
|
|
* @type {JitsiConference}
|
|
*/
|
|
conference,
|
|
joining: undefined,
|
|
leaving: undefined,
|
|
|
|
/**
|
|
* The indicator which determines whether the conference is locked.
|
|
*
|
|
* @type {boolean}
|
|
*/
|
|
locked,
|
|
passwordRequired: undefined,
|
|
|
|
/**
|
|
* The current resolution restraint on receiving remote video. By
|
|
* default the conference will send the highest level possible.
|
|
*
|
|
* @type number
|
|
*/
|
|
receiveVideoQuality: VIDEO_QUALITY_LEVELS.HIGH
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reduces a specific Redux action CONFERENCE_LEFT of the feature
|
|
* base/conference.
|
|
*
|
|
* @param {Object} state - The Redux state of the feature base/conference.
|
|
* @param {Action} action - The Redux action CONFERENCE_LEFT to reduce.
|
|
* @private
|
|
* @returns {Object} The new state of the feature base/conference after the
|
|
* reduction of the specified action.
|
|
*/
|
|
function _conferenceLeft(state, { conference }) {
|
|
if (state.conference !== conference) {
|
|
return state;
|
|
}
|
|
|
|
return assign(state, {
|
|
authRequired: undefined,
|
|
conference: undefined,
|
|
joining: undefined,
|
|
leaving: undefined,
|
|
locked: undefined,
|
|
password: undefined,
|
|
passwordRequired: undefined
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reduces a specific Redux action CONFERENCE_WILL_JOIN of the feature
|
|
* base/conference.
|
|
*
|
|
* @param {Object} state - The Redux state of the feature base/conference.
|
|
* @param {Action} action - The Redux action CONFERENCE_WILL_JOIN to reduce.
|
|
* @private
|
|
* @returns {Object} The new state of the feature base/conference after the
|
|
* reduction of the specified action.
|
|
*/
|
|
function _conferenceWillJoin(state, { conference }) {
|
|
return set(state, 'joining', conference);
|
|
}
|
|
|
|
/**
|
|
* Reduces a specific Redux action CONFERENCE_WILL_LEAVE of the feature
|
|
* base/conference.
|
|
*
|
|
* @param {Object} state - The Redux state of the feature base/conference.
|
|
* @param {Action} action - The Redux action CONFERENCE_WILL_LEAVE to reduce.
|
|
* @private
|
|
* @returns {Object} The new state of the feature base/conference after the
|
|
* reduction of the specified action.
|
|
*/
|
|
function _conferenceWillLeave(state, { conference }) {
|
|
if (state.conference !== conference) {
|
|
return state;
|
|
}
|
|
|
|
return assign(state, {
|
|
authRequired: undefined,
|
|
joining: undefined,
|
|
|
|
/**
|
|
* The JitsiConference instance which is currently in the process of
|
|
* being left.
|
|
*
|
|
* @type {JitsiConference}
|
|
*/
|
|
leaving: conference,
|
|
passwordRequired: undefined
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reduces a specific Redux action LOCK_STATE_CHANGED of the feature
|
|
* base/conference.
|
|
*
|
|
* @param {Object} state - The Redux state of the feature base/conference.
|
|
* @param {Action} action - The Redux action LOCK_STATE_CHANGED to reduce.
|
|
* @private
|
|
* @returns {Object} The new state of the feature base/conference after the
|
|
* reduction of the specified action.
|
|
*/
|
|
function _lockStateChanged(state, { conference, locked }) {
|
|
if (state.conference !== conference) {
|
|
return state;
|
|
}
|
|
|
|
return assign(state, {
|
|
locked: locked ? state.locked || LOCKED_REMOTELY : undefined,
|
|
password: locked ? state.password : undefined
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reduces a specific Redux action P2P_STATUS_CHANGED of the feature
|
|
* base/conference.
|
|
*
|
|
* @param {Object} state - The Redux state of the feature base/conference.
|
|
* @param {Action} action - The Redux action P2P_STATUS_CHANGED to reduce.
|
|
* @private
|
|
* @returns {Object} The new state of the feature base/conference after the
|
|
* reduction of the specified action.
|
|
*/
|
|
function _p2pStatusChanged(state, action) {
|
|
return set(state, 'p2p', action.p2p);
|
|
}
|
|
|
|
/**
|
|
* Reduces a specific Redux action SET_AUDIO_ONLY of the feature
|
|
* base/conference.
|
|
*
|
|
* @param {Object} state - The Redux state of the feature base/conference.
|
|
* @param {Action} action - The Redux action SET_AUDIO_ONLY to reduce.
|
|
* @private
|
|
* @returns {Object} The new state of the feature base/conference after the
|
|
* reduction of the specified action.
|
|
*/
|
|
function _setAudioOnly(state, action) {
|
|
return set(state, 'audioOnly', action.audioOnly);
|
|
}
|
|
|
|
/**
|
|
* Reduces a specific Redux action SET_PASSWORD of the feature base/conference.
|
|
*
|
|
* @param {Object} state - The Redux state of the feature base/conference.
|
|
* @param {Action} action - The Redux action SET_PASSWORD to reduce.
|
|
* @private
|
|
* @returns {Object} The new state of the feature base/conference after the
|
|
* reduction of the specified action.
|
|
*/
|
|
function _setPassword(state, { conference, method, password }) {
|
|
switch (method) {
|
|
case conference.join:
|
|
if (state.passwordRequired === conference) {
|
|
return assign(state, {
|
|
locked: LOCKED_REMOTELY,
|
|
|
|
/**
|
|
* The password with which the conference is to be joined.
|
|
*
|
|
* @type {string}
|
|
*/
|
|
password,
|
|
passwordRequired: undefined
|
|
});
|
|
}
|
|
break;
|
|
|
|
case conference.lock:
|
|
return assign(state, {
|
|
locked: password ? LOCKED_LOCALLY : undefined,
|
|
password
|
|
});
|
|
}
|
|
|
|
return state;
|
|
}
|
|
|
|
/**
|
|
* Reduces a specific Redux action SET_RECEIVE_VIDEO_QUALITY of the feature
|
|
* base/conference.
|
|
*
|
|
* @param {Object} state - The Redux state of the feature base/conference.
|
|
* @param {Action} action - The Redux action SET_RECEIVE_VIDEO_QUALITY to
|
|
* reduce.
|
|
* @private
|
|
* @returns {Object} The new state of the feature base/conference after the
|
|
* reduction of the specified action.
|
|
*/
|
|
function _setReceiveVideoQuality(state, action) {
|
|
return set(state, 'receiveVideoQuality', action.receiveVideoQuality);
|
|
}
|
|
|
|
/**
|
|
* Reduces a specific Redux action SET_ROOM of the feature base/conference.
|
|
*
|
|
* @param {Object} state - The Redux state of the feature base/conference.
|
|
* @param {Action} action - The Redux action SET_ROOM to reduce.
|
|
* @private
|
|
* @returns {Object} The new state of the feature base/conference after the
|
|
* reduction of the specified action.
|
|
*/
|
|
function _setRoom(state, action) {
|
|
let room = action.room;
|
|
|
|
if (!isRoomValid(room)) {
|
|
// Technically, there are multiple values which don't represent valid
|
|
// room names. Practically, each of them is as bad as the rest of them
|
|
// because we can't use any of them to join a conference.
|
|
room = undefined;
|
|
}
|
|
|
|
/**
|
|
* The name of the room of the conference (to be) joined.
|
|
*
|
|
* @type {string}
|
|
*/
|
|
return set(state, 'room', room);
|
|
}
|
|
|
|
/**
|
|
* Reduces a specific Redux action SET_SIP_GATEWAY_ENABLED of the feature
|
|
* base/conference.
|
|
*
|
|
* @param {Object} state - The Redux state of the feature base/conference.
|
|
* @param {Action} action - The Redux action SET_SIP_GATEWAY_ENABLED to reduce.
|
|
* @private
|
|
* @returns {Object} The new state of the feature base/conference after the
|
|
* reduction of the specified action.
|
|
*/
|
|
function _setSIPGatewayEnabled(state, action) {
|
|
return set(state, 'isSIPGatewayEnabled', action.isSIPGatewayEnabled);
|
|
}
|