2020-09-30 11:50:39 +00:00
|
|
|
import { getName } from '../app/functions.web';
|
|
|
|
import { isSuboptimalBrowser } from '../base/environment';
|
|
|
|
import { translateToHTML } from '../base/i18n';
|
|
|
|
import { getLocalParticipant } from '../base/participants';
|
|
|
|
import { toState } from '../base/redux';
|
|
|
|
import { getBackendSafePath, getJitsiMeetGlobalNS } from '../base/util';
|
2021-02-05 10:36:55 +00:00
|
|
|
import { getVpaasBillingId } from '../billing-counter/functions';
|
2020-10-08 09:41:00 +00:00
|
|
|
import { showWarningNotification } from '../notifications';
|
2021-03-12 16:11:15 +00:00
|
|
|
import { createRnnoiseProcessor } from '../stream-effects/rnnoise';
|
2020-09-30 11:50:39 +00:00
|
|
|
|
2020-10-08 09:41:00 +00:00
|
|
|
export * from './functions.any';
|
|
|
|
|
2020-09-30 11:50:39 +00:00
|
|
|
/**
|
|
|
|
* Returns the result of getWiFiStats from the global NS or does nothing
|
|
|
|
(returns empty result).
|
|
|
|
* Fixes a concurrency problem where we need to pass a function when creating
|
|
|
|
* a JitsiConference, but that method is added to the context later.
|
|
|
|
*
|
|
|
|
* @returns {Promise}
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
const getWiFiStatsMethod = () => {
|
|
|
|
const gloabalNS = getJitsiMeetGlobalNS();
|
|
|
|
|
|
|
|
return gloabalNS.getWiFiStats ? gloabalNS.getWiFiStats() : Promise.resolve('{}');
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Shows the suboptimal experience notification if needed.
|
|
|
|
*
|
|
|
|
* @param {Function} dispatch - The dispatch method.
|
|
|
|
* @param {Function} t - The translation function.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
export function maybeShowSuboptimalExperienceNotification(dispatch, t) {
|
|
|
|
if (isSuboptimalBrowser()) {
|
|
|
|
dispatch(
|
|
|
|
showWarningNotification(
|
|
|
|
{
|
|
|
|
titleKey: 'notify.suboptimalExperienceTitle',
|
|
|
|
description: translateToHTML(
|
|
|
|
t,
|
|
|
|
'notify.suboptimalBrowserWarning',
|
|
|
|
{
|
|
|
|
recommendedBrowserPageLink: `${window.location.origin}/static/recommendedBrowsers.html`
|
|
|
|
}
|
|
|
|
)
|
|
|
|
}
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns an object aggregating the conference options.
|
|
|
|
*
|
|
|
|
* @param {Object|Function} stateful - The redux store state.
|
|
|
|
* @returns {Object} - Options object.
|
|
|
|
*/
|
|
|
|
export function getConferenceOptions(stateful) {
|
|
|
|
const state = toState(stateful);
|
|
|
|
|
|
|
|
const options = state['features/base/config'];
|
|
|
|
const { locationURL } = state['features/base/connection'];
|
|
|
|
const { tenant } = state['features/base/jwt'];
|
|
|
|
|
|
|
|
const { email, name: nick } = getLocalParticipant(state);
|
|
|
|
|
|
|
|
if (tenant) {
|
|
|
|
options.siteID = tenant;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (options.enableDisplayNameInStats && nick) {
|
|
|
|
options.statisticsDisplayName = nick;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (options.enableEmailInStats && email) {
|
|
|
|
options.statisticsId = email;
|
|
|
|
}
|
|
|
|
|
2020-10-14 09:20:32 +00:00
|
|
|
if (locationURL) {
|
|
|
|
options.confID = `${locationURL.host}${getBackendSafePath(locationURL.pathname)}`;
|
|
|
|
}
|
|
|
|
|
2020-09-30 11:50:39 +00:00
|
|
|
options.applicationName = getName();
|
|
|
|
options.getWiFiStatsMethod = getWiFiStatsMethod;
|
2021-03-12 16:11:15 +00:00
|
|
|
options.createVADProcessor = createRnnoiseProcessor;
|
2021-02-05 10:36:55 +00:00
|
|
|
options.billingId = getVpaasBillingId(state);
|
2020-09-30 11:50:39 +00:00
|
|
|
|
|
|
|
// Disable CallStats, if requessted.
|
|
|
|
if (options.disableThirdPartyRequests) {
|
|
|
|
delete options.callStatsID;
|
|
|
|
delete options.callStatsSecret;
|
|
|
|
delete options.getWiFiStatsMethod;
|
|
|
|
}
|
|
|
|
|
|
|
|
return options;
|
|
|
|
}
|