Implement biometrics module

This commit is contained in:
ismailgulek
2020-07-24 17:53:23 +03:00
parent b868a8fd00
commit 0df45f399c
16 changed files with 830 additions and 23 deletions
@@ -38,10 +38,10 @@ final class EnterPinCodeCoordinator: EnterPinCodeCoordinatorType {
// MARK: - Setup
init(session: MXSession?, viewMode: SetPinCoordinatorViewMode) {
init(session: MXSession?, viewMode: SetPinCoordinatorViewMode, pinCodePreferences: PinCodePreferences = .shared) {
self.session = session
let enterPinCodeViewModel = EnterPinCodeViewModel(session: self.session, viewMode: viewMode, pinCodePreferences: .shared)
let enterPinCodeViewModel = EnterPinCodeViewModel(session: self.session, viewMode: viewMode, pinCodePreferences: pinCodePreferences)
let enterPinCodeViewController = EnterPinCodeViewController.instantiate(with: enterPinCodeViewModel)
self.enterPinCodeViewModel = enterPinCodeViewModel
self.enterPinCodeViewController = enterPinCodeViewController
@@ -163,7 +163,7 @@ final class EnterPinCodeViewController: UIViewController {
self.renderConfirmPin()
case .pinsDontMatch:
self.renderPinsDontMatch()
case .unlockByPin:
case .unlock:
self.renderUnlockByPin()
case .wrongPin:
self.renderWrongPin()
@@ -109,7 +109,7 @@ final class EnterPinCodeViewModel: EnterPinCodeViewModelType {
update(viewState: .pinsDontMatch)
}
}
case .unlockByPin, .confirmPinToDeactivate:
case .unlock, .confirmPinToDeactivate:
// unlocking
if currentPin != pinCodePreferences.pin {
// no match
@@ -131,6 +131,8 @@ final class EnterPinCodeViewModel: EnterPinCodeViewModelType {
self.coordinatorDelegate?.enterPinCodeViewModelDidComplete(self)
}
}
default:
break
}
return
}
@@ -141,10 +143,12 @@ final class EnterPinCodeViewModel: EnterPinCodeViewModelType {
switch viewMode {
case .setPin:
update(viewState: .choosePin)
case .unlockByPin:
update(viewState: .unlockByPin)
case .unlock:
update(viewState: .unlock)
case .confirmPinToDeactivate:
update(viewState: .confirmPinToDisable)
default:
break
}
}
@@ -23,7 +23,7 @@ enum EnterPinCodeViewState {
case choosePin // creating pin for the first time, enter for first
case confirmPin // creating pin for the first time, confirm
case pinsDontMatch // pins don't match
case unlockByPin // after pin has been set, enter pin to unlock
case unlock // after pin has been set, enter pin to unlock
case wrongPin // after pin has been set, pin entered wrongly
case wrongPinTooManyTimes // after pin has been set, pin entered wrongly too many times
case forgotPin // after pin has been set, user tapped forgot pin