Hide yubikey for unsupported devices

This commit is contained in:
Mingshen Sun 2023-03-12 16:10:29 -07:00
parent cdaf60da73
commit 3edf8efbc5

View file

@ -10,6 +10,7 @@ import CoreData
import passKit import passKit
import SVProgressHUD import SVProgressHUD
import UIKit import UIKit
import YubiKit
class SettingsTableViewController: UITableViewController, UITabBarControllerDelegate { class SettingsTableViewController: UITableViewController, UITabBarControllerDelegate {
@IBOutlet var pgpKeyTableViewCell: UITableViewCell! @IBOutlet var pgpKeyTableViewCell: UITableViewCell!
@ -184,12 +185,14 @@ class SettingsTableViewController: UITableViewController, UITabBarControllerDele
) )
} }
optionMenu.addAction( if YubiKitDeviceCapabilities.supportsMFIAccessoryKey {
UIAlertAction(title: Defaults.isYubiKeyEnabled ? "✓ YubiKey" : "YubiKey", style: .default) { _ in optionMenu.addAction(
Defaults.isYubiKeyEnabled.toggle() UIAlertAction(title: Defaults.isYubiKeyEnabled ? "✓ YubiKey" : "YubiKey", style: .default) { _ in
self.setPGPKeyTableViewCellDetailText() Defaults.isYubiKeyEnabled.toggle()
} self.setPGPKeyTableViewCellDetailText()
) }
)
}
if Defaults.pgpKeySource != nil { if Defaults.pgpKeySource != nil {
optionMenu.addAction( optionMenu.addAction(