File tree 3 files changed +16
-7
lines changed
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';
36
36
import '../../oath/models.dart' ;
37
37
import '../../oath/state.dart' ;
38
38
import '../../widgets/toast.dart' ;
39
- import '../app_methods.dart' ;
40
39
import '../overlay/nfc/method_channel_notifier.dart' ;
41
40
import '../overlay/nfc/nfc_overlay.dart' ;
42
41
@@ -192,7 +191,6 @@ final addCredentialToAnyProvider =
192
191
Provider ((ref) => (Uri credentialUri, {bool requireTouch = false }) async {
193
192
final oath = ref.watch (_oathMethodsProvider.notifier);
194
193
try {
195
- await preserveConnectedDeviceWhenPaused ();
196
194
var result = jsonDecode (await oath.invoke ('addAccountToAny' , {
197
195
'uri' : credentialUri.toString (),
198
196
'requireTouch' : requireTouch
@@ -208,7 +206,6 @@ final addCredentialsToAnyProvider = Provider(
208
206
(ref) => (List <String > credentialUris, List <bool > touchRequired) async {
209
207
final oath = ref.read (_oathMethodsProvider.notifier);
210
208
try {
211
- await preserveConnectedDeviceWhenPaused ();
212
209
_log.debug (
213
210
'Calling android with ${credentialUris .length } credentials to be added' );
214
211
var result = jsonDecode (await oath.invoke ('addAccountsToAny' ,
Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ final nfcOverlay =
37
37
class _NfcOverlayNotifier extends Notifier <int > {
38
38
Timer ? processingViewTimeout;
39
39
late final l10n = ref.read (l10nProvider);
40
+ late final eventNotifier = ref.read (nfcEventNotifier.notifier);
40
41
41
42
@override
42
43
int build () {
@@ -76,10 +77,9 @@ class _NfcOverlayNotifier extends Notifier<int> {
76
77
});
77
78
78
79
_channel.setMethodCallHandler ((call) async {
79
- final notifier = ref.read (nfcEventNotifier.notifier);
80
80
switch (call.method) {
81
81
case 'show' :
82
- notifier .send (showTapYourYubiKey ());
82
+ eventNotifier .send (showTapYourYubiKey ());
83
83
break ;
84
84
85
85
case 'close' :
@@ -97,12 +97,13 @@ class _NfcOverlayNotifier extends Notifier<int> {
97
97
}
98
98
99
99
NfcEvent showTapYourYubiKey () {
100
+ final nfcAvailable = ref.watch (androidNfcAdapterState);
100
101
ref.read (nfcOverlayWidgetProperties.notifier).update (hasCloseButton: true );
101
102
return NfcSetViewEvent (
102
103
child: NfcContentWidget (
103
104
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 ( ),
106
107
));
107
108
}
108
109
Original file line number Diff line number Diff line change @@ -56,6 +56,17 @@ class NfcIconProgressBar extends StatelessWidget {
56
56
);
57
57
}
58
58
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
+
59
70
class NfcIconSuccess extends StatelessWidget {
60
71
const NfcIconSuccess ({super .key});
61
72
You can’t perform that action at this time.
0 commit comments