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

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