Issue #258 - User can take the backup test successfully more than once (#282)

Closes #258

this checks that when the user taps the finished button on the phrase displayed it has definitely not passed the test before going to the recovery flow.

Note: this should actually go to the next or previous screen according to the context.

That should be taken into consideration when implementing the profile screen that takes the user to the phrase diplay screen from that context.

Add //TODO comment with the permanent fix for the problem
This commit is contained in:
Francisco Gindre 2022-04-21 09:33:55 -03:00 committed by GitHub
parent 96511e0e36
commit c832d2822c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 2 deletions

View File

@ -250,7 +250,7 @@ extension AppReducer {
}
}
private static let routeReducer = AppReducer { state, action, _ in
private static let routeReducer = AppReducer { state, action, environment in
switch action {
case let .updateRoute(route):
state.route = route
@ -269,7 +269,14 @@ extension AppReducer {
state.route = .phraseDisplay
case .phraseDisplay(.finishedPressed):
state.route = .phraseValidation
//TODO: Advanced Routing: setting a route may vary depending on the originating context #285
// see https://github.com/zcash/secant-ios-wallet/issues/285
if let storedWallet = try? environment.walletStorage.exportWallet(),
storedWallet.hasUserPassedPhraseBackupTest {
state.route = .home
} else {
state.route = .phraseValidation
}
/// Default is meaningful here because there's `appReducer` handling actions and this reducer is handling only routes. We don't here plenty of unused cases.
default: