2018-02-14 18:28:22 +00:00
|
|
|
// @flow
|
|
|
|
|
2016-10-05 14:36:59 +00:00
|
|
|
import { ReducerRegistry } from '../redux';
|
|
|
|
|
|
|
|
import {
|
2017-02-27 22:45:53 +00:00
|
|
|
LIB_DID_DISPOSE,
|
|
|
|
LIB_DID_INIT,
|
2016-10-05 14:36:59 +00:00
|
|
|
LIB_INIT_ERROR,
|
2018-04-16 12:44:08 +00:00
|
|
|
LIB_INIT_PROMISE_CREATED,
|
2017-02-28 03:22:32 +00:00
|
|
|
SET_WEBRTC_READY
|
2016-10-05 14:36:59 +00:00
|
|
|
} from './actionTypes';
|
|
|
|
|
|
|
|
/**
|
2018-02-14 18:28:22 +00:00
|
|
|
* The default/initial redux state of the feature base/lib-jitsi-meet.
|
2016-10-05 14:36:59 +00:00
|
|
|
*
|
2017-04-23 20:14:02 +00:00
|
|
|
* @type {Object}
|
2016-10-05 14:36:59 +00:00
|
|
|
*/
|
2018-02-14 18:28:22 +00:00
|
|
|
const DEFAULT_STATE = {};
|
2016-10-05 14:36:59 +00:00
|
|
|
|
|
|
|
ReducerRegistry.register(
|
2016-10-25 16:43:15 +00:00
|
|
|
'features/base/lib-jitsi-meet',
|
2018-02-14 18:28:22 +00:00
|
|
|
(state = DEFAULT_STATE, action) => {
|
2016-10-05 14:36:59 +00:00
|
|
|
switch (action.type) {
|
2017-02-27 22:45:53 +00:00
|
|
|
case LIB_DID_DISPOSE:
|
2018-02-14 18:28:22 +00:00
|
|
|
return DEFAULT_STATE;
|
2016-10-05 14:36:59 +00:00
|
|
|
|
2017-02-27 22:45:53 +00:00
|
|
|
case LIB_DID_INIT:
|
2016-10-05 14:36:59 +00:00
|
|
|
return {
|
|
|
|
...state,
|
2017-02-27 22:45:53 +00:00
|
|
|
initError: undefined,
|
|
|
|
initialized: true
|
2016-10-05 14:36:59 +00:00
|
|
|
};
|
|
|
|
|
2017-02-27 22:45:53 +00:00
|
|
|
case LIB_INIT_ERROR:
|
2016-10-05 14:36:59 +00:00
|
|
|
return {
|
|
|
|
...state,
|
2017-02-27 22:45:53 +00:00
|
|
|
initError: action.error,
|
2018-04-16 12:44:08 +00:00
|
|
|
initialized: false,
|
|
|
|
initPromise: undefined
|
|
|
|
};
|
|
|
|
|
|
|
|
case LIB_INIT_PROMISE_CREATED:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
initPromise: action.initPromise
|
2016-10-05 14:36:59 +00:00
|
|
|
};
|
|
|
|
|
2017-02-28 03:22:32 +00:00
|
|
|
case SET_WEBRTC_READY:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
webRTCReady: action.webRTCReady
|
|
|
|
};
|
|
|
|
|
2016-10-05 14:36:59 +00:00
|
|
|
default:
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
});
|