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

12345678910111213141516171819202122232425262728293031323334353637
  1. /* @flow */
  2. import { MiddlewareRegistry } from '../base/redux';
  3. import { SET_CALL_OVERLAY_VISIBLE } from '../base/jwt';
  4. import Filmstrip from '../../../modules/UI/videolayout/Filmstrip';
  5. declare var APP: Object;
  6. // eslint-disable-next-line no-unused-vars
  7. MiddlewareRegistry.register(({ getState }) => next => action => {
  8. switch (action.type) {
  9. case SET_CALL_OVERLAY_VISIBLE:
  10. if (typeof APP !== 'undefined') {
  11. const oldValue
  12. = Boolean(getState()['features/base/jwt'].callOverlayVisible);
  13. const result = next(action);
  14. const newValue
  15. = Boolean(getState()['features/base/jwt'].callOverlayVisible);
  16. oldValue === newValue
  17. // FIXME The following accesses the private state filmstrip of
  18. // Filmstrip. It is written with the understanding that
  19. // Filmstrip will be rewritten in React and, consequently, will
  20. // not need the middleware implemented here, Filmstrip.init, and
  21. // UI.start.
  22. || (Filmstrip.filmstrip
  23. && Filmstrip.toggleFilmstrip(!newValue, false));
  24. return result;
  25. }
  26. break;
  27. }
  28. return next(action);
  29. });