2020-04-22 19:11:36 +02:00
|
|
|
import { cloneDeep } from 'lodash'
|
|
|
|
|
2020-08-19 18:27:05 +02:00
|
|
|
const version = 42
|
|
|
|
|
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-08-19 18:27:05 +02:00
|
|
|
async migrate (originalVersionedData) {
|
2020-04-22 19:11:36 +02:00
|
|
|
const versionedData = cloneDeep(originalVersionedData)
|
|
|
|
versionedData.meta.version = version
|
|
|
|
const state = versionedData.data
|
|
|
|
versionedData.data = transformState(state)
|
|
|
|
return versionedData
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
function transformState (state) {
|
|
|
|
if (state.AppStateController) {
|
|
|
|
state.AppStateController.connectedStatusPopoverHasBeenShown = false
|
|
|
|
} else {
|
|
|
|
state.AppStateController = {
|
|
|
|
connectedStatusPopoverHasBeenShown: false,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return state
|
|
|
|
}
|