fix(settings) remove legacy compatibility code
This commit is contained in:
parent
c6bb600d4c
commit
12877c7fce
|
@ -4,12 +4,10 @@ import { jitsiLocalStorage } from '@jitsi/js-utils';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
|
|
||||||
import { APP_WILL_MOUNT } from '../app/actionTypes';
|
import { APP_WILL_MOUNT } from '../app/actionTypes';
|
||||||
import { browser } from '../lib-jitsi-meet';
|
|
||||||
import { PersistenceRegistry, ReducerRegistry } from '../redux';
|
import { PersistenceRegistry, ReducerRegistry } from '../redux';
|
||||||
import { assignIfDefined } from '../util';
|
import { assignIfDefined } from '../util';
|
||||||
|
|
||||||
import { SETTINGS_UPDATED } from './actionTypes';
|
import { SETTINGS_UPDATED } from './actionTypes';
|
||||||
import logger from './logger';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default/initial redux state of the feature {@code base/settings}.
|
* The default/initial redux state of the feature {@code base/settings}.
|
||||||
|
@ -75,41 +73,10 @@ ReducerRegistry.register(STORE_NAME, (state = DEFAULT_STATE, action) => {
|
||||||
return state;
|
return state;
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieves the legacy profile values regardless of it's being in pre or
|
|
||||||
* post-flattening format.
|
|
||||||
*
|
|
||||||
* FIXME: Let's remove this after a predefined time (e.g. By July 2018) to avoid
|
|
||||||
* garbage in the source.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @returns {Object}
|
|
||||||
*/
|
|
||||||
function _getLegacyProfile() {
|
|
||||||
let persistedProfile = jitsiLocalStorage.getItem('features/base/profile');
|
|
||||||
|
|
||||||
if (persistedProfile) {
|
|
||||||
try {
|
|
||||||
persistedProfile = JSON.parse(persistedProfile);
|
|
||||||
|
|
||||||
if (persistedProfile && typeof persistedProfile === 'object') {
|
|
||||||
const preFlattenedProfile = persistedProfile.profile;
|
|
||||||
|
|
||||||
return preFlattenedProfile || persistedProfile;
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
logger.warn('Error parsing persisted legacy profile', e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inits the settings object based on what information we have available.
|
* Inits the settings object based on what information we have available.
|
||||||
* Info taken into consideration:
|
* Info taken into consideration:
|
||||||
* - Old Settings.js style data
|
* - Old Settings.js style data.
|
||||||
* - Things that we stored in profile earlier but belong here.
|
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {Object} featureState - The current state of the feature.
|
* @param {Object} featureState - The current state of the feature.
|
||||||
|
@ -138,28 +105,5 @@ function _initSettings(featureState) {
|
||||||
email
|
email
|
||||||
}, settings);
|
}, settings);
|
||||||
|
|
||||||
if (!browser.isReactNative()) {
|
|
||||||
// Browser only
|
|
||||||
const localFlipX = JSON.parse(jitsiLocalStorage.getItem('localFlipX') || 'true');
|
|
||||||
const cameraDeviceId = jitsiLocalStorage.getItem('cameraDeviceId') || '';
|
|
||||||
const micDeviceId = jitsiLocalStorage.getItem('micDeviceId') || '';
|
|
||||||
|
|
||||||
// Currently audio output device change is supported only in Chrome and
|
|
||||||
// default output always has 'default' device ID
|
|
||||||
const audioOutputDeviceId = jitsiLocalStorage.getItem('audioOutputDeviceId') || 'default';
|
|
||||||
|
|
||||||
settings = assignIfDefined({
|
|
||||||
audioOutputDeviceId,
|
|
||||||
cameraDeviceId,
|
|
||||||
localFlipX,
|
|
||||||
micDeviceId
|
|
||||||
}, settings);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Things we stored in profile earlier
|
|
||||||
const legacyProfile = _getLegacyProfile();
|
|
||||||
|
|
||||||
settings = assignIfDefined(legacyProfile, settings);
|
|
||||||
|
|
||||||
return settings;
|
return settings;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue