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.

middleware.native.ts 1.1KB

12345678910111213141516171819202122232425262728293031323334
  1. import { setVideoMuted } from '../base/media/actions';
  2. import { VIDEO_MUTISM_AUTHORITY } from '../base/media/constants';
  3. import MiddlewareRegistry from '../base/redux/MiddlewareRegistry';
  4. import { CLIENT_RESIZED } from '../base/responsive-ui/actionTypes';
  5. import { setLargeVideoDimensions } from '../large-video/actions.any';
  6. import { SET_CAR_MODE } from './actionTypes';
  7. import './middleware.any';
  8. /**
  9. * Middleware which intercepts actions and updates the legacy component.
  10. *
  11. * @param {Store} store - The redux store.
  12. * @returns {Function}
  13. */
  14. MiddlewareRegistry.register(store => next => action => {
  15. const result = next(action);
  16. const { dispatch } = store;
  17. switch (action.type) {
  18. case SET_CAR_MODE:
  19. dispatch(setVideoMuted(action.enabled, VIDEO_MUTISM_AUTHORITY.CAR_MODE));
  20. break;
  21. case CLIENT_RESIZED: {
  22. const { clientHeight, clientWidth } = store.getState()['features/base/responsive-ui'];
  23. // On mobile the large video should always fill the screen.
  24. dispatch(setLargeVideoDimensions(clientHeight, clientWidth));
  25. break;
  26. }
  27. }
  28. return result;
  29. });