-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
US-1954 Fixed issue where the app was not triggering the keysExist fl… (
#762) * US-1954 Fixed issue where the app was not triggering the keysExist flow because it was being flushed. The storage has been moved away from the main chainId and defined as a chainId 0 so that it is not deleted (and hardcoded because that persistedData is shared among chainIds) * Created update so that users don't lose their wallets. * Moved PIN to persistentData * Created first migration for persistentData * Fixed pin
- Loading branch information
1 parent
132a451
commit bdf6376
Showing
10 changed files
with
110 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { createSlice, PayloadAction } from '@reduxjs/toolkit' | ||
|
||
import { PersistentDataState } from './types' | ||
|
||
const initialState: PersistentDataState = { | ||
keysExist: false, | ||
isFirstLaunch: true, | ||
pin: null, | ||
} | ||
|
||
/** | ||
* Data that will be persisted across chain ID switches | ||
*/ | ||
const persistentDataSlice = createSlice({ | ||
name: 'persistentData', | ||
initialState, | ||
reducers: { | ||
setKeysExist: (state, { payload }: PayloadAction<boolean>) => { | ||
state.keysExist = payload | ||
}, | ||
setIsFirstLaunch: (state, { payload }: PayloadAction<boolean>) => { | ||
state.isFirstLaunch = payload | ||
}, | ||
setPinState: (state, { payload }: PayloadAction<string | null>) => { | ||
state.pin = payload | ||
}, | ||
}, | ||
}) | ||
|
||
export const { setKeysExist, setIsFirstLaunch, setPinState } = | ||
persistentDataSlice.actions | ||
|
||
export const persistentDataReducer = persistentDataSlice.reducer | ||
|
||
export * from './types' | ||
export * from './selectors' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { RootState } from 'src/redux' | ||
|
||
export const selectKeysExist = ({ persistentData }: RootState) => | ||
persistentData.keysExist | ||
|
||
export const selectPin = ({ persistentData }: RootState) => persistentData.pin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export interface PersistentDataState { | ||
keysExist: boolean | ||
isFirstLaunch: boolean | ||
pin: string | null | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters