settings: fix loading disableCallIntegration

This commit is contained in:
Saúl Ibarra Corretgé 2019-11-08 11:52:21 +01:00 committed by Saúl Ibarra Corretgé
parent 4d243f9b92
commit 3cd7f0b77d
1 changed files with 21 additions and 1 deletions

View File

@ -1,5 +1,6 @@
// @flow
import { APP_WILL_MOUNT } from '../app';
import { setAudioOnly } from '../audio-only';
import { getLocalParticipant, participantUpdated } from '../participants';
import { MiddlewareRegistry } from '../redux';
@ -19,15 +20,34 @@ MiddlewareRegistry.register(store => next => action => {
const result = next(action);
switch (action.type) {
case APP_WILL_MOUNT:
_initializeCallIntegration(store);
break;
case SETTINGS_UPDATED:
_maybeHandleCallIntegrationChange(action);
_maybeSetAudioOnly(store, action);
_updateLocalParticipant(store, action);
break;
}
return result;
});
/**
* Initializes the audio device handler based on the `disableCallIntegration` setting.
*
* @param {Store} store - The redux store.
* @private
* @returns {void}
*/
function _initializeCallIntegration({ getState }) {
const { disableCallIntegration } = getState()['features/base/settings'];
if (typeof disableCallIntegration === 'boolean') {
handleCallIntegrationChange(disableCallIntegration);
}
}
/**
* Maps the settings field names to participant names where they don't match.
* Currently there is only one such field, but may be extended in the future.
@ -46,7 +66,7 @@ function _mapSettingsFieldToParticipant(settingsField) {
}
/**
* Updates {@code startAudioOnly} flag if it's updated in the settings.
* Handles a change in the `disableCallIntegration` setting.
*
* @param {Object} action - The redux action.
* @private