Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. // @flow
  2. import Filmstrip from '../../../modules/UI/videolayout/Filmstrip';
  3. import { MiddlewareRegistry } from '../base/redux';
  4. import { CLIENT_RESIZED } from '../base/responsive-ui';
  5. import {
  6. getCurrentLayout,
  7. LAYOUTS,
  8. shouldDisplayTileView
  9. } from '../video-layout';
  10. import { SET_HORIZONTAL_VIEW_DIMENSIONS, SET_TILE_VIEW_DIMENSIONS } from './actionTypes';
  11. import { setHorizontalViewDimensions, setTileViewDimensions } from './actions.web';
  12. import './subscriber.web';
  13. /**
  14. * The middleware of the feature Filmstrip.
  15. */
  16. MiddlewareRegistry.register(store => next => action => {
  17. const result = next(action);
  18. switch (action.type) {
  19. case CLIENT_RESIZED: {
  20. const state = store.getState();
  21. const layout = getCurrentLayout(state);
  22. switch (layout) {
  23. case LAYOUTS.TILE_VIEW: {
  24. const { gridDimensions } = state['features/filmstrip'].tileViewDimensions;
  25. const { clientHeight, clientWidth } = state['features/base/responsive-ui'];
  26. const { isOpen } = state['features/chat'];
  27. store.dispatch(
  28. setTileViewDimensions(
  29. gridDimensions,
  30. {
  31. clientHeight,
  32. clientWidth
  33. },
  34. isOpen
  35. )
  36. );
  37. break;
  38. }
  39. case LAYOUTS.HORIZONTAL_FILMSTRIP_VIEW:
  40. store.dispatch(setHorizontalViewDimensions(state['features/base/responsive-ui'].clientHeight));
  41. break;
  42. }
  43. break;
  44. }
  45. case SET_TILE_VIEW_DIMENSIONS: {
  46. const state = store.getState();
  47. if (shouldDisplayTileView(state)) {
  48. const { width, height } = state['features/filmstrip'].tileViewDimensions.thumbnailSize;
  49. // Once the thumbnails are reactified this should be moved there too.
  50. Filmstrip.resizeThumbnailsForTileView(width, height, true);
  51. }
  52. break;
  53. }
  54. case SET_HORIZONTAL_VIEW_DIMENSIONS: {
  55. const state = store.getState();
  56. if (getCurrentLayout(state) === LAYOUTS.HORIZONTAL_FILMSTRIP_VIEW) {
  57. const { horizontalViewDimensions = {} } = state['features/filmstrip'];
  58. // Once the thumbnails are reactified this should be moved there too.
  59. Filmstrip.resizeThumbnailsForHorizontalView(horizontalViewDimensions, true);
  60. }
  61. break;
  62. }
  63. }
  64. return result;
  65. });