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 2.0KB

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