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.any.ts 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import { IStore } from '../app/types';
  2. import {
  3. SET_TILE_VIEW,
  4. VIRTUAL_SCREENSHARE_REMOTE_PARTICIPANTS_UPDATED
  5. } from './actionTypes';
  6. import { shouldDisplayTileView } from './functions';
  7. /**
  8. * Creates a (redux) action which signals that the list of known remote virtual screen share participant ids has
  9. * changed.
  10. *
  11. * @param {string} participantIds - The remote virtual screen share participants.
  12. * @returns {{
  13. * type: VIRTUAL_SCREENSHARE_REMOTE_PARTICIPANTS_UPDATED,
  14. * participantIds: Array<string>
  15. * }}
  16. */
  17. export function virtualScreenshareParticipantsUpdated(participantIds: Array<string>) {
  18. return {
  19. type: VIRTUAL_SCREENSHARE_REMOTE_PARTICIPANTS_UPDATED,
  20. participantIds
  21. };
  22. }
  23. /**
  24. * Creates a (redux) action which signals to set the UI layout to be tiled view
  25. * or not.
  26. *
  27. * @param {boolean} enabled - Whether or not tile view should be shown.
  28. * @returns {{
  29. * type: SET_TILE_VIEW,
  30. * enabled: ?boolean
  31. * }}
  32. */
  33. export function setTileView(enabled?: boolean) {
  34. return {
  35. type: SET_TILE_VIEW,
  36. enabled
  37. };
  38. }
  39. /**
  40. * Creates a (redux) action which signals either to exit tile view if currently
  41. * enabled or enter tile view if currently disabled.
  42. *
  43. * @returns {Function}
  44. */
  45. export function toggleTileView() {
  46. return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
  47. const tileViewActive = shouldDisplayTileView(getState());
  48. dispatch(setTileView(!tileViewActive));
  49. };
  50. }