Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. // @flow
  2. import {
  3. SET_INFO_DIALOG_VISIBILITY,
  4. UPDATE_DIAL_IN_NUMBERS_FAILED,
  5. UPDATE_DIAL_IN_NUMBERS_SUCCESS
  6. } from './actionTypes';
  7. declare var $: Function;
  8. /**
  9. * Opens the inline conference info dialog.
  10. *
  11. * @param {boolean} visible - Whether or not the dialog should be displayed.
  12. * @param {boolean} autoClose - Whether or not the dialog should automatically
  13. * close after a set period of time.
  14. * @returns {{
  15. * type: SET_INFO_DIALOG_VISIBILITY,
  16. * autoClose: boolean,
  17. * visible: boolean
  18. * }}
  19. */
  20. export function setInfoDialogVisibility(
  21. visible: boolean,
  22. autoClose: boolean = false) {
  23. return {
  24. type: SET_INFO_DIALOG_VISIBILITY,
  25. autoClose,
  26. visible
  27. };
  28. }
  29. /**
  30. * Sends AJAX requests for dial-in numbers and conference ID.
  31. *
  32. * @returns {Function}
  33. */
  34. export function updateDialInNumbers() {
  35. return (dispatch: Dispatch<*>, getState: Function) => {
  36. const state = getState();
  37. const { dialInConfCodeUrl, dialInNumbersUrl, hosts }
  38. = state['features/base/config'];
  39. const mucURL = hosts && hosts.muc;
  40. if (!dialInConfCodeUrl || !dialInNumbersUrl || !mucURL) {
  41. // URLs for fetching dial in numbers not defined
  42. return;
  43. }
  44. const { room } = state['features/base/conference'];
  45. const conferenceIDURL
  46. = `${dialInConfCodeUrl}?conference=${room}@${mucURL}`;
  47. Promise.all([
  48. $.getJSON(dialInNumbersUrl),
  49. $.getJSON(conferenceIDURL)
  50. ])
  51. .then(([ dialInNumbers, { conference, id, message } ]) => {
  52. if (!conference || !id) {
  53. return Promise.reject(message);
  54. }
  55. dispatch({
  56. type: UPDATE_DIAL_IN_NUMBERS_SUCCESS,
  57. conferenceID: id,
  58. dialInNumbers
  59. });
  60. })
  61. .catch(error => {
  62. dispatch({
  63. type: UPDATE_DIAL_IN_NUMBERS_FAILED,
  64. error
  65. });
  66. });
  67. };
  68. }