[RN] Enforce mandatory mobile app-specific config

This commit is contained in:
Lyubomir Marinov 2017-02-16 13:53:19 -06:00
parent 52b3eaacb5
commit 9ac7c97e67
1 changed files with 15 additions and 5 deletions

View File

@ -8,7 +8,7 @@ import {
} from './actionTypes'; } from './actionTypes';
/** /**
* Initial state of 'features/base/lib-jitsi-meet'. * The initial state of 'features/base/lib-jitsi-meet'.
* *
* @type {{ * @type {{
* initializationError: null, * initializationError: null,
@ -16,6 +16,14 @@ import {
* }} * }}
*/ */
const INITIAL_STATE = { const INITIAL_STATE = {
/**
* The mandatory configuration to be passed to JitsiMeetJS#init(). The app
* will download config.js from the Jitsi Meet deployment and taks its
* values into account but the values bellow will be enforced (because they
* are essential to the correct execution of the application).
*
* @type {Object}
*/
config: { config: {
// FIXME The support for audio levels in lib-jitsi-meet polls the // FIXME The support for audio levels in lib-jitsi-meet polls the
// statistics of WebRTC at a short interval multiple times a second. // statistics of WebRTC at a short interval multiple times a second.
@ -80,10 +88,12 @@ function _setConfig(state, action) {
return { return {
...state, ...state,
config: { config: {
// The final config is the result of augmenting the default config ...action.config,
// with whatever the deployment has chosen to override/overwrite.
...INITIAL_STATE.config, // The config of INITIAL_STATE is meant to override the config
...action.config // downloaded from the Jitsi Meet deployment because the former
// contains values that are mandatory.
...INITIAL_STATE.config
} }
}; };
} }