Files
jitsi-meet/react/features/base/lib-jitsi-meet/reducer.js
Lyubomir Marinov d55e0f70d9 Import jitsi/jitsi-meet-react#2f23d98
As an intermediate step on the path to merging jitsi-meet and
jitsi-meet-react, import the whole source code of jitsi-meet-react as it
stands at
2f23d98424
i.e. the lastest master at the time of this import. No modifications are
applied to the imported source code in order to preserve a complete
snapshot of it in the repository of jitsi-meet and, thus, facilitate
comparison later on. Consequently, the source code of jitsi-meet and/or
jitsi-meet-react may not work. For example, jitsi-meet's jshint may be
unable to parse jitsi-meet-react's source code.
2016-10-12 10:31:52 -05:00

67 lines
1.7 KiB
JavaScript

import { ReducerRegistry } from '../redux';
import {
LIB_DISPOSED,
LIB_INIT_ERROR,
LIB_INITIALIZED,
SET_CONFIG
} from './actionTypes';
/**
* Initial state of 'features/base/lib'.
*
* @type {{
* initializationError: null,
* initialized: boolean
* }}
*/
const INITIAL_STATE = {
config: {
// FIXME Lib-jitsi-meet uses HTML script elements to asynchronously
// load certain pieces of JavaScript. Unfortunately, the technique
// doesn't work on React Native (because there are no HTML elements
// in the first place). Fortunately, these pieces of JavaScript
// currently involve third parties and we can temporarily disable
// them (until we implement an alternative to async script elements
// on React Native).
disableThirdPartyRequests: true
},
initializationError: null,
initialized: false
};
ReducerRegistry.register(
'features/base/lib',
(state = INITIAL_STATE, action) => {
switch (action.type) {
case LIB_DISPOSED:
return INITIAL_STATE;
case LIB_INIT_ERROR:
return {
...state,
initializationError: action.lib.error,
initialized: false
};
case LIB_INITIALIZED:
return {
...state,
initializationError: null,
initialized: true
};
case SET_CONFIG:
return {
...state,
config: {
...action.config,
...state.config
}
};
default:
return state;
}
});