Introduce dueToTooManyErrors parameter

This commit is contained in:
ismailgulek
2020-09-29 17:46:07 +03:00
parent 208c1bb434
commit ef9b200939
12 changed files with 29 additions and 22 deletions

View File

@@ -65,8 +65,8 @@ extension EnterPinCodeCoordinator: EnterPinCodeViewModelCoordinatorDelegate {
self.delegate?.enterPinCodeCoordinatorDidComplete(self)
}
func enterPinCodeViewModelDidCompleteWithReset(_ viewModel: EnterPinCodeViewModelType) {
self.delegate?.enterPinCodeCoordinatorDidCompleteWithReset(self)
func enterPinCodeViewModelDidCompleteWithReset(_ viewModel: EnterPinCodeViewModelType, dueToTooManyErrors: Bool) {
self.delegate?.enterPinCodeCoordinatorDidCompleteWithReset(self, dueToTooManyErrors: dueToTooManyErrors)
}
func enterPinCodeViewModel(_ viewModel: EnterPinCodeViewModelType, didCompleteWithPin pin: String) {

View File

@@ -20,7 +20,7 @@ import Foundation
protocol EnterPinCodeCoordinatorDelegate: class {
func enterPinCodeCoordinatorDidComplete(_ coordinator: EnterPinCodeCoordinatorType)
func enterPinCodeCoordinatorDidCompleteWithReset(_ coordinator: EnterPinCodeCoordinatorType)
func enterPinCodeCoordinatorDidCompleteWithReset(_ coordinator: EnterPinCodeCoordinatorType, dueToTooManyErrors: Bool)
func enterPinCodeCoordinator(_ coordinator: EnterPinCodeCoordinatorType, didCompleteWithPin pin: String)
func enterPinCodeCoordinatorDidCancel(_ coordinator: EnterPinCodeCoordinatorType)
}

View File

@@ -72,7 +72,7 @@ final class EnterPinCodeViewModel: EnterPinCodeViewModelType {
// go back to first state
self.update(viewState: .choosePin)
case .forgotPinAlertResetAction:
self.coordinatorDelegate?.enterPinCodeViewModelDidCompleteWithReset(self)
self.coordinatorDelegate?.enterPinCodeViewModelDidCompleteWithReset(self, dueToTooManyErrors: false)
case .forgotPinAlertCancelAction:
// no-op
break
@@ -146,7 +146,7 @@ final class EnterPinCodeViewModel: EnterPinCodeViewModelType {
pinCodePreferences.numberOfPinFailures += 1
if viewMode == .unlock && localAuthenticationService.shouldLogOutUser() {
// log out user
self.coordinatorDelegate?.enterPinCodeViewModelDidCompleteWithReset(self)
self.coordinatorDelegate?.enterPinCodeViewModelDidCompleteWithReset(self, dueToTooManyErrors: true)
return
}
if numberOfFailuresDuringEnterPIN < pinCodePreferences.allowedNumberOfTrialsBeforeAlert {

View File

@@ -26,7 +26,7 @@ protocol EnterPinCodeViewModelViewDelegate: class {
protocol EnterPinCodeViewModelCoordinatorDelegate: class {
func enterPinCodeViewModelDidComplete(_ viewModel: EnterPinCodeViewModelType)
func enterPinCodeViewModelDidCompleteWithReset(_ viewModel: EnterPinCodeViewModelType)
func enterPinCodeViewModelDidCompleteWithReset(_ viewModel: EnterPinCodeViewModelType, dueToTooManyErrors: Bool)
func enterPinCodeViewModel(_ viewModel: EnterPinCodeViewModelType, didCompleteWithPin pin: String)
func enterPinCodeViewModelDidCancel(_ viewModel: EnterPinCodeViewModelType)
}