2022-10-28 06:41:12 +00:00
|
|
|
import { IStore } from '../app/types';
|
|
|
|
import { getInviteURL } from '../base/connection/functions';
|
2017-05-31 05:32:13 +00:00
|
|
|
|
2023-01-12 10:13:18 +00:00
|
|
|
import {
|
|
|
|
BEGIN_SHARE_ROOM,
|
|
|
|
END_SHARE_ROOM,
|
|
|
|
TOGGLE_SHARE_DIALOG
|
|
|
|
} from './actionTypes';
|
2017-01-31 09:52:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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}
|
|
|
|
*/
|
2022-10-28 06:41:12 +00:00
|
|
|
export function beginShareRoom(roomURL?: string) {
|
|
|
|
return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
|
2017-01-31 09:52:29 +00:00
|
|
|
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
|
|
|
}
|
2023-01-12 10:13:18 +00:00
|
|
|
|
|
|
|
dispatch({
|
2017-05-09 05:15:43 +00:00
|
|
|
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
|
|
|
|
* }}
|
|
|
|
*/
|
2022-10-28 06:41:12 +00:00
|
|
|
export function endShareRoom(roomURL: string, shared: boolean) {
|
2017-01-31 09:52:29 +00:00
|
|
|
return {
|
|
|
|
type: END_SHARE_ROOM,
|
|
|
|
roomURL,
|
|
|
|
shared
|
|
|
|
};
|
|
|
|
}
|
2023-01-12 10:13:18 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* UI procedure for sharing conference room URL inside a dialog.
|
|
|
|
*
|
|
|
|
* @param {boolean} visible - True if share dialog is visible; false,
|
|
|
|
* otherwise.
|
|
|
|
* @public
|
|
|
|
* @returns {{
|
|
|
|
* type: TOGGLE_SHARE_DIALOG,
|
|
|
|
* visible: boolean
|
|
|
|
* }}
|
|
|
|
*/
|
|
|
|
export function toggleShareDialog(visible: boolean) {
|
|
|
|
return {
|
|
|
|
type: TOGGLE_SHARE_DIALOG,
|
|
|
|
visible
|
|
|
|
};
|
|
|
|
}
|