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.

actions.js 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. import { appNavigate } from '../app';
  2. import { toURLString } from '../base/util';
  3. import { reload, replace } from '../../../modules/util/helpers';
  4. import {
  5. MEDIA_PERMISSION_PROMPT_VISIBILITY_CHANGED,
  6. SUSPEND_DETECTED
  7. } from './actionTypes';
  8. const logger = require('jitsi-meet-logger').getLogger(__filename);
  9. /**
  10. * Signals that the prompt for media permission is visible or not.
  11. *
  12. * @param {boolean} isVisible - If the value is true - the prompt for media
  13. * permission is visible otherwise the value is false/undefined.
  14. * @param {string} browser - The name of the current browser.
  15. * @public
  16. * @returns {{
  17. * type: MEDIA_PERMISSION_PROMPT_VISIBILITY_CHANGED,
  18. * browser: {string},
  19. * isVisible: {boolean}
  20. * }}
  21. */
  22. export function mediaPermissionPromptVisibilityChanged(isVisible, browser) {
  23. return {
  24. type: MEDIA_PERMISSION_PROMPT_VISIBILITY_CHANGED,
  25. browser,
  26. isVisible
  27. };
  28. }
  29. /**
  30. * Reloads the page.
  31. *
  32. * @protected
  33. * @returns {Function}
  34. */
  35. export function _reloadNow() {
  36. return (dispatch, getState) => {
  37. const { locationURL } = getState()['features/base/connection'];
  38. logger.info(`Reloading the conference using URL: ${locationURL}`);
  39. if (navigator.product === 'ReactNative') {
  40. dispatch(appNavigate(toURLString(locationURL)));
  41. } else if (window.self === window.top) {
  42. replace(locationURL);
  43. } else {
  44. // In an iframe reload with the reload() utility because the
  45. // replace() utility does not work on an iframe.
  46. reload();
  47. }
  48. };
  49. }
  50. /**
  51. * Signals that suspend was detected.
  52. *
  53. * @public
  54. * @returns {{
  55. * type: SUSPEND_DETECTED
  56. * }}
  57. */
  58. export function suspendDetected() {
  59. return {
  60. type: SUSPEND_DETECTED
  61. };
  62. }