2021-08-23 23:02:41 +00:00
|
|
|
// @flow
|
|
|
|
|
2021-08-20 23:32:38 +00:00
|
|
|
import { StateListenerRegistry } from '../base/redux';
|
2022-03-11 00:27:37 +00:00
|
|
|
import { shouldDisplayTileView } from '../video-layout';
|
2021-08-20 23:32:38 +00:00
|
|
|
|
2022-10-18 10:11:16 +00:00
|
|
|
import { setRemoteParticipants, setTileViewDimensions } from './actions';
|
2022-05-06 10:18:57 +00:00
|
|
|
import { getTileViewParticipantCount } from './functions.native';
|
2021-08-23 23:02:41 +00:00
|
|
|
import './subscriber.any';
|
2021-08-20 23:32:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Listens for changes in the number of participants to calculate the dimensions of the tile view grid and the tiles.
|
|
|
|
*/
|
|
|
|
StateListenerRegistry.register(
|
2022-05-06 10:18:57 +00:00
|
|
|
/* selector */ state => getTileViewParticipantCount(state),
|
2021-08-20 23:32:38 +00:00
|
|
|
/* listener */ (_, store) => {
|
|
|
|
const state = store.getState();
|
|
|
|
|
|
|
|
if (shouldDisplayTileView(state)) {
|
|
|
|
store.dispatch(setTileViewDimensions());
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Listens for changes in the selected layout to calculate the dimensions of the tile view grid and horizontal view.
|
|
|
|
*/
|
|
|
|
StateListenerRegistry.register(
|
|
|
|
/* selector */ state => shouldDisplayTileView(state),
|
|
|
|
/* listener */ (isTileView, store) => {
|
|
|
|
if (isTileView) {
|
2022-03-11 00:27:37 +00:00
|
|
|
store.dispatch(setTileViewDimensions());
|
2021-08-20 23:32:38 +00:00
|
|
|
}
|
|
|
|
});
|
2022-10-18 10:11:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Listens for changes in the current conference and clears remote participants from this feature.
|
|
|
|
*/
|
|
|
|
StateListenerRegistry.register(
|
|
|
|
state => state['features/base/conference'].conference,
|
|
|
|
(conference, { dispatch }, previousConference) => {
|
|
|
|
if (conference !== previousConference) {
|
|
|
|
dispatch(setRemoteParticipants([]));
|
|
|
|
}
|
|
|
|
});
|