Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

actions.js 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. import { appNavigate, reloadWithStoredParams } from '../app';
  2. import { toURLString } from '../base/util';
  3. import {
  4. MEDIA_PERMISSION_PROMPT_VISIBILITY_CHANGED,
  5. SET_FATAL_ERROR,
  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. dispatch(setFatalError(undefined));
  38. const { locationURL } = getState()['features/base/connection'];
  39. logger.info(`Reloading the conference using URL: ${locationURL}`);
  40. if (navigator.product === 'ReactNative') {
  41. dispatch(appNavigate(toURLString(locationURL)));
  42. } else {
  43. dispatch(reloadWithStoredParams());
  44. }
  45. };
  46. }
  47. /**
  48. * Signals that suspend was detected.
  49. *
  50. * @public
  51. * @returns {{
  52. * type: SUSPEND_DETECTED
  53. * }}
  54. */
  55. export function suspendDetected() {
  56. return {
  57. type: SUSPEND_DETECTED
  58. };
  59. }
  60. /**
  61. * The action indicates that an unrecoverable error has occurred and the reload
  62. * screen will be displayed or hidden.
  63. *
  64. * @param {Object} fatalError - A critical error which was not claimed by any
  65. * feature for error recovery (the recoverable flag was not set). If
  66. * {@code undefined} then any fatal error currently stored will be discarded.
  67. * @returns {{
  68. * type: SET_FATAL_ERROR,
  69. * fatalError: ?Error
  70. * }}
  71. */
  72. export function setFatalError(fatalError) {
  73. return {
  74. type: SET_FATAL_ERROR,
  75. fatalError
  76. };
  77. }