Skip to content

Commit

Permalink
settings: fix loading disableCallIntegration
Browse files Browse the repository at this point in the history
  • Loading branch information
saghul committed Nov 8, 2019
1 parent 53ebab3 commit fbdd1d2
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion react/features/base/settings/middleware.js
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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.
Expand All @@ -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
Expand Down

0 comments on commit fbdd1d2

Please sign in to comment.