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.

subscriber.native.js 1.0KB

1234567891011121314151617181920212223242526272829303132
  1. // @flow
  2. import { StateListenerRegistry } from '../base/redux';
  3. import { shouldDisplayTileView } from '../video-layout';
  4. import { setTileViewDimensions } from './actions';
  5. import { getTileViewParticipantCount } from './functions.native';
  6. import './subscriber.any';
  7. /**
  8. * Listens for changes in the number of participants to calculate the dimensions of the tile view grid and the tiles.
  9. */
  10. StateListenerRegistry.register(
  11. /* selector */ state => getTileViewParticipantCount(state),
  12. /* listener */ (_, store) => {
  13. const state = store.getState();
  14. if (shouldDisplayTileView(state)) {
  15. store.dispatch(setTileViewDimensions());
  16. }
  17. });
  18. /**
  19. * Listens for changes in the selected layout to calculate the dimensions of the tile view grid and horizontal view.
  20. */
  21. StateListenerRegistry.register(
  22. /* selector */ state => shouldDisplayTileView(state),
  23. /* listener */ (isTileView, store) => {
  24. if (isTileView) {
  25. store.dispatch(setTileViewDimensions());
  26. }
  27. });