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

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