chore(redux) remove legacy compatibility code
This commit is contained in:
parent
649ace1f44
commit
3e6c988c30
|
@ -11,11 +11,6 @@ import logger from './logger';
|
||||||
|
|
||||||
declare let __DEV__: any;
|
declare let __DEV__: any;
|
||||||
|
|
||||||
/**
|
|
||||||
* The name of the {@code localStorage} store where the app persists its values.
|
|
||||||
*/
|
|
||||||
const PERSISTED_STATE_NAME = 'jitsi-state';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mixed type of the element (subtree) config. If it's a {@code boolean} (and is
|
* Mixed type of the element (subtree) config. If it's a {@code boolean} (and is
|
||||||
* {@code true}), we persist the entire subtree. If it's an {@code Object}, we
|
* {@code true}), we persist the entire subtree. If it's an {@code Object}, we
|
||||||
|
@ -46,15 +41,12 @@ class PersistenceRegistry {
|
||||||
* @returns {Object}
|
* @returns {Object}
|
||||||
*/
|
*/
|
||||||
getPersistedState() {
|
getPersistedState() {
|
||||||
let filteredPersistedState: any = {};
|
const filteredPersistedState: any = {};
|
||||||
|
|
||||||
// localStorage key per feature
|
// localStorage key per feature
|
||||||
for (const subtreeName of Object.keys(this._elements)) {
|
for (const subtreeName of Object.keys(this._elements)) {
|
||||||
// Assumes that the persisted value is stored under the same key as
|
// Assumes that the persisted value is stored under the same key as
|
||||||
// the feature's redux state name.
|
// the feature's redux state name.
|
||||||
// TODO We'll need to introduce functions later that can control the
|
|
||||||
// persist key's name. Similar to control serialization and
|
|
||||||
// deserialization. But that should be a straightforward change.
|
|
||||||
const persistedSubtree
|
const persistedSubtree
|
||||||
= this._getPersistedSubtree(
|
= this._getPersistedSubtree(
|
||||||
subtreeName,
|
subtreeName,
|
||||||
|
@ -66,30 +58,6 @@ class PersistenceRegistry {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// legacy
|
|
||||||
if (Object.keys(filteredPersistedState).length === 0) {
|
|
||||||
let persistedState = jitsiLocalStorage.getItem(PERSISTED_STATE_NAME);
|
|
||||||
|
|
||||||
if (persistedState) {
|
|
||||||
try {
|
|
||||||
persistedState = Bourne.parse(persistedState);
|
|
||||||
} catch (error) {
|
|
||||||
logger.error(
|
|
||||||
'Error parsing persisted state',
|
|
||||||
persistedState,
|
|
||||||
error);
|
|
||||||
persistedState = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
filteredPersistedState = this._getFilteredState(persistedState);
|
|
||||||
|
|
||||||
// Store into the new format and delete the old format so that
|
|
||||||
// it's not used again.
|
|
||||||
this.persistState(filteredPersistedState);
|
|
||||||
jitsiLocalStorage.removeItem(PERSISTED_STATE_NAME);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initialize the checksum.
|
// Initialize the checksum.
|
||||||
this._checksum = this._calculateChecksum(filteredPersistedState);
|
this._checksum = this._calculateChecksum(filteredPersistedState);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue