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.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import { translateToHTML } from '../base/i18n';
  2. import { browser } from '../base/lib-jitsi-meet';
  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 (!browser.isChrome()
  19. && !browser.isFirefox()
  20. && !browser.isNWJS()
  21. && !browser.isElectron()
  22. // Adding react native to the list of recommended browsers is not
  23. // necessary for now because the function won't be executed at all
  24. // in this case but I'm adding it for completeness.
  25. && !browser.isReactNative()
  26. ) {
  27. dispatch(
  28. showWarningNotification(
  29. {
  30. titleKey: 'notify.suboptimalExperienceTitle',
  31. description: translateToHTML(
  32. t,
  33. 'notify.suboptimalExperienceDescription',
  34. {
  35. appName: getName()
  36. })
  37. }
  38. )
  39. );
  40. }
  41. }
  42. /**
  43. * Tells whether or not the notifications should be displayed within
  44. * the conference feature based on the current Redux state.
  45. *
  46. * @param {Object|Function} stateful - The redux store state.
  47. * @returns {boolean}
  48. */
  49. export function shouldDisplayNotifications(stateful) {
  50. const state = toState(stateful);
  51. const isAnyOverlayVisible = Boolean(getOverlayToRender(state));
  52. const { calleeInfoVisible } = state['features/invite'];
  53. return areThereNotifications(state)
  54. && !isAnyOverlayVisible
  55. && !calleeInfoVisible;
  56. }