2019-06-20 13:02:15 +00:00
|
|
|
import { isSuboptimalBrowser } from '../base/environment';
|
2020-05-20 10:57:03 +00:00
|
|
|
import { translateToHTML } from '../base/i18n';
|
2019-03-20 20:09:23 +00:00
|
|
|
import { toState } from '../base/redux';
|
|
|
|
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) {
|
2019-06-20 13:02:15 +00:00
|
|
|
if (isSuboptimalBrowser()) {
|
2018-01-03 22:14:17 +00:00
|
|
|
dispatch(
|
|
|
|
showWarningNotification(
|
|
|
|
{
|
|
|
|
titleKey: 'notify.suboptimalExperienceTitle',
|
|
|
|
description: translateToHTML(
|
|
|
|
t,
|
2020-05-15 17:28:47 +00:00
|
|
|
'notify.suboptimalBrowserWarning',
|
|
|
|
{
|
|
|
|
recommendedBrowserPageLink: `${window.location.origin}/static/recommendedBrowsers.html`
|
|
|
|
}
|
2019-08-04 15:51:10 +00:00
|
|
|
)
|
2018-01-03 22:14:17 +00:00
|
|
|
}
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
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;
|
|
|
|
}
|