From e12c9a4625f932644e5b287a3be4bfd16f098876 Mon Sep 17 00:00:00 2001 From: Adam Velebil Date: Fri, 13 Sep 2024 15:12:29 +0200 Subject: [PATCH] Only use NFC if available --- .../main/kotlin/com/yubico/authenticator/MainActivity.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/android/app/src/main/kotlin/com/yubico/authenticator/MainActivity.kt b/android/app/src/main/kotlin/com/yubico/authenticator/MainActivity.kt index a543dfc2..47c45af9 100644 --- a/android/app/src/main/kotlin/com/yubico/authenticator/MainActivity.kt +++ b/android/app/src/main/kotlin/com/yubico/authenticator/MainActivity.kt @@ -129,10 +129,11 @@ class MainActivity : FlutterFragmentActivity() { allowScreenshots(false) - yubikit = YubiKitManager( - UsbYubiKeyManager(this), + val nfcManager = if (NfcAdapter.getDefaultAdapter(this) != null) { NfcYubiKeyManager(this, NfcStateDispatcher(nfcStateListener)) - ) + } else null + + yubikit = YubiKitManager(UsbYubiKeyManager(this), nfcManager) } override fun onNewIntent(intent: Intent) {