Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

middleware.native.ts 1.5KB

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