2022-10-20 09:11:27 +00:00
|
|
|
import { IReduxState } from '../../app/types';
|
2019-04-30 10:24:12 +00:00
|
|
|
|
2022-09-14 07:54:56 +00:00
|
|
|
import { IConfig } from './configType';
|
2021-03-10 15:39:35 +00:00
|
|
|
import { TOOLBAR_BUTTONS } from './constants';
|
|
|
|
|
2019-04-30 10:24:12 +00:00
|
|
|
export * from './functions.any';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Removes all analytics related options from the given configuration, in case of a libre build.
|
|
|
|
*
|
|
|
|
* @param {*} config - The configuration which needs to be cleaned up.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
2022-09-14 07:54:56 +00:00
|
|
|
export function _cleanupConfig(config: IConfig) { // eslint-disable-line @typescript-eslint/no-unused-vars
|
2019-04-30 10:24:12 +00:00
|
|
|
}
|
2020-05-14 12:30:24 +00:00
|
|
|
|
2021-06-16 11:08:18 +00:00
|
|
|
/**
|
|
|
|
* Returns the replaceParticipant config.
|
|
|
|
*
|
|
|
|
* @param {Object} state - The state of the app.
|
|
|
|
* @returns {boolean}
|
|
|
|
*/
|
2022-10-20 09:11:27 +00:00
|
|
|
export function getReplaceParticipant(state: IReduxState): string | undefined {
|
2021-06-16 11:08:18 +00:00
|
|
|
return state['features/base/config'].replaceParticipant;
|
|
|
|
}
|
|
|
|
|
2021-03-10 15:39:35 +00:00
|
|
|
/**
|
|
|
|
* Returns the list of enabled toolbar buttons.
|
|
|
|
*
|
|
|
|
* @param {Object} state - The redux state.
|
|
|
|
* @returns {Array<string>} - The list of enabled toolbar buttons.
|
|
|
|
*/
|
2022-10-20 09:11:27 +00:00
|
|
|
export function getToolbarButtons(state: IReduxState): Array<string> {
|
2021-03-10 15:39:35 +00:00
|
|
|
const { toolbarButtons } = state['features/base/config'];
|
|
|
|
|
|
|
|
return Array.isArray(toolbarButtons) ? toolbarButtons : TOOLBAR_BUTTONS;
|
|
|
|
}
|
2021-05-13 06:56:53 +00:00
|
|
|
|
|
|
|
/**
|
2021-07-09 12:36:19 +00:00
|
|
|
* Checks if the specified button is enabled.
|
2021-05-13 06:56:53 +00:00
|
|
|
*
|
|
|
|
* @param {string} buttonName - The name of the button.
|
|
|
|
* {@link interfaceConfig}.
|
2021-07-09 12:36:19 +00:00
|
|
|
* @param {Object|Array<string>} state - The redux state or the array with the enabled buttons.
|
|
|
|
* @returns {boolean} - True if the button is enabled and false otherwise.
|
2021-05-13 06:56:53 +00:00
|
|
|
*/
|
2022-10-20 09:11:27 +00:00
|
|
|
export function isToolbarButtonEnabled(buttonName: string, state: IReduxState | Array<string>) {
|
2021-07-09 12:36:19 +00:00
|
|
|
const buttons = Array.isArray(state) ? state : getToolbarButtons(state);
|
|
|
|
|
|
|
|
return buttons.includes(buttonName);
|
|
|
|
}
|
2022-01-11 16:08:36 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns whether audio level measurement is enabled or not.
|
|
|
|
*
|
|
|
|
* @param {Object} state - The state of the app.
|
|
|
|
* @returns {boolean}
|
|
|
|
*/
|
2022-10-20 09:11:27 +00:00
|
|
|
export function areAudioLevelsEnabled(state: IReduxState): boolean {
|
2022-01-11 16:08:36 +00:00
|
|
|
// Default to false for React Native as audio levels are of no interest to the mobile app.
|
|
|
|
return navigator.product !== 'ReactNative' && !state['features/base/config'].disableAudioLevels;
|
|
|
|
}
|