2022-10-20 09:11:27 +00:00
|
|
|
import { IReduxState } from '../../app/types';
|
2019-04-30 10:24:12 +00:00
|
|
|
|
2022-12-20 17:03:57 +00:00
|
|
|
import { IConfig, IDeeplinkingConfig, IDeeplinkingMobileConfig, IDeeplinkingPlatformConfig } 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.
|
|
|
|
*
|
2022-12-20 17:03:57 +00:00
|
|
|
* @param {*} _config - The configuration which needs to be cleaned up.
|
2019-04-30 10:24:12 +00:00
|
|
|
* @returns {void}
|
|
|
|
*/
|
2022-12-20 17:03:57 +00:00
|
|
|
export function _cleanupConfig(_config: IConfig) {
|
|
|
|
return;
|
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> {
|
2023-02-09 11:12:00 +00:00
|
|
|
const { toolbarButtons, customToolbarButtons } = state['features/base/config'];
|
|
|
|
const customButtons = customToolbarButtons?.map(({ id }) => id);
|
2021-03-10 15:39:35 +00:00
|
|
|
|
2023-02-09 11:12:00 +00:00
|
|
|
const buttons = Array.isArray(toolbarButtons) ? toolbarButtons : TOOLBAR_BUTTONS;
|
|
|
|
|
|
|
|
if (customButtons) {
|
|
|
|
buttons.push(...customButtons);
|
|
|
|
}
|
|
|
|
|
|
|
|
return buttons;
|
2021-03-10 15:39:35 +00:00
|
|
|
}
|
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;
|
|
|
|
}
|
2022-12-20 17:03:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the defaults for deeplinking.
|
|
|
|
*
|
|
|
|
* @param {IDeeplinkingConfig} deeplinking - The deeplinking config.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
export function _setDeeplinkingDefaults(deeplinking: IDeeplinkingConfig) {
|
|
|
|
const {
|
|
|
|
desktop = {} as IDeeplinkingPlatformConfig,
|
|
|
|
android = {} as IDeeplinkingMobileConfig,
|
|
|
|
ios = {} as IDeeplinkingMobileConfig
|
|
|
|
} = deeplinking;
|
|
|
|
|
|
|
|
desktop.appName = desktop.appName || 'Jitsi Meet';
|
|
|
|
|
|
|
|
ios.appName = ios.appName || 'Jitsi Meet';
|
|
|
|
ios.appScheme = ios.appScheme || 'org.jitsi.meet';
|
|
|
|
ios.downloadLink = ios.downloadLink
|
|
|
|
|| 'https://itunes.apple.com/us/app/jitsi-meet/id1165103905';
|
|
|
|
if (ios.dynamicLink) {
|
|
|
|
ios.dynamicLink.apn = ios.dynamicLink.apn || 'org.jitsi.meet';
|
|
|
|
ios.dynamicLink.appCode = ios.dynamicLink.appCode || 'w2atb';
|
|
|
|
ios.dynamicLink.ibi = ios.dynamicLink.ibi || 'com.atlassian.JitsiMeet.ios';
|
|
|
|
ios.dynamicLink.isi = ios.dynamicLink.isi || '1165103905';
|
|
|
|
}
|
|
|
|
|
|
|
|
android.appName = android.appName || 'Jitsi Meet';
|
|
|
|
android.appScheme = android.appScheme || 'org.jitsi.meet';
|
|
|
|
android.downloadLink = android.downloadLink
|
|
|
|
|| 'https://play.google.com/store/apps/details?id=org.jitsi.meet';
|
|
|
|
android.appPackage = android.appPackage || 'org.jitsi.meet';
|
|
|
|
android.fDroidUrl = android.fDroidUrl || 'https://f-droid.org/en/packages/org.jitsi.meet/';
|
|
|
|
if (android.dynamicLink) {
|
|
|
|
android.dynamicLink.apn = android.dynamicLink.apn || 'org.jitsi.meet';
|
|
|
|
android.dynamicLink.appCode = android.dynamicLink.appCode || 'w2atb';
|
|
|
|
android.dynamicLink.ibi = android.dynamicLink.ibi || 'com.atlassian.JitsiMeet.ios';
|
|
|
|
android.dynamicLink.isi = android.dynamicLink.isi || '1165103905';
|
|
|
|
}
|
|
|
|
}
|
2023-02-09 11:12:00 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the list of buttons that have that notify the api when clicked.
|
|
|
|
*
|
|
|
|
* @param {Object} state - The redux state.
|
|
|
|
* @returns {Array} - The list of buttons.
|
|
|
|
*/
|
|
|
|
export function getButtonsWithNotifyClick(state: IReduxState): Array<{ key: string; preventExecution: boolean; }> {
|
|
|
|
const { buttonsWithNotifyClick, customToolbarButtons } = state['features/base/config'];
|
|
|
|
const customButtons = customToolbarButtons?.map(({ id }) => {
|
|
|
|
return {
|
|
|
|
key: id,
|
|
|
|
preventExecution: false
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
|
|
|
const buttons = Array.isArray(buttonsWithNotifyClick)
|
|
|
|
? buttonsWithNotifyClick as Array<{ key: string; preventExecution: boolean; }>
|
|
|
|
: [];
|
|
|
|
|
|
|
|
if (customButtons) {
|
|
|
|
buttons.push(...customButtons);
|
|
|
|
}
|
|
|
|
|
|
|
|
return buttons;
|
|
|
|
}
|
|
|
|
|