2020-04-16 10:47:10 +00:00
|
|
|
// @flow
|
|
|
|
|
2020-05-20 10:57:03 +00:00
|
|
|
import { MiddlewareRegistry } from '../base/redux';
|
|
|
|
import { updateSettings } from '../base/settings';
|
|
|
|
|
2020-06-19 07:03:26 +00:00
|
|
|
import { PREJOIN_START_CONFERENCE } from './actionTypes';
|
2020-04-16 10:47:10 +00:00
|
|
|
|
|
|
|
declare var APP: Object;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The redux middleware for {@link PrejoinPage}.
|
|
|
|
*
|
|
|
|
* @param {Store} store - The redux store.
|
|
|
|
* @returns {Function}
|
|
|
|
*/
|
|
|
|
MiddlewareRegistry.register(store => next => async action => {
|
|
|
|
switch (action.type) {
|
|
|
|
case PREJOIN_START_CONFERENCE: {
|
2020-05-07 07:42:55 +00:00
|
|
|
const { getState, dispatch } = store;
|
|
|
|
const state = getState();
|
|
|
|
const { userSelectedSkipPrejoin } = state['features/prejoin'];
|
2020-06-19 07:03:26 +00:00
|
|
|
const tracks = state['features/base/tracks'];
|
2020-05-07 07:42:55 +00:00
|
|
|
|
|
|
|
userSelectedSkipPrejoin && dispatch(updateSettings({
|
|
|
|
userSelectedSkipPrejoin
|
|
|
|
}));
|
2020-04-16 10:47:10 +00:00
|
|
|
|
2020-06-19 07:03:26 +00:00
|
|
|
APP.conference.prejoinStart(tracks.map(t => t.jitsiTrack));
|
2020-04-16 10:47:10 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return next(action);
|
|
|
|
});
|