An advanced Ethereum/EVM mobile wallet
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
alpha-wallet-ios/Trust/Lock/ViewControllers/LockCreatePasscodeViewContr...

37 lines
1.3 KiB

// Copyright SIX DAY LLC. All rights reserved.
import UIKit
class LockCreatePasscodeViewController: LockPasscodeViewController {
private lazy var lockCreatePasscodeViewModel: LockCreatePasscodeViewModel? = {
return self.model as? LockCreatePasscodeViewModel
}()
private var firstPasscode: String?
override func viewDidLoad() {
super.viewDidLoad()
self.title = lockCreatePasscodeViewModel?.title
self.lockView.lockTitle.text = lockCreatePasscodeViewModel?.initialLabelText
}
override func enteredPasscode(_ passcode: String) {
super.enteredPasscode(passcode)
if let first = firstPasscode {
if passcode == first {
lock.setPasscode(passcode: passcode)
finish(withResult: true, animated: true)
} else {
lockView.shake()
firstPasscode = nil
showFirstPasscodeView()
}
} else {
firstPasscode = passcode
showConfirmPasscodeView()
}
}
private func showFirstPasscodeView() {
self.lockView.lockTitle.text = lockCreatePasscodeViewModel?.initialLabelText
}
private func showConfirmPasscodeView() {
self.lockView.lockTitle.text = lockCreatePasscodeViewModel?.confirmLabelText
}
}