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,19 +55,15 @@ 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) {
var biometryType = "TouchId".localize() if #available(iOS 11.0, *), myContext.biometryType == .faceID {
if #available(iOS 11.0, *) { biometryAuthButton.setTitle("FaceId".localize(), for: .normal)
if myContext.biometryType == LABiometryType.faceID { } else {
biometryType = "FaceId".localize() biometryAuthButton.setTitle("TouchId".localize(), for: .normal)
} }
}
biometryAuthButton.setTitle(biometryType, for: .normal)
biometryAuthButton.titleLabel?.font = UIFont.systemFont(ofSize: UIFont.systemFontSize) biometryAuthButton.titleLabel?.font = UIFont.systemFont(ofSize: UIFont.systemFontSize)
biometryAuthButton.isHidden = false 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)
@ -179,8 +175,6 @@ 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 #available(iOS 8.0, *) {
if myContext.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &authError) { if myContext.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &authError) {
myContext.evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, localizedReason: myLocalizedReasonString) { success, evaluateError in myContext.evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, localizedReason: myLocalizedReasonString) { success, evaluateError in
if success { if success {
@ -192,7 +186,6 @@ open class PasscodeLockViewController: UIViewController, UITextFieldDelegate {
} }
} }
} }
}
@objc func forgotPasscodeButtonPressedAction(_ uiButton: UIButton) { @objc func forgotPasscodeButtonPressedAction(_ uiButton: UIButton) {
let alert = UIAlertController(title: "ResetPass".localize(), message: "ResetPassExplanation.".localize(), preferredStyle: UIAlertController.Style.alert) let alert = UIAlertController(title: "ResetPass".localize(), message: "ResetPassExplanation.".localize(), preferredStyle: UIAlertController.Style.alert)