Browse Source

edited for keychain & biometric authentication

pull/1/head
james 6 years ago
parent
commit
14f66a681d
  1. 42
      GMERemittance/Module/SendMoney/SendMoneyVerification/User Interface/View/SendMoneyVerificationViewController.swift

42
GMERemittance/Module/SendMoney/SendMoneyVerification/User Interface/View/SendMoneyVerificationViewController.swift

@ -70,6 +70,8 @@ class SendMoneyVerificationViewController: UITableViewController {
var isShowQwerty : Bool!
var isShowNumber : Bool!
var isUsingBiometricAuth = false
var encryptedText: String! {
didSet {
if mQwertyTransKeyView?.mTK_GetDataLength() != 0 {
@ -224,7 +226,33 @@ class SendMoneyVerificationViewController: UITableViewController {
func askPassword() {
if (self.requestModel?.autoDebitAccount?.type ?? "").lowercased() == "wallet" {
showQwertyTranskeyAction()
// showQwertyTranskeyAction()
let biometricAuthenticationWireframe = BiometricAuthenticationWireframe()
biometricAuthenticationWireframe.information = "Please enter authentication information for Remittance"
biometricAuthenticationWireframe.policy = .deviceOwnerAuthenticationWithBiometrics
let authViewController = biometricAuthenticationWireframe.getMainView()
biometricAuthenticationWireframe.completion = { [weak self] error in
if error != nil {
print("BiometricAuthenticationWireframe Error: \(error!)")
authViewController.dismiss(animated: true){
if error! == "You pressed password." {
self?.isUsingBiometricAuth = false
self?.showQwertyTranskeyAction()
}
}
} else {
self?.isUsingBiometricAuth = true
self?.password = KeyChain.shared.get(key: .password)
authViewController.dismiss(animated: true){}
}
}
self.present(authViewController, animated: true, completion: nil)
return
}
SendMoneyCodeWireframe().open(requestmodel: self.requestModel, completion: self.otpEntered, source: self)
@ -313,6 +341,18 @@ extension SendMoneyVerificationViewController: SendMoneyVerificationViewInterfac
func show(error: String) {
// self.presenter?.openReciept(transactionId: "1235")
if isUsingBiometricAuth {
if error.contains("Invalid Password") {
self.alertWithOk(message: "It is different from registered password.\nplease try to login again",
title: "Warning",
okTitle: "ok_text".localized(),
style: UIAlertControllerStyle.alert,
OkStyle: .destructive){
MainWireframe.logout()
}
}
}
self.alert(message: error)
}

Loading…
Cancel
Save