diff --git a/lib/android/oath/state.dart b/lib/android/oath/state.dart index 2b47e8927..25bf1ce59 100755 --- a/lib/android/oath/state.dart +++ b/lib/android/oath/state.dart @@ -36,7 +36,6 @@ import '../../exception/platform_exception_decoder.dart'; import '../../oath/models.dart'; import '../../oath/state.dart'; import '../../widgets/toast.dart'; -import '../app_methods.dart'; import '../overlay/nfc/method_channel_notifier.dart'; import '../overlay/nfc/nfc_overlay.dart'; @@ -192,7 +191,6 @@ final addCredentialToAnyProvider = Provider((ref) => (Uri credentialUri, {bool requireTouch = false}) async { final oath = ref.watch(_oathMethodsProvider.notifier); try { - await preserveConnectedDeviceWhenPaused(); var result = jsonDecode(await oath.invoke('addAccountToAny', { 'uri': credentialUri.toString(), 'requireTouch': requireTouch @@ -208,7 +206,6 @@ final addCredentialsToAnyProvider = Provider( (ref) => (List credentialUris, List touchRequired) async { final oath = ref.read(_oathMethodsProvider.notifier); try { - await preserveConnectedDeviceWhenPaused(); _log.debug( 'Calling android with ${credentialUris.length} credentials to be added'); var result = jsonDecode(await oath.invoke('addAccountsToAny', diff --git a/lib/android/overlay/nfc/nfc_overlay.dart b/lib/android/overlay/nfc/nfc_overlay.dart index 028a4d7b4..d0014ef6f 100755 --- a/lib/android/overlay/nfc/nfc_overlay.dart +++ b/lib/android/overlay/nfc/nfc_overlay.dart @@ -37,6 +37,7 @@ final nfcOverlay = class _NfcOverlayNotifier extends Notifier { Timer? processingViewTimeout; late final l10n = ref.read(l10nProvider); + late final eventNotifier = ref.read(nfcEventNotifier.notifier); @override int build() { @@ -76,10 +77,9 @@ class _NfcOverlayNotifier extends Notifier { }); _channel.setMethodCallHandler((call) async { - final notifier = ref.read(nfcEventNotifier.notifier); switch (call.method) { case 'show': - notifier.send(showTapYourYubiKey()); + eventNotifier.send(showTapYourYubiKey()); break; case 'close': @@ -97,12 +97,13 @@ class _NfcOverlayNotifier extends Notifier { } NfcEvent showTapYourYubiKey() { + final nfcAvailable = ref.watch(androidNfcAdapterState); ref.read(nfcOverlayWidgetProperties.notifier).update(hasCloseButton: true); return NfcSetViewEvent( child: NfcContentWidget( title: l10n.s_nfc_ready_to_scan, - subtitle: l10n.s_nfc_tap_your_yubikey, - icon: const NfcIconProgressBar(false), + subtitle: nfcAvailable ? l10n.s_nfc_tap_your_yubikey : l10n.l_insert_yk, + icon: nfcAvailable ? const NfcIconProgressBar(false) : const UsbIcon(), )); } diff --git a/lib/android/overlay/nfc/views/nfc_overlay_icons.dart b/lib/android/overlay/nfc/views/nfc_overlay_icons.dart index 92ed4a76f..80881ed1c 100644 --- a/lib/android/overlay/nfc/views/nfc_overlay_icons.dart +++ b/lib/android/overlay/nfc/views/nfc_overlay_icons.dart @@ -56,6 +56,17 @@ class NfcIconProgressBar extends StatelessWidget { ); } +class UsbIcon extends StatelessWidget { + const UsbIcon({super.key}); + + @override + Widget build(BuildContext context) => Icon( + Symbols.usb, + size: 64, + color: Theme.of(context).colorScheme.primary, + ); +} + class NfcIconSuccess extends StatelessWidget { const NfcIconSuccess({super.key});