2017-01-31 09:52:29 +00:00
|
|
|
/* @flow */
|
|
|
|
|
2017-05-31 05:32:13 +00:00
|
|
|
import { getInviteURL } from '../base/connection';
|
|
|
|
|
2017-01-31 09:52:29 +00:00
|
|
|
import { BEGIN_SHARE_ROOM, END_SHARE_ROOM } from './actionTypes';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Begins the UI procedure to share the URL for the current conference/room.
|
|
|
|
*
|
|
|
|
* @param {string} roomURL - The URL of the room to share.
|
|
|
|
* @public
|
|
|
|
* @returns {Function}
|
|
|
|
*/
|
|
|
|
export function beginShareRoom(roomURL: ?string): Function {
|
|
|
|
return (dispatch, getState) => {
|
|
|
|
if (!roomURL) {
|
2017-05-31 05:32:13 +00:00
|
|
|
// eslint-disable-next-line no-param-reassign
|
|
|
|
roomURL = getInviteURL(getState);
|
2017-01-31 09:52:29 +00:00
|
|
|
}
|
2017-05-09 05:15:43 +00:00
|
|
|
roomURL && dispatch({
|
|
|
|
type: BEGIN_SHARE_ROOM,
|
2018-09-07 22:48:58 +00:00
|
|
|
roomURL
|
2017-05-09 05:15:43 +00:00
|
|
|
});
|
2017-01-31 09:52:29 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Ends the UI procedure to share a specific conference/room URL.
|
|
|
|
*
|
|
|
|
* @param {string} roomURL - The URL of the conference/room which was shared.
|
|
|
|
* @param {boolean} shared - True if the URL was shared successfully; false,
|
|
|
|
* otherwise.
|
|
|
|
* @public
|
|
|
|
* @returns {{
|
|
|
|
* type: END_SHARE_ROOM,
|
|
|
|
* roomURL: string,
|
|
|
|
* shared: boolean
|
|
|
|
* }}
|
|
|
|
*/
|
|
|
|
export function endShareRoom(roomURL: string, shared: boolean): Object {
|
|
|
|
return {
|
|
|
|
type: END_SHARE_ROOM,
|
|
|
|
roomURL,
|
|
|
|
shared
|
|
|
|
};
|
|
|
|
}
|