Remove branches for iOS 12 compatibility

This commit is contained in:
Mingshen Sun 2023-02-04 15:27:37 -08:00
parent 7000834575
commit b09bc7444f
7 changed files with 17 additions and 59 deletions

View file

@ -35,9 +35,7 @@ class PGPKeyFileImportTableViewController: AutoCellHeightUITableViewController,
return return
} }
picker.delegate = self picker.delegate = self
if #available(iOS 13.0, *) { picker.shouldShowFileExtensions = true
picker.shouldShowFileExtensions = true
}
present(picker, animated: true, completion: nil) present(picker, animated: true, completion: nil)
} }
} }

View file

@ -550,17 +550,9 @@ extension PasswordDetailTableViewController {
switch error { switch error {
case let .yubiKey(yubiKeyError): case let .yubiKey(yubiKeyError):
let errorMessage = yubiKeyError.localizedDescription let errorMessage = yubiKeyError.localizedDescription
if #available(iOS 13.0, *) { YubiKitManager.shared.stopNFCConnection(withErrorMessage: errorMessage)
YubiKitManager.shared.stopNFCConnection(withErrorMessage: errorMessage) DispatchQueue.main.async {
DispatchQueue.main.async { self.navigationController?.popViewController(animated: true)
self.navigationController?.popViewController(animated: true)
}
} else {
DispatchQueue.main.async {
self.presentFailureAlert(message: errorMessage) { _ in
self.navigationController?.popViewController(animated: true)
}
}
} }
default: default:
DispatchQueue.main.async { DispatchQueue.main.async {

View file

@ -34,9 +34,7 @@ class PasswordNavigationViewController: UIViewController {
uiSearchController.obscuresBackgroundDuringPresentation = false uiSearchController.obscuresBackgroundDuringPresentation = false
uiSearchController.searchBar.sizeToFit() uiSearchController.searchBar.sizeToFit()
uiSearchController.searchBar.returnKeyType = .done uiSearchController.searchBar.returnKeyType = .done
if #available(iOS 13.0, *) { uiSearchController.searchBar.searchTextField.clearButtonMode = .whileEditing
uiSearchController.searchBar.searchTextField.clearButtonMode = .whileEditing
}
return uiSearchController return uiSearchController
}() }()
@ -50,15 +48,11 @@ class PasswordNavigationViewController: UIViewController {
lazy var addPasswordUIBarButtonItem: UIBarButtonItem = { lazy var addPasswordUIBarButtonItem: UIBarButtonItem = {
var addPasswordUIBarButtonItem = UIBarButtonItem() var addPasswordUIBarButtonItem = UIBarButtonItem()
if #available(iOS 13.0, *) { let addPasswordButton = UIButton(type: .system)
let addPasswordButton = UIButton(type: .system) let plusImage = UIImage(systemName: "plus.circle", withConfiguration: UIImage.SymbolConfiguration(weight: .regular))
let plusImage = UIImage(systemName: "plus.circle", withConfiguration: UIImage.SymbolConfiguration(weight: .regular)) addPasswordButton.setImage(plusImage, for: .normal)
addPasswordButton.setImage(plusImage, for: .normal) addPasswordButton.addTarget(self, action: #selector(self.addPasswordAction), for: .touchDown)
addPasswordButton.addTarget(self, action: #selector(self.addPasswordAction), for: .touchDown) addPasswordUIBarButtonItem.customView = addPasswordButton
addPasswordUIBarButtonItem.customView = addPasswordButton
} else {
addPasswordUIBarButtonItem = UIBarButtonItem(barButtonSystemItem: .add, target: self, action: #selector(self.addPasswordAction))
}
return addPasswordUIBarButtonItem return addPasswordUIBarButtonItem
}() }()

View file

@ -27,9 +27,7 @@ class SSHKeyFileImportTableViewController: AutoCellHeightUITableViewController {
return return
} }
picker.delegate = self picker.delegate = self
if #available(iOS 13.0, *) { picker.shouldShowFileExtensions = true
picker.shouldShowFileExtensions = true
}
present(picker, animated: true, completion: nil) present(picker, animated: true, completion: nil)
} }
} }

View file

@ -21,9 +21,7 @@ class PasswordsViewController: UIViewController {
uiSearchController.searchBar.isTranslucent = true uiSearchController.searchBar.isTranslucent = true
uiSearchController.obscuresBackgroundDuringPresentation = false uiSearchController.obscuresBackgroundDuringPresentation = false
uiSearchController.searchBar.sizeToFit() uiSearchController.searchBar.sizeToFit()
if #available(iOS 13.0, *) { uiSearchController.searchBar.searchTextField.clearButtonMode = .whileEditing
uiSearchController.searchBar.searchTextField.clearButtonMode = .whileEditing
}
return uiSearchController return uiSearchController
}() }()

View file

@ -7,33 +7,13 @@
// //
public enum Colors { public enum Colors {
public static let label: UIColor = { public static let label: UIColor = .black
if #available(iOS 13.0, *) {
return .label
}
return .black
}()
public static let secondaryLabel: UIColor = { public static let secondaryLabel: UIColor = .init(red: 60.0, green: 60.0, blue: 67.0, alpha: 0.6)
if #available(iOS 13.0, *) {
return .secondaryLabel
}
return .init(red: 60.0, green: 60.0, blue: 67.0, alpha: 0.6)
}()
public static let systemBackground: UIColor = { public static let systemBackground: UIColor = .white
if #available(iOS 13.0, *) {
return .systemBackground
}
return .white
}()
public static let secondarySystemBackground: UIColor = { public static let secondarySystemBackground: UIColor = .init(red: 242.0, green: 242.0, blue: 247.0, alpha: 1.0)
if #available(iOS 13.0, *) {
return .secondarySystemBackground
}
return .init(red: 242.0, green: 242.0, blue: 247.0, alpha: 1.0)
}()
public static let systemRed = UIColor.systemRed public static let systemRed = UIColor.systemRed

View file

@ -27,9 +27,7 @@ public class YubiKeyConnection: NSObject {
completion(connection) completion(connection)
} else { } else {
connectionCallback = completion connectionCallback = completion
if #available(iOSApplicationExtension 13.0, *) { YubiKitManager.shared.startNFCConnection()
YubiKitManager.shared.startNFCConnection()
}
} }
cancellationCallback = cancellation cancellationCallback = cancellation
} }