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.ts 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. import { IStore } from '../app/types';
  2. import { getInviteURL } from '../base/connection/functions';
  3. import {
  4. BEGIN_SHARE_ROOM,
  5. END_SHARE_ROOM,
  6. TOGGLE_SHARE_DIALOG
  7. } from './actionTypes';
  8. /**
  9. * Begins the UI procedure to share the URL for the current conference/room.
  10. *
  11. * @param {string} roomURL - The URL of the room to share.
  12. * @public
  13. * @returns {Function}
  14. */
  15. export function beginShareRoom(roomURL?: string) {
  16. return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
  17. if (!roomURL) {
  18. // eslint-disable-next-line no-param-reassign
  19. roomURL = getInviteURL(getState);
  20. }
  21. dispatch({
  22. type: BEGIN_SHARE_ROOM,
  23. roomURL
  24. });
  25. };
  26. }
  27. /**
  28. * Ends the UI procedure to share a specific conference/room URL.
  29. *
  30. * @param {string} roomURL - The URL of the conference/room which was shared.
  31. * @param {boolean} shared - True if the URL was shared successfully; false,
  32. * otherwise.
  33. * @public
  34. * @returns {{
  35. * type: END_SHARE_ROOM,
  36. * roomURL: string,
  37. * shared: boolean
  38. * }}
  39. */
  40. export function endShareRoom(roomURL: string, shared: boolean) {
  41. return {
  42. type: END_SHARE_ROOM,
  43. roomURL,
  44. shared
  45. };
  46. }
  47. /**
  48. * UI procedure for sharing conference room URL inside a dialog.
  49. *
  50. * @param {boolean} visible - True if share dialog is visible; false,
  51. * otherwise.
  52. * @public
  53. * @returns {{
  54. * type: TOGGLE_SHARE_DIALOG,
  55. * visible: boolean
  56. * }}
  57. */
  58. export function toggleShareDialog(visible: boolean) {
  59. return {
  60. type: TOGGLE_SHARE_DIALOG,
  61. visible
  62. };
  63. }