|
|
|
@ -1,9 +1,11 @@ |
|
|
|
|
// @flow
|
|
|
|
|
import _ from 'lodash'; |
|
|
|
|
|
|
|
|
|
import { PREJOIN_INITIALIZED } from '../../prejoin/actionTypes'; |
|
|
|
|
import { APP_WILL_MOUNT } from '../app'; |
|
|
|
|
import { setAudioOnly } from '../audio-only'; |
|
|
|
|
import { SET_LOCATION_URL } from '../connection/actionTypes'; // minimize imports to avoid circular imports
|
|
|
|
|
import { getJwtName } from '../jwt/functions'; |
|
|
|
|
import { getLocalParticipant, participantUpdated } from '../participants'; |
|
|
|
|
import { MiddlewareRegistry } from '../redux'; |
|
|
|
|
import { parseURLParams } from '../util'; |
|
|
|
@ -27,6 +29,10 @@ MiddlewareRegistry.register(store => next => action => { |
|
|
|
|
case APP_WILL_MOUNT: |
|
|
|
|
_initializeCallIntegration(store); |
|
|
|
|
break; |
|
|
|
|
case PREJOIN_INITIALIZED: { |
|
|
|
|
_maybeUpdateDisplayName(store); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
case SETTINGS_UPDATED: |
|
|
|
|
_maybeHandleCallIntegrationChange(action); |
|
|
|
|
_maybeSetAudioOnly(store, action); |
|
|
|
@ -115,6 +121,26 @@ function _maybeSetAudioOnly( |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Updates the display name to the one in JWT if there is one. |
|
|
|
|
* |
|
|
|
|
* @param {Store} store - The redux store. |
|
|
|
|
* @private |
|
|
|
|
* @returns {void} |
|
|
|
|
*/ |
|
|
|
|
function _maybeUpdateDisplayName({ dispatch, getState }) { |
|
|
|
|
const state = getState(); |
|
|
|
|
const hasJwt = Boolean(state['features/base/jwt'].jwt); |
|
|
|
|
|
|
|
|
|
if (hasJwt) { |
|
|
|
|
const displayName = getJwtName(state); |
|
|
|
|
|
|
|
|
|
dispatch(updateSettings({ |
|
|
|
|
displayName |
|
|
|
|
})); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Updates the local participant according to settings changes. |
|
|
|
|
* |
|
|
|
|