2020-11-04 08:32:06 +00:00
|
|
|
|
2022-04-06 02:13:39 +00:00
|
|
|
import {
|
|
|
|
setPrejoinPageVisibility,
|
|
|
|
setSkipPrejoinOnReload
|
2022-10-28 10:07:58 +00:00
|
|
|
} from '../../prejoin/actions.web';
|
2022-10-06 17:18:22 +00:00
|
|
|
import { JitsiConferenceErrors } from '../lib-jitsi-meet';
|
2020-11-04 08:32:06 +00:00
|
|
|
import { MiddlewareRegistry } from '../redux';
|
|
|
|
|
2022-09-27 07:10:28 +00:00
|
|
|
import { CONFERENCE_FAILED, CONFERENCE_JOINED, CONFERENCE_JOIN_IN_PROGRESS } from './actionTypes';
|
2020-11-04 08:32:06 +00:00
|
|
|
import './middleware.any';
|
|
|
|
|
2022-03-15 17:24:49 +00:00
|
|
|
MiddlewareRegistry.register(store => next => action => {
|
|
|
|
const { dispatch, getState } = store;
|
2021-02-04 17:33:18 +00:00
|
|
|
const { enableForcedReload } = getState()['features/base/config'];
|
|
|
|
|
2020-11-04 08:32:06 +00:00
|
|
|
switch (action.type) {
|
2022-04-06 02:13:39 +00:00
|
|
|
case CONFERENCE_JOIN_IN_PROGRESS: {
|
|
|
|
dispatch(setPrejoinPageVisibility(false));
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2021-02-04 17:33:18 +00:00
|
|
|
case CONFERENCE_JOINED: {
|
|
|
|
if (enableForcedReload) {
|
|
|
|
dispatch(setSkipPrejoinOnReload(false));
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case CONFERENCE_FAILED: {
|
2022-06-07 20:17:49 +00:00
|
|
|
const errorName = action.error?.name;
|
|
|
|
|
2022-07-04 19:47:59 +00:00
|
|
|
if (enableForcedReload && errorName === JitsiConferenceErrors.CONFERENCE_RESTARTED) {
|
2022-06-07 20:17:49 +00:00
|
|
|
dispatch(setSkipPrejoinOnReload(true));
|
|
|
|
}
|
2021-02-04 17:33:18 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2022-03-15 17:24:49 +00:00
|
|
|
}
|
2020-11-04 08:32:06 +00:00
|
|
|
|
|
|
|
return next(action);
|
|
|
|
});
|