2021-02-04 19:15:23 +01:00
|
|
|
import { cloneDeep } from 'lodash';
|
2020-04-22 19:11:36 +02:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
const version = 42;
|
2020-08-19 18:27:05 +02:00
|
|
|
|
2020-04-22 19:11:36 +02:00
|
|
|
/**
|
2020-04-24 04:08:50 +02:00
|
|
|
* Initialize `connectedStatusPopoverHasBeenShown` to `false` if it hasn't yet been set,
|
|
|
|
* so that existing users are introduced to the new connected status indicator
|
2020-04-22 19:11:36 +02:00
|
|
|
*/
|
|
|
|
export default {
|
|
|
|
version,
|
2020-11-03 00:41:28 +01:00
|
|
|
async migrate(originalVersionedData) {
|
2021-02-04 19:15:23 +01:00
|
|
|
const versionedData = cloneDeep(originalVersionedData);
|
|
|
|
versionedData.meta.version = version;
|
|
|
|
const state = versionedData.data;
|
|
|
|
versionedData.data = transformState(state);
|
|
|
|
return versionedData;
|
2020-04-22 19:11:36 +02:00
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2020-04-22 19:11:36 +02:00
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
function transformState(state) {
|
2020-04-22 19:11:36 +02:00
|
|
|
if (state.AppStateController) {
|
2021-02-04 19:15:23 +01:00
|
|
|
state.AppStateController.connectedStatusPopoverHasBeenShown = false;
|
2020-04-22 19:11:36 +02:00
|
|
|
} else {
|
|
|
|
state.AppStateController = {
|
|
|
|
connectedStatusPopoverHasBeenShown: false,
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2020-04-22 19:11:36 +02:00
|
|
|
}
|
2021-02-04 19:15:23 +01:00
|
|
|
return state;
|
2020-04-22 19:11:36 +02:00
|
|
|
}
|