2017-07-05 20:23:10 +00:00
|
|
|
import _ from 'lodash';
|
|
|
|
|
2021-09-20 18:12:56 +00:00
|
|
|
import { CONFERENCE_INFO } from '../../conference/components/constants';
|
2022-07-04 11:12:12 +00:00
|
|
|
import ReducerRegistry from '../redux/ReducerRegistry';
|
2022-09-05 09:05:07 +00:00
|
|
|
import { equals } from '../redux/functions';
|
2017-04-23 20:14:02 +00:00
|
|
|
|
2021-03-10 15:39:35 +00:00
|
|
|
import {
|
|
|
|
CONFIG_WILL_LOAD,
|
|
|
|
LOAD_CONFIG_ERROR,
|
2022-09-27 07:10:28 +00:00
|
|
|
OVERWRITE_CONFIG,
|
2021-03-10 15:39:35 +00:00
|
|
|
SET_CONFIG,
|
2022-09-27 07:10:28 +00:00
|
|
|
UPDATE_CONFIG
|
2021-03-10 15:39:35 +00:00
|
|
|
} from './actionTypes';
|
2022-07-04 11:12:12 +00:00
|
|
|
import { IConfig } from './configType';
|
2022-09-05 09:05:07 +00:00
|
|
|
// eslint-disable-next-line lines-around-comment
|
2022-07-04 11:12:12 +00:00
|
|
|
// @ts-ignore
|
2019-04-30 10:24:12 +00:00
|
|
|
import { _cleanupConfig } from './functions';
|
2017-04-23 20:14:02 +00:00
|
|
|
|
2022-07-11 12:30:37 +00:00
|
|
|
declare let interfaceConfig: any;
|
2021-03-10 15:39:35 +00:00
|
|
|
|
2017-04-23 20:14:02 +00:00
|
|
|
/**
|
2017-07-05 20:23:10 +00:00
|
|
|
* The initial state of the feature base/config when executing in a
|
|
|
|
* non-React Native environment. The mandatory configuration to be passed to
|
|
|
|
* JitsiMeetJS#init(). The app will download config.js from the Jitsi Meet
|
2021-03-16 15:59:33 +00:00
|
|
|
* deployment and take its values into account but the values below will be
|
2017-07-05 20:23:10 +00:00
|
|
|
* enforced (because they are essential to the correct execution of the
|
2017-04-23 20:14:02 +00:00
|
|
|
* application).
|
|
|
|
*
|
|
|
|
* @type {Object}
|
|
|
|
*/
|
2022-07-04 11:12:12 +00:00
|
|
|
const INITIAL_NON_RN_STATE: IConfig = {
|
2017-07-05 20:23:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The initial state of the feature base/config when executing in a React Native
|
|
|
|
* environment. The mandatory configuration to be passed to JitsiMeetJS#init().
|
|
|
|
* The app will download config.js from the Jitsi Meet deployment and take its
|
2021-03-16 15:59:33 +00:00
|
|
|
* values into account but the values below will be enforced (because they are
|
2017-07-05 20:23:10 +00:00
|
|
|
* essential to the correct execution of the application).
|
|
|
|
*
|
|
|
|
* @type {Object}
|
|
|
|
*/
|
2022-07-04 11:12:12 +00:00
|
|
|
const INITIAL_RN_STATE: IConfig = {
|
2019-04-30 10:24:12 +00:00
|
|
|
analytics: {},
|
|
|
|
|
2017-04-23 20:14:02 +00:00
|
|
|
// FIXME The support for audio levels in lib-jitsi-meet polls the statistics
|
|
|
|
// of WebRTC at a short interval multiple times a second. Unfortunately,
|
|
|
|
// React Native is slow to fetch these statistics from the native WebRTC
|
|
|
|
// API, through the React Native bridge and eventually to JavaScript.
|
|
|
|
// Because the audio levels are of no interest to the mobile app, it is
|
|
|
|
// fastest to merely disable them.
|
|
|
|
disableAudioLevels: true,
|
|
|
|
|
2017-07-05 20:23:10 +00:00
|
|
|
p2p: {
|
2021-04-15 10:49:29 +00:00
|
|
|
disabledCodec: '',
|
|
|
|
disableH264: false, // deprecated
|
|
|
|
preferredCodec: 'H264',
|
|
|
|
preferH264: true // deprecated
|
|
|
|
}
|
2017-04-23 20:14:02 +00:00
|
|
|
};
|
|
|
|
|
2021-09-20 18:12:56 +00:00
|
|
|
/**
|
|
|
|
* Mapping between old configs controlling the conference info headers visibility and the
|
|
|
|
* new configs. Needed in order to keep backwards compatibility.
|
|
|
|
*/
|
2022-07-04 11:12:12 +00:00
|
|
|
const CONFERENCE_HEADER_MAPPING: any = {
|
2021-09-20 18:12:56 +00:00
|
|
|
hideConferenceTimer: [ 'conference-timer' ],
|
|
|
|
hideConferenceSubject: [ 'subject' ],
|
|
|
|
hideParticipantsStats: [ 'participants-count' ],
|
2022-04-29 10:44:26 +00:00
|
|
|
hideRecordingLabel: [ 'recording' ]
|
2021-09-20 18:12:56 +00:00
|
|
|
};
|
|
|
|
|
2022-09-05 09:05:07 +00:00
|
|
|
export interface IConfigState extends IConfig {
|
2022-09-19 07:40:03 +00:00
|
|
|
analysis?: {
|
|
|
|
obfuscateRoomName?: boolean;
|
|
|
|
};
|
2022-09-05 09:05:07 +00:00
|
|
|
error?: Error;
|
|
|
|
}
|
|
|
|
|
|
|
|
ReducerRegistry.register<IConfigState>('features/base/config', (state = _getInitialState(), action): IConfigState => {
|
2019-10-18 14:30:59 +00:00
|
|
|
switch (action.type) {
|
2020-08-14 07:45:15 +00:00
|
|
|
case UPDATE_CONFIG:
|
2019-10-18 14:30:59 +00:00
|
|
|
return _updateConfig(state, action);
|
|
|
|
|
|
|
|
case CONFIG_WILL_LOAD:
|
|
|
|
return {
|
|
|
|
error: undefined,
|
|
|
|
|
|
|
|
/**
|
2021-09-09 14:18:26 +00:00
|
|
|
* The URL of the location associated with/configured by this
|
|
|
|
* configuration.
|
|
|
|
*
|
|
|
|
* @type URL
|
|
|
|
*/
|
2019-10-18 14:30:59 +00:00
|
|
|
locationURL: action.locationURL
|
|
|
|
};
|
|
|
|
|
|
|
|
case LOAD_CONFIG_ERROR:
|
|
|
|
// XXX LOAD_CONFIG_ERROR is one of the settlement execution paths of
|
|
|
|
// the asynchronous "loadConfig procedure/process" started with
|
|
|
|
// CONFIG_WILL_LOAD. Due to the asynchronous nature of it, whoever
|
|
|
|
// is settling the process needs to provide proof that they have
|
|
|
|
// started it and that the iteration of the process being completed
|
|
|
|
// now is still of interest to the app.
|
|
|
|
if (state.locationURL === action.locationURL) {
|
2017-11-29 14:15:57 +00:00
|
|
|
return {
|
2018-05-23 21:10:04 +00:00
|
|
|
/**
|
2021-09-09 14:18:26 +00:00
|
|
|
* The {@link Error} which prevented the loading of the
|
|
|
|
* configuration of the associated {@code locationURL}.
|
|
|
|
*
|
|
|
|
* @type Error
|
|
|
|
*/
|
2019-10-18 14:30:59 +00:00
|
|
|
error: action.error
|
2017-11-29 14:15:57 +00:00
|
|
|
};
|
2017-04-23 20:14:02 +00:00
|
|
|
}
|
2019-10-18 14:30:59 +00:00
|
|
|
break;
|
2018-05-23 21:10:04 +00:00
|
|
|
|
2019-10-18 14:30:59 +00:00
|
|
|
case SET_CONFIG:
|
|
|
|
return _setConfig(state, action);
|
2021-03-10 15:39:35 +00:00
|
|
|
|
|
|
|
case OVERWRITE_CONFIG:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
...action.config
|
|
|
|
};
|
2019-10-18 14:30:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return state;
|
|
|
|
});
|
2017-04-23 20:14:02 +00:00
|
|
|
|
2017-07-05 20:23:10 +00:00
|
|
|
/**
|
|
|
|
* Gets the initial state of the feature base/config. The mandatory
|
|
|
|
* configuration to be passed to JitsiMeetJS#init(). The app will download
|
|
|
|
* config.js from the Jitsi Meet deployment and take its values into account but
|
2021-03-16 15:59:33 +00:00
|
|
|
* the values below will be enforced (because they are essential to the correct
|
2017-07-05 20:23:10 +00:00
|
|
|
* execution of the application).
|
|
|
|
*
|
|
|
|
* @returns {Object}
|
|
|
|
*/
|
|
|
|
function _getInitialState() {
|
|
|
|
return (
|
2017-07-19 08:51:07 +00:00
|
|
|
navigator.product === 'ReactNative'
|
2017-07-05 20:23:10 +00:00
|
|
|
? INITIAL_RN_STATE
|
|
|
|
: INITIAL_NON_RN_STATE);
|
|
|
|
}
|
|
|
|
|
2017-04-23 20:14:02 +00:00
|
|
|
/**
|
|
|
|
* Reduces a specific Redux action SET_CONFIG of the feature
|
|
|
|
* base/lib-jitsi-meet.
|
|
|
|
*
|
2022-07-04 11:12:12 +00:00
|
|
|
* @param {IConfig} state - The Redux state of the feature base/config.
|
2017-04-23 20:14:02 +00:00
|
|
|
* @param {Action} action - The Redux action SET_CONFIG to reduce.
|
|
|
|
* @private
|
2019-10-18 14:30:59 +00:00
|
|
|
* @returns {Object} The new state after the reduction of the specified action.
|
2017-04-23 20:14:02 +00:00
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
function _setConfig(state: IConfig, { config }: { config: IConfig; }) {
|
2017-11-29 14:15:57 +00:00
|
|
|
// eslint-disable-next-line no-param-reassign
|
2017-07-05 20:23:10 +00:00
|
|
|
config = _translateLegacyConfig(config);
|
2021-04-13 11:26:07 +00:00
|
|
|
|
2021-04-14 11:23:40 +00:00
|
|
|
const { audioQuality } = config;
|
|
|
|
const hdAudioOptions = {};
|
2021-04-13 11:26:07 +00:00
|
|
|
|
2021-04-14 11:23:40 +00:00
|
|
|
if (audioQuality?.stereo) {
|
2021-04-13 11:26:07 +00:00
|
|
|
Object.assign(hdAudioOptions, {
|
|
|
|
disableAP: true,
|
|
|
|
enableNoAudioDetection: false,
|
|
|
|
enableNoisyMicDetection: false,
|
2021-04-14 11:23:40 +00:00
|
|
|
enableTalkWhileMuted: false
|
2021-04-13 11:26:07 +00:00
|
|
|
});
|
|
|
|
}
|
2017-04-23 20:14:02 +00:00
|
|
|
|
2017-07-05 20:23:10 +00:00
|
|
|
const newState = _.merge(
|
|
|
|
{},
|
|
|
|
config,
|
2021-04-13 11:26:07 +00:00
|
|
|
hdAudioOptions,
|
2017-11-29 14:15:57 +00:00
|
|
|
{ error: undefined },
|
2017-07-05 20:23:10 +00:00
|
|
|
|
|
|
|
// The config of _getInitialState() is meant to override the config
|
2017-04-23 20:14:02 +00:00
|
|
|
// downloaded from the Jitsi Meet deployment because the former contains
|
|
|
|
// values that are mandatory.
|
2017-07-05 20:23:10 +00:00
|
|
|
_getInitialState()
|
|
|
|
);
|
|
|
|
|
2019-04-30 10:24:12 +00:00
|
|
|
_cleanupConfig(newState);
|
|
|
|
|
2017-07-05 20:23:10 +00:00
|
|
|
return equals(state, newState) ? state : newState;
|
|
|
|
}
|
|
|
|
|
2021-09-20 18:12:56 +00:00
|
|
|
/**
|
|
|
|
* Processes the conferenceInfo object against the defaults.
|
|
|
|
*
|
2022-07-04 11:12:12 +00:00
|
|
|
* @param {IConfig} config - The old config.
|
2021-09-20 18:12:56 +00:00
|
|
|
* @returns {Object} The processed conferenceInfo object.
|
|
|
|
*/
|
2022-07-04 11:12:12 +00:00
|
|
|
function _getConferenceInfo(config: IConfig) {
|
2021-09-20 18:12:56 +00:00
|
|
|
const { conferenceInfo } = config;
|
|
|
|
|
|
|
|
if (conferenceInfo) {
|
|
|
|
return {
|
|
|
|
alwaysVisible: conferenceInfo.alwaysVisible ?? [ ...CONFERENCE_INFO.alwaysVisible ],
|
|
|
|
autoHide: conferenceInfo.autoHide ?? [ ...CONFERENCE_INFO.autoHide ]
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
...CONFERENCE_INFO
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2017-07-05 20:23:10 +00:00
|
|
|
/**
|
|
|
|
* Constructs a new config {@code Object}, if necessary, out of a specific
|
2022-06-28 11:11:26 +00:00
|
|
|
* interface_config {@code Object} which is in the latest format supported by jitsi-meet.
|
2017-07-05 20:23:10 +00:00
|
|
|
*
|
|
|
|
* @param {Object} oldValue - The config {@code Object} which may or may not be
|
|
|
|
* in the latest form supported by jitsi-meet and from which a new config
|
|
|
|
* {@code Object} is to be constructed if necessary.
|
|
|
|
* @returns {Object} A config {@code Object} which is in the latest format
|
|
|
|
* supported by jitsi-meet.
|
|
|
|
*/
|
2022-07-04 11:12:12 +00:00
|
|
|
function _translateInterfaceConfig(oldValue: IConfig) {
|
2021-04-22 08:56:22 +00:00
|
|
|
const newValue = oldValue;
|
2017-07-05 20:23:10 +00:00
|
|
|
|
2021-04-22 08:55:03 +00:00
|
|
|
if (!Array.isArray(oldValue.toolbarButtons)
|
2022-06-28 11:11:26 +00:00
|
|
|
&& typeof interfaceConfig === 'object' && Array.isArray(interfaceConfig.TOOLBAR_BUTTONS)) {
|
2021-03-10 15:39:35 +00:00
|
|
|
newValue.toolbarButtons = interfaceConfig.TOOLBAR_BUTTONS;
|
|
|
|
}
|
|
|
|
|
2021-09-23 14:39:05 +00:00
|
|
|
if (!oldValue.toolbarConfig) {
|
|
|
|
oldValue.toolbarConfig = {};
|
|
|
|
}
|
|
|
|
|
2022-07-04 11:12:12 +00:00
|
|
|
newValue.toolbarConfig = oldValue.toolbarConfig || {};
|
2021-09-23 14:39:05 +00:00
|
|
|
if (typeof oldValue.toolbarConfig.alwaysVisible !== 'boolean'
|
|
|
|
&& typeof interfaceConfig === 'object'
|
|
|
|
&& typeof interfaceConfig.TOOLBAR_ALWAYS_VISIBLE === 'boolean') {
|
|
|
|
newValue.toolbarConfig.alwaysVisible = interfaceConfig.TOOLBAR_ALWAYS_VISIBLE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (typeof oldValue.toolbarConfig.initialTimeout !== 'number'
|
|
|
|
&& typeof interfaceConfig === 'object'
|
|
|
|
&& typeof interfaceConfig.INITIAL_TOOLBAR_TIMEOUT === 'number') {
|
|
|
|
newValue.toolbarConfig.initialTimeout = interfaceConfig.INITIAL_TOOLBAR_TIMEOUT;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (typeof oldValue.toolbarConfig.timeout !== 'number'
|
|
|
|
&& typeof interfaceConfig === 'object'
|
|
|
|
&& typeof interfaceConfig.TOOLBAR_TIMEOUT === 'number') {
|
|
|
|
newValue.toolbarConfig.timeout = interfaceConfig.TOOLBAR_TIMEOUT;
|
|
|
|
}
|
|
|
|
|
2022-06-28 11:11:26 +00:00
|
|
|
if (!oldValue.connectionIndicators
|
|
|
|
&& typeof interfaceConfig === 'object'
|
|
|
|
&& (interfaceConfig.hasOwnProperty('CONNECTION_INDICATOR_DISABLED')
|
|
|
|
|| interfaceConfig.hasOwnProperty('CONNECTION_INDICATOR_AUTO_HIDE_ENABLED')
|
|
|
|
|| interfaceConfig.hasOwnProperty('CONNECTION_INDICATOR_AUTO_HIDE_TIMEOUT'))) {
|
|
|
|
newValue.connectionIndicators = {
|
|
|
|
disabled: interfaceConfig.CONNECTION_INDICATOR_DISABLED,
|
|
|
|
autoHide: interfaceConfig.CONNECTION_INDICATOR_AUTO_HIDE_ENABLED,
|
|
|
|
autoHideTimeout: interfaceConfig.CONNECTION_INDICATOR_AUTO_HIDE_TIMEOUT
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
if (oldValue.disableModeratorIndicator === undefined
|
|
|
|
&& typeof interfaceConfig === 'object'
|
|
|
|
&& interfaceConfig.hasOwnProperty('DISABLE_FOCUS_INDICATOR')) {
|
|
|
|
newValue.disableModeratorIndicator = interfaceConfig.DISABLE_FOCUS_INDICATOR;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (oldValue.defaultLocalDisplayName === undefined
|
|
|
|
&& typeof interfaceConfig === 'object'
|
|
|
|
&& interfaceConfig.hasOwnProperty('DEFAULT_LOCAL_DISPLAY_NAME')) {
|
|
|
|
newValue.defaultLocalDisplayName = interfaceConfig.DEFAULT_LOCAL_DISPLAY_NAME;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (oldValue.defaultRemoteDisplayName === undefined
|
|
|
|
&& typeof interfaceConfig === 'object'
|
|
|
|
&& interfaceConfig.hasOwnProperty('DEFAULT_REMOTE_DISPLAY_NAME')) {
|
|
|
|
newValue.defaultRemoteDisplayName = interfaceConfig.DEFAULT_REMOTE_DISPLAY_NAME;
|
|
|
|
}
|
|
|
|
|
2022-08-30 11:52:36 +00:00
|
|
|
if (oldValue.defaultLogoUrl === undefined) {
|
|
|
|
if (typeof interfaceConfig === 'object'
|
|
|
|
&& interfaceConfig.hasOwnProperty('DEFAULT_LOGO_URL')) {
|
|
|
|
newValue.defaultLogoUrl = interfaceConfig.DEFAULT_LOGO_URL;
|
|
|
|
} else {
|
|
|
|
newValue.defaultLogoUrl = 'images/watermark.svg';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-06-28 11:11:26 +00:00
|
|
|
return newValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Constructs a new config {@code Object}, if necessary, out of a specific
|
|
|
|
* config {@code Object} which is in the latest format supported by jitsi-meet.
|
|
|
|
* Such a translation from an old config format to a new/the latest config
|
|
|
|
* format is necessary because the mobile app bundles jitsi-meet and
|
|
|
|
* lib-jitsi-meet at build time and does not download them at runtime from the
|
|
|
|
* deployment on which it will join a conference.
|
|
|
|
*
|
|
|
|
* @param {Object} oldValue - The config {@code Object} which may or may not be
|
|
|
|
* in the latest form supported by jitsi-meet and from which a new config
|
|
|
|
* {@code Object} is to be constructed if necessary.
|
|
|
|
* @returns {Object} A config {@code Object} which is in the latest format
|
|
|
|
* supported by jitsi-meet.
|
|
|
|
*/
|
2022-07-04 11:12:12 +00:00
|
|
|
function _translateLegacyConfig(oldValue: IConfig) {
|
2022-06-28 11:11:26 +00:00
|
|
|
const newValue = _translateInterfaceConfig(oldValue);
|
|
|
|
|
|
|
|
// Translate deprecated config values to new config values.
|
|
|
|
|
2022-07-04 11:12:12 +00:00
|
|
|
const filteredConferenceInfo = Object.keys(CONFERENCE_HEADER_MAPPING).filter(key => oldValue[key as keyof IConfig]);
|
2021-09-20 18:12:56 +00:00
|
|
|
|
|
|
|
if (filteredConferenceInfo.length) {
|
|
|
|
newValue.conferenceInfo = _getConferenceInfo(oldValue);
|
|
|
|
|
|
|
|
filteredConferenceInfo.forEach(key => {
|
2022-07-04 15:04:33 +00:00
|
|
|
newValue.conferenceInfo = oldValue.conferenceInfo ?? {};
|
2022-07-11 12:30:37 +00:00
|
|
|
|
2021-09-20 18:12:56 +00:00
|
|
|
// hideRecordingLabel does not mean not render it at all, but autoHide it
|
|
|
|
if (key === 'hideRecordingLabel') {
|
|
|
|
newValue.conferenceInfo.alwaysVisible
|
2022-07-11 12:30:37 +00:00
|
|
|
= (newValue.conferenceInfo?.alwaysVisible ?? [])
|
|
|
|
.filter(c => !CONFERENCE_HEADER_MAPPING[key].includes(c));
|
2021-09-20 18:12:56 +00:00
|
|
|
newValue.conferenceInfo.autoHide
|
|
|
|
= _.union(newValue.conferenceInfo.autoHide, CONFERENCE_HEADER_MAPPING[key]);
|
|
|
|
} else {
|
|
|
|
newValue.conferenceInfo.alwaysVisible
|
2022-07-11 12:30:37 +00:00
|
|
|
= (newValue.conferenceInfo.alwaysVisible ?? [])
|
|
|
|
.filter(c => !CONFERENCE_HEADER_MAPPING[key].includes(c));
|
2021-09-20 18:12:56 +00:00
|
|
|
newValue.conferenceInfo.autoHide
|
2022-07-04 11:12:12 +00:00
|
|
|
= (newValue.conferenceInfo.autoHide ?? []).filter(c => !CONFERENCE_HEADER_MAPPING[key].includes(c));
|
2021-09-20 18:12:56 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-12-08 07:53:19 +00:00
|
|
|
newValue.prejoinConfig = oldValue.prejoinConfig || {};
|
|
|
|
if (oldValue.hasOwnProperty('prejoinPageEnabled')
|
|
|
|
&& !newValue.prejoinConfig.hasOwnProperty('enabled')
|
|
|
|
) {
|
|
|
|
newValue.prejoinConfig.enabled = oldValue.prejoinPageEnabled;
|
|
|
|
}
|
|
|
|
|
2021-09-09 14:18:26 +00:00
|
|
|
newValue.disabledSounds = newValue.disabledSounds || [];
|
|
|
|
|
|
|
|
if (oldValue.disableJoinLeaveSounds) {
|
|
|
|
newValue.disabledSounds.unshift('PARTICIPANT_LEFT_SOUND', 'PARTICIPANT_JOINED_SOUND');
|
|
|
|
}
|
|
|
|
|
|
|
|
if (oldValue.disableRecordAudioNotification) {
|
|
|
|
newValue.disabledSounds.unshift(
|
|
|
|
'RECORDING_ON_SOUND',
|
|
|
|
'RECORDING_OFF_SOUND',
|
|
|
|
'LIVE_STREAMING_ON_SOUND',
|
|
|
|
'LIVE_STREAMING_OFF_SOUND'
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (oldValue.disableIncomingMessageSound) {
|
|
|
|
newValue.disabledSounds.unshift('INCOMING_MSG_SOUND');
|
|
|
|
}
|
|
|
|
|
2021-04-14 11:23:40 +00:00
|
|
|
if (oldValue.stereo || oldValue.opusMaxAverageBitrate) {
|
|
|
|
newValue.audioQuality = {
|
|
|
|
opusMaxAverageBitrate: oldValue.audioQuality?.opusMaxAverageBitrate ?? oldValue.opusMaxAverageBitrate,
|
|
|
|
stereo: oldValue.audioQuality?.stereo ?? oldValue.stereo
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2021-11-16 11:12:10 +00:00
|
|
|
newValue.e2ee = newValue.e2ee || {};
|
|
|
|
|
|
|
|
if (oldValue.e2eeLabels) {
|
|
|
|
newValue.e2ee.e2eeLabels = oldValue.e2eeLabels;
|
|
|
|
}
|
|
|
|
|
2021-11-26 15:39:34 +00:00
|
|
|
newValue.defaultLocalDisplayName
|
|
|
|
= newValue.defaultLocalDisplayName || 'me';
|
|
|
|
|
2022-03-02 14:15:18 +00:00
|
|
|
if (oldValue.hideAddRoomButton) {
|
|
|
|
newValue.breakoutRooms = {
|
|
|
|
/* eslint-disable-next-line no-extra-parens */
|
|
|
|
...(newValue.breakoutRooms || {}),
|
|
|
|
hideAddRoomButton: oldValue.hideAddRoomButton
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2021-11-26 15:39:34 +00:00
|
|
|
newValue.defaultRemoteDisplayName
|
|
|
|
= newValue.defaultRemoteDisplayName || 'Fellow Jitster';
|
|
|
|
|
2022-06-28 11:11:26 +00:00
|
|
|
newValue.transcription = newValue.transcription || {};
|
|
|
|
if (oldValue.transcribingEnabled !== undefined) {
|
|
|
|
newValue.transcription = {
|
|
|
|
...newValue.transcription,
|
|
|
|
enabled: oldValue.transcribingEnabled
|
|
|
|
};
|
|
|
|
}
|
|
|
|
if (oldValue.transcribeWithAppLanguage !== undefined) {
|
|
|
|
newValue.transcription = {
|
|
|
|
...newValue.transcription,
|
|
|
|
useAppLanguage: oldValue.transcribeWithAppLanguage
|
|
|
|
};
|
|
|
|
}
|
|
|
|
if (oldValue.preferredTranscribeLanguage !== undefined) {
|
|
|
|
newValue.transcription = {
|
|
|
|
...newValue.transcription,
|
|
|
|
preferredLanguage: oldValue.preferredTranscribeLanguage
|
|
|
|
};
|
|
|
|
}
|
|
|
|
if (oldValue.autoCaptionOnRecord !== undefined) {
|
|
|
|
newValue.transcription = {
|
|
|
|
...newValue.transcription,
|
|
|
|
autoCaptionOnRecord: oldValue.autoCaptionOnRecord
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2022-06-29 12:28:20 +00:00
|
|
|
newValue.recordingService = newValue.recordingService || {};
|
2022-08-03 07:31:00 +00:00
|
|
|
if (oldValue.fileRecordingsServiceEnabled !== undefined
|
|
|
|
&& newValue.recordingService.enabled === undefined) {
|
2022-06-29 12:28:20 +00:00
|
|
|
newValue.recordingService = {
|
|
|
|
...newValue.recordingService,
|
|
|
|
enabled: oldValue.fileRecordingsServiceEnabled
|
|
|
|
};
|
|
|
|
}
|
2022-08-03 07:31:00 +00:00
|
|
|
if (oldValue.fileRecordingsServiceSharingEnabled !== undefined
|
|
|
|
&& newValue.recordingService.sharingEnabled === undefined) {
|
2022-06-29 12:28:20 +00:00
|
|
|
newValue.recordingService = {
|
|
|
|
...newValue.recordingService,
|
|
|
|
sharingEnabled: oldValue.fileRecordingsServiceSharingEnabled
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2022-08-02 08:27:18 +00:00
|
|
|
newValue.liveStreaming = newValue.liveStreaming || {};
|
|
|
|
|
|
|
|
// Migrate config.liveStreamingEnabled
|
|
|
|
if (oldValue.liveStreamingEnabled !== undefined) {
|
|
|
|
newValue.liveStreaming = {
|
|
|
|
...newValue.liveStreaming,
|
|
|
|
enabled: oldValue.liveStreamingEnabled
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
// Migrate interfaceConfig.LIVE_STREAMING_HELP_LINK
|
|
|
|
if (oldValue.liveStreaming === undefined
|
|
|
|
&& typeof interfaceConfig === 'object'
|
|
|
|
&& interfaceConfig.hasOwnProperty('LIVE_STREAMING_HELP_LINK')) {
|
|
|
|
newValue.liveStreaming = {
|
|
|
|
...newValue.liveStreaming,
|
|
|
|
helpLink: interfaceConfig.LIVE_STREAMING_HELP_LINK
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2017-07-05 20:23:10 +00:00
|
|
|
return newValue;
|
2017-04-23 20:14:02 +00:00
|
|
|
}
|
2019-10-18 14:30:59 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Updates the stored configuration with the given extra options.
|
|
|
|
*
|
|
|
|
* @param {Object} state - The Redux state of the feature base/config.
|
|
|
|
* @param {Action} action - The Redux action to reduce.
|
|
|
|
* @private
|
|
|
|
* @returns {Object} The new state after the reduction of the specified action.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
function _updateConfig(state: IConfig, { config }: { config: IConfig; }) {
|
2019-10-18 14:30:59 +00:00
|
|
|
const newState = _.merge({}, state, config);
|
|
|
|
|
|
|
|
_cleanupConfig(newState);
|
|
|
|
|
|
|
|
return equals(state, newState) ? state : newState;
|
|
|
|
}
|