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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /* @flow */
  2. import { MiddlewareRegistry } from '../base/redux';
  3. import { SET_CALL_OVERLAY_VISIBLE } from '../jwt';
  4. import Filmstrip from '../../../modules/UI/videolayout/Filmstrip';
  5. import UIEvents from '../../../service/UI/UIEvents';
  6. import {
  7. SET_FILMSTRIP_REMOTE_VIDEOS_VISIBLITY,
  8. SET_FILMSTRIP_VISIBILITY
  9. } from './actionTypes';
  10. declare var APP: Object;
  11. // eslint-disable-next-line no-unused-vars
  12. MiddlewareRegistry.register(({ getState }) => next => action => {
  13. switch (action.type) {
  14. case SET_CALL_OVERLAY_VISIBLE:
  15. if (typeof APP === 'undefined') {
  16. const oldValue
  17. = Boolean(getState()['features/jwt'].callOverlayVisible);
  18. const result = next(action);
  19. const newValue
  20. = Boolean(getState()['features/jwt'].callOverlayVisible);
  21. oldValue === newValue
  22. || Filmstrip.toggleFilmstrip(!newValue, false);
  23. return result;
  24. }
  25. break;
  26. case SET_FILMSTRIP_REMOTE_VIDEOS_VISIBLITY:
  27. case SET_FILMSTRIP_VISIBILITY: {
  28. const result = next(action);
  29. typeof APP === 'undefined'
  30. || APP.UI.emitEvent(UIEvents.UPDATED_FILMSTRIP_DISPLAY);
  31. return result;
  32. }
  33. }
  34. return next(action);
  35. });