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

middleware.native.js 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // @flow
  2. import { PARTICIPANT_JOINED, PARTICIPANT_LEFT } from '../base/participants';
  3. import { MiddlewareRegistry } from '../base/redux';
  4. import { CLIENT_RESIZED, SAFE_AREA_INSETS_CHANGED, SET_ASPECT_RATIO } from '../base/responsive-ui';
  5. import { setTileViewDimensions } from './actions';
  6. import { updateRemoteParticipants, updateRemoteParticipantsOnLeave } from './functions';
  7. import './subscriber';
  8. /**
  9. * The middleware of the feature Filmstrip.
  10. */
  11. MiddlewareRegistry.register(store => next => action => {
  12. if (action.type === PARTICIPANT_LEFT) {
  13. // This have to be executed before we remove the participant from features/base/participants state in order to
  14. // remove the related thumbnail component before we need to re-render it. If we do this after next()
  15. // we will be in sitation where the participant exists in the remoteParticipants array in features/filmstrip
  16. // but doesn't exist in features/base/participants state which will lead to rendering a thumbnail for
  17. // non-existing participant.
  18. updateRemoteParticipantsOnLeave(store, action.participant?.id);
  19. }
  20. const result = next(action);
  21. switch (action.type) {
  22. case CLIENT_RESIZED:
  23. case SAFE_AREA_INSETS_CHANGED:
  24. case SET_ASPECT_RATIO:
  25. store.dispatch(setTileViewDimensions());
  26. break;
  27. case PARTICIPANT_JOINED: {
  28. updateRemoteParticipants(store, action.participant?.id);
  29. break;
  30. }
  31. }
  32. return result;
  33. });