2018-01-03 22:14:17 +00:00
|
|
|
import { translateToHTML } from '../base/i18n';
|
2018-01-19 17:50:03 +00:00
|
|
|
import { browser } from '../base/lib-jitsi-meet';
|
2019-03-20 20:09:23 +00:00
|
|
|
import { toState } from '../base/redux';
|
|
|
|
|
|
|
|
import { getName } from '../app';
|
|
|
|
import {
|
|
|
|
areThereNotifications,
|
|
|
|
showWarningNotification
|
|
|
|
} from '../notifications';
|
|
|
|
import { getOverlayToRender } from '../overlay';
|
2018-01-03 22:14:17 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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) {
|
2018-01-19 17:50:03 +00:00
|
|
|
if (!browser.isChrome()
|
|
|
|
&& !browser.isFirefox()
|
|
|
|
&& !browser.isNWJS()
|
|
|
|
&& !browser.isElectron()
|
2018-01-03 22:14:17 +00:00
|
|
|
|
|
|
|
// Adding react native to the list of recommended browsers is not
|
|
|
|
// necessary for now because the function won't be executed at all
|
|
|
|
// in this case but I'm adding it for completeness.
|
2018-01-19 17:50:03 +00:00
|
|
|
&& !browser.isReactNative()
|
2018-01-03 22:14:17 +00:00
|
|
|
) {
|
|
|
|
dispatch(
|
|
|
|
showWarningNotification(
|
|
|
|
{
|
|
|
|
titleKey: 'notify.suboptimalExperienceTitle',
|
|
|
|
description: translateToHTML(
|
|
|
|
t,
|
|
|
|
'notify.suboptimalExperienceDescription',
|
|
|
|
{
|
|
|
|
appName: getName()
|
|
|
|
})
|
|
|
|
}
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2019-03-20 20:09:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Tells whether or not the notifications should be displayed within
|
|
|
|
* the conference feature based on the current Redux state.
|
|
|
|
*
|
|
|
|
* @param {Object|Function} stateful - The redux store state.
|
|
|
|
* @returns {boolean}
|
|
|
|
*/
|
|
|
|
export function shouldDisplayNotifications(stateful) {
|
|
|
|
const state = toState(stateful);
|
|
|
|
const isAnyOverlayVisible = Boolean(getOverlayToRender(state));
|
|
|
|
const { calleeInfoVisible } = state['features/invite'];
|
|
|
|
|
|
|
|
return areThereNotifications(state)
|
|
|
|
&& !isAnyOverlayVisible
|
|
|
|
&& !calleeInfoVisible;
|
|
|
|
}
|