File tree Expand file tree Collapse file tree 3 files changed +16
-7
lines changed
Expand file tree Collapse file tree 3 files changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,6 @@ import '../../exception/platform_exception_decoder.dart';
3636import '../../oath/models.dart' ;
3737import '../../oath/state.dart' ;
3838import '../../widgets/toast.dart' ;
39- import '../app_methods.dart' ;
4039import '../overlay/nfc/method_channel_notifier.dart' ;
4140import '../overlay/nfc/nfc_overlay.dart' ;
4241
@@ -192,7 +191,6 @@ final addCredentialToAnyProvider =
192191 Provider ((ref) => (Uri credentialUri, {bool requireTouch = false }) async {
193192 final oath = ref.watch (_oathMethodsProvider.notifier);
194193 try {
195- await preserveConnectedDeviceWhenPaused ();
196194 var result = jsonDecode (await oath.invoke ('addAccountToAny' , {
197195 'uri' : credentialUri.toString (),
198196 'requireTouch' : requireTouch
@@ -208,7 +206,6 @@ final addCredentialsToAnyProvider = Provider(
208206 (ref) => (List <String > credentialUris, List <bool > touchRequired) async {
209207 final oath = ref.read (_oathMethodsProvider.notifier);
210208 try {
211- await preserveConnectedDeviceWhenPaused ();
212209 _log.debug (
213210 'Calling android with ${credentialUris .length } credentials to be added' );
214211 var result = jsonDecode (await oath.invoke ('addAccountsToAny' ,
Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ final nfcOverlay =
3737class _NfcOverlayNotifier extends Notifier <int > {
3838 Timer ? processingViewTimeout;
3939 late final l10n = ref.read (l10nProvider);
40+ late final eventNotifier = ref.read (nfcEventNotifier.notifier);
4041
4142 @override
4243 int build () {
@@ -76,10 +77,9 @@ class _NfcOverlayNotifier extends Notifier<int> {
7677 });
7778
7879 _channel.setMethodCallHandler ((call) async {
79- final notifier = ref.read (nfcEventNotifier.notifier);
8080 switch (call.method) {
8181 case 'show' :
82- notifier .send (showTapYourYubiKey ());
82+ eventNotifier .send (showTapYourYubiKey ());
8383 break ;
8484
8585 case 'close' :
@@ -97,12 +97,13 @@ class _NfcOverlayNotifier extends Notifier<int> {
9797 }
9898
9999 NfcEvent showTapYourYubiKey () {
100+ final nfcAvailable = ref.watch (androidNfcAdapterState);
100101 ref.read (nfcOverlayWidgetProperties.notifier).update (hasCloseButton: true );
101102 return NfcSetViewEvent (
102103 child: NfcContentWidget (
103104 title: l10n.s_nfc_ready_to_scan,
104- subtitle: l10n.s_nfc_tap_your_yubikey,
105- icon: const NfcIconProgressBar (false ),
105+ subtitle: nfcAvailable ? l10n.s_nfc_tap_your_yubikey : l10n.l_insert_yk ,
106+ icon: nfcAvailable ? const NfcIconProgressBar (false ) : const UsbIcon ( ),
106107 ));
107108 }
108109
Original file line number Diff line number Diff line change @@ -56,6 +56,17 @@ class NfcIconProgressBar extends StatelessWidget {
5656 );
5757}
5858
59+ class UsbIcon extends StatelessWidget {
60+ const UsbIcon ({super .key});
61+
62+ @override
63+ Widget build (BuildContext context) => Icon (
64+ Symbols .usb,
65+ size: 64 ,
66+ color: Theme .of (context).colorScheme.primary,
67+ );
68+ }
69+
5970class NfcIconSuccess extends StatelessWidget {
6071 const NfcIconSuccess ({super .key});
6172
You can’t perform that action at this time.
0 commit comments