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.

reducer.ts 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import ReducerRegistry from '../base/redux/ReducerRegistry';
  2. import {
  3. SET_CAR_MODE,
  4. SET_TILE_VIEW,
  5. VIRTUAL_SCREENSHARE_REMOTE_PARTICIPANTS_UPDATED
  6. } from './actionTypes';
  7. const DEFAULT_STATE = {
  8. /**
  9. * Whether we are in carmode.
  10. *
  11. * @public
  12. * @type {boolean}
  13. */
  14. carMode: false,
  15. remoteScreenShares: [],
  16. /**
  17. * The indicator which determines whether the video layout should display
  18. * video thumbnails in a tiled layout.
  19. *
  20. * Note: undefined means that the user hasn't requested anything in particular yet, so
  21. * we use our auto switching rules.
  22. *
  23. * @public
  24. * @type {boolean}
  25. */
  26. tileViewEnabled: undefined
  27. };
  28. export interface IVideoLayoutState {
  29. carMode: boolean;
  30. remoteScreenShares: string[];
  31. tileViewEnabled?: boolean;
  32. }
  33. const STORE_NAME = 'features/video-layout';
  34. ReducerRegistry.register<IVideoLayoutState>(STORE_NAME, (state = DEFAULT_STATE, action): IVideoLayoutState => {
  35. switch (action.type) {
  36. case VIRTUAL_SCREENSHARE_REMOTE_PARTICIPANTS_UPDATED:
  37. return {
  38. ...state,
  39. remoteScreenShares: action.participantIds
  40. };
  41. case SET_CAR_MODE:
  42. return {
  43. ...state,
  44. carMode: action.enabled
  45. };
  46. case SET_TILE_VIEW:
  47. return {
  48. ...state,
  49. tileViewEnabled: action.enabled
  50. };
  51. }
  52. return state;
  53. });