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

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