2018-08-08 18:48:23 +00:00
|
|
|
// @flow
|
|
|
|
|
2019-05-18 20:40:58 +00:00
|
|
|
import type { Dispatch } from 'redux';
|
|
|
|
|
2019-04-11 15:53:34 +00:00
|
|
|
import {
|
2021-01-28 12:36:01 +00:00
|
|
|
SCREEN_SHARE_REMOTE_PARTICIPANTS_UPDATED,
|
2022-04-29 14:32:16 +00:00
|
|
|
SET_TILE_VIEW,
|
|
|
|
VIRTUAL_SCREENSHARE_REMOTE_PARTICIPANTS_UPDATED
|
2019-04-11 15:53:34 +00:00
|
|
|
} from './actionTypes';
|
2020-07-23 13:12:25 +00:00
|
|
|
import { shouldDisplayTileView } from './functions';
|
2019-04-11 15:53:34 +00:00
|
|
|
|
|
|
|
/**
|
2021-01-28 12:36:01 +00:00
|
|
|
* Creates a (redux) action which signals that the list of known remote participants
|
2019-04-11 15:53:34 +00:00
|
|
|
* with screen shares has changed.
|
|
|
|
*
|
2021-01-28 12:36:01 +00:00
|
|
|
* @param {string} participantIds - The remote participants which currently have active
|
2019-04-11 15:53:34 +00:00
|
|
|
* screen share streams.
|
|
|
|
* @returns {{
|
2021-01-28 12:36:01 +00:00
|
|
|
* type: SCREEN_SHARE_REMOTE_PARTICIPANTS_UPDATED,
|
2019-04-11 15:53:34 +00:00
|
|
|
* participantId: string
|
|
|
|
* }}
|
|
|
|
*/
|
2021-01-28 12:36:01 +00:00
|
|
|
export function setRemoteParticipantsWithScreenShare(participantIds: Array<string>) {
|
2019-04-11 15:53:34 +00:00
|
|
|
return {
|
2021-01-28 12:36:01 +00:00
|
|
|
type: SCREEN_SHARE_REMOTE_PARTICIPANTS_UPDATED,
|
2019-04-11 15:53:34 +00:00
|
|
|
participantIds
|
|
|
|
};
|
|
|
|
}
|
2018-08-08 18:48:23 +00:00
|
|
|
|
2022-04-04 18:57:58 +00:00
|
|
|
/**
|
2022-04-29 14:32:16 +00:00
|
|
|
* Creates a (redux) action which signals that the list of known remote virtual screen share participant ids has
|
|
|
|
* changed.
|
2022-04-04 18:57:58 +00:00
|
|
|
*
|
2022-04-29 14:32:16 +00:00
|
|
|
* @param {string} participantIds - The remote virtual screen share participants.
|
2022-04-04 18:57:58 +00:00
|
|
|
* @returns {{
|
2022-04-29 14:32:16 +00:00
|
|
|
* type: VIRTUAL_SCREENSHARE_REMOTE_PARTICIPANTS_UPDATED,
|
2022-04-04 18:57:58 +00:00
|
|
|
* participantIds: Array<string>
|
|
|
|
* }}
|
|
|
|
*/
|
2022-04-29 14:32:16 +00:00
|
|
|
export function virtualScreenshareParticipantsUpdated(participantIds: Array<string>) {
|
2022-04-04 18:57:58 +00:00
|
|
|
return {
|
2022-04-29 14:32:16 +00:00
|
|
|
type: VIRTUAL_SCREENSHARE_REMOTE_PARTICIPANTS_UPDATED,
|
2022-04-04 18:57:58 +00:00
|
|
|
participantIds
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2018-08-08 18:48:23 +00:00
|
|
|
/**
|
|
|
|
* Creates a (redux) action which signals to set the UI layout to be tiled view
|
|
|
|
* or not.
|
|
|
|
*
|
|
|
|
* @param {boolean} enabled - Whether or not tile view should be shown.
|
|
|
|
* @returns {{
|
|
|
|
* type: SET_TILE_VIEW,
|
2020-07-23 13:12:25 +00:00
|
|
|
* enabled: ?boolean
|
2018-08-08 18:48:23 +00:00
|
|
|
* }}
|
|
|
|
*/
|
2020-07-23 13:12:25 +00:00
|
|
|
export function setTileView(enabled: ?boolean) {
|
2018-08-08 18:48:23 +00:00
|
|
|
return {
|
|
|
|
type: SET_TILE_VIEW,
|
|
|
|
enabled
|
|
|
|
};
|
|
|
|
}
|
2019-05-18 20:40:58 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates a (redux) action which signals either to exit tile view if currently
|
|
|
|
* enabled or enter tile view if currently disabled.
|
|
|
|
*
|
|
|
|
* @returns {Function}
|
|
|
|
*/
|
|
|
|
export function toggleTileView() {
|
|
|
|
return (dispatch: Dispatch<any>, getState: Function) => {
|
2020-07-23 13:12:25 +00:00
|
|
|
const tileViewActive = shouldDisplayTileView(getState());
|
2019-05-18 20:40:58 +00:00
|
|
|
|
2020-07-23 13:12:25 +00:00
|
|
|
dispatch(setTileView(!tileViewActive));
|
2019-05-18 20:40:58 +00:00
|
|
|
};
|
|
|
|
}
|