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.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /* @flow */
  2. import { BEGIN_SHARE_ROOM, END_SHARE_ROOM } from './actionTypes';
  3. /**
  4. * Begins the UI procedure to share the URL for the current conference/room.
  5. *
  6. * @param {string} roomURL - The URL of the room to share.
  7. * @public
  8. * @returns {Function}
  9. */
  10. export function beginShareRoom(roomURL: ?string): Function {
  11. return (dispatch, getState) => {
  12. if (!roomURL) {
  13. const { conference, room } = getState()['features/base/conference'];
  14. // eslint-disable-next-line no-param-reassign
  15. roomURL = _getRoomURL(conference, room);
  16. }
  17. if (roomURL) {
  18. dispatch({
  19. type: BEGIN_SHARE_ROOM,
  20. roomURL
  21. });
  22. }
  23. };
  24. }
  25. /**
  26. * Ends the UI procedure to share a specific conference/room URL.
  27. *
  28. * @param {string} roomURL - The URL of the conference/room which was shared.
  29. * @param {boolean} shared - True if the URL was shared successfully; false,
  30. * otherwise.
  31. * @public
  32. * @returns {{
  33. * type: END_SHARE_ROOM,
  34. * roomURL: string,
  35. * shared: boolean
  36. * }}
  37. */
  38. export function endShareRoom(roomURL: string, shared: boolean): Object {
  39. return {
  40. type: END_SHARE_ROOM,
  41. roomURL,
  42. shared
  43. };
  44. }
  45. /**
  46. * Gets the public URL of a conference/room.
  47. *
  48. * @param {JitsiConference} conference - The JitsiConference to share the URL
  49. * of.
  50. * @param {string} room - The name of the room to share the URL of.
  51. * @private
  52. * @returns {string|null}
  53. */
  54. function _getRoomURL(conference, room) {
  55. return (
  56. conference
  57. && room
  58. && `https://${conference.connection.options.hosts.domain}/${room}`);
  59. }