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