You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

functions.js 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import { translateToHTML } from '../base/i18n';
  2. import { isSuboptimalBrowser } from '../base/environment';
  3. import { toState } from '../base/redux';
  4. import { getName } from '../app';
  5. import {
  6. areThereNotifications,
  7. showWarningNotification
  8. } from '../notifications';
  9. import { getOverlayToRender } from '../overlay';
  10. /**
  11. * Shows the suboptimal experience notification if needed.
  12. *
  13. * @param {Function} dispatch - The dispatch method.
  14. * @param {Function} t - The translation function.
  15. * @returns {void}
  16. */
  17. export function maybeShowSuboptimalExperienceNotification(dispatch, t) {
  18. if (isSuboptimalBrowser()) {
  19. dispatch(
  20. showWarningNotification(
  21. {
  22. titleKey: 'notify.suboptimalExperienceTitle',
  23. description: translateToHTML(
  24. t,
  25. 'notify.suboptimalExperienceDescription',
  26. {
  27. appName: getName()
  28. })
  29. }
  30. )
  31. );
  32. }
  33. }
  34. /**
  35. * Tells whether or not the notifications should be displayed within
  36. * the conference feature based on the current Redux state.
  37. *
  38. * @param {Object|Function} stateful - The redux store state.
  39. * @returns {boolean}
  40. */
  41. export function shouldDisplayNotifications(stateful) {
  42. const state = toState(stateful);
  43. const isAnyOverlayVisible = Boolean(getOverlayToRender(state));
  44. const { calleeInfoVisible } = state['features/invite'];
  45. return areThereNotifications(state)
  46. && !isAnyOverlayVisible
  47. && !calleeInfoVisible;
  48. }