Remove checks for iOS 8 as the minimum deployment target is iOS 10.2

This commit is contained in:
Danny Moesch 2019-10-01 22:52:59 +02:00
parent 51c9510f3d
commit b349427d7e

View file

@ -55,20 +55,16 @@ open class PasscodeLockViewController: UIViewController, UITextFieldDelegate {
let myContext = LAContext() let myContext = LAContext()
var authError: NSError? var authError: NSError?
if #available(iOS 8.0, macOS 10.12.1, *) { if myContext.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &authError) {
if myContext.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &authError) { if #available(iOS 11.0, *), myContext.biometryType == .faceID {
var biometryType = "TouchId".localize() biometryAuthButton.setTitle("FaceId".localize(), for: .normal)
if #available(iOS 11.0, *) { } else {
if myContext.biometryType == LABiometryType.faceID { biometryAuthButton.setTitle("TouchId".localize(), for: .normal)
biometryType = "FaceId".localize()
}
}
biometryAuthButton.setTitle(biometryType, for: .normal)
biometryAuthButton.titleLabel?.font = UIFont.systemFont(ofSize: UIFont.systemFontSize)
biometryAuthButton.isHidden = false
} }
biometryAuthButton.titleLabel?.font = UIFont.systemFont(ofSize: UIFont.systemFontSize)
biometryAuthButton.isHidden = false
} }
let forgotPasscodeButton = UIButton(type: .custom) let forgotPasscodeButton = UIButton(type: .custom)
forgotPasscodeButton.setTitle("ForgotYourPasscode?".localize(), for: .normal) forgotPasscodeButton.setTitle("ForgotYourPasscode?".localize(), for: .normal)
forgotPasscodeButton.titleLabel?.font = UIFont.systemFont(ofSize: UIFont.systemFontSize) forgotPasscodeButton.titleLabel?.font = UIFont.systemFont(ofSize: UIFont.systemFontSize)
@ -179,15 +175,12 @@ open class PasscodeLockViewController: UIViewController, UITextFieldDelegate {
let myContext = LAContext() let myContext = LAContext()
let myLocalizedReasonString = "AuthenticationNeeded.".localize() let myLocalizedReasonString = "AuthenticationNeeded.".localize()
var authError: NSError? var authError: NSError?
if myContext.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &authError) {
if #available(iOS 8.0, *) { myContext.evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, localizedReason: myLocalizedReasonString) { success, evaluateError in
if myContext.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &authError) { if success {
myContext.evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, localizedReason: myLocalizedReasonString) { success, evaluateError in DispatchQueue.main.async {
if success { // user authenticated successfully, take appropriate action
DispatchQueue.main.async { self.passcodeLockDidSucceed()
// user authenticated successfully, take appropriate action
self.passcodeLockDidSucceed()
}
} }
} }
} }