diff --git a/app/init/global_event_handler.js b/app/init/global_event_handler.js index e830c10b5..5418052bf 100644 --- a/app/init/global_event_handler.js +++ b/app/init/global_event_handler.js @@ -280,6 +280,7 @@ class GlobalEventHandler { app: { build: DeviceInfo.getBuildNumber(), version: DeviceInfo.getVersion(), + previousVersion: state.app?.previousVersion || DeviceInfo.getVersion(), }, }, }, diff --git a/app/store/utils.js b/app/store/utils.js index 74b75b433..5680af4a5 100644 --- a/app/store/utils.js +++ b/app/store/utils.js @@ -2,7 +2,6 @@ // See LICENSE.txt for license information. import merge from 'deepmerge'; -import DeviceInfo from 'react-native-device-info'; function transformFromSet(incoming) { const state = {...incoming}; @@ -67,6 +66,7 @@ export function waitForHydration(store, callback) { } export function getStateForReset(initialState, currentState) { + const {app} = currentState; const {currentUserId} = currentState.entities.users; const currentUserProfile = currentState.entities.users.profiles[currentUserId]; const {currentTeamId} = currentState.entities.teams; @@ -78,10 +78,7 @@ export function getStateForReset(initialState, currentState) { }); const resetState = merge(initialState, { - app: { - build: DeviceInfo.getBuildNumber(), - version: DeviceInfo.getVersion(), - }, + app, entities: { users: { currentUserId, diff --git a/app/store/utils.test.js b/app/store/utils.test.js index 305fbce97..c8dac7cdd 100644 --- a/app/store/utils.test.js +++ b/app/store/utils.test.js @@ -20,6 +20,11 @@ describe('getStateForReset', () => { const otherUserId = 'other-user-id'; const currentTeamId = 'current-team-id'; const currentState = { + app: { + build: 'build', + version: 'version', + previousVersion: 'previousVersion', + }, entities: { users: { currentUserId, @@ -76,4 +81,10 @@ describe('getStateForReset', () => { expect(themeKeys.length).not.toEqual(0); expect(themeKeys.length).toEqual(preferenceKeys.length); }); + + it('should keep app', () => { + const resetState = getStateForReset(initialState, currentState); + const {app} = resetState; + expect(app).toStrictEqual(currentState.app); + }); });