From b045dbf4ec41b138bb4516ac08ad675ca5a3df06 Mon Sep 17 00:00:00 2001 From: Elias Bonnici Date: Wed, 7 Feb 2024 17:11:38 +0100 Subject: [PATCH] Add PIN CTA for keys with alwaysUv enabled. --- lib/fido/views/passkeys_screen.dart | 46 ++++++++++++++++++----------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/lib/fido/views/passkeys_screen.dart b/lib/fido/views/passkeys_screen.dart index eebe30f9..9fe405d9 100644 --- a/lib/fido/views/passkeys_screen.dart +++ b/lib/fido/views/passkeys_screen.dart @@ -92,39 +92,51 @@ class _FidoLockedPage extends ConsumerWidget { final hasFeature = ref.watch(featureProvider); final hasActions = hasFeature(features.actions); final isBio = state.bioEnroll != null; + final alwaysUv = state.alwaysUv; if (!state.hasPin) { return MessagePage( title: l10n.s_passkeys, capabilities: const [Capability.fido2], - actionsBuilder: isBio - ? (context, expanded) { - return [ - ActionChip( - label: Text(l10n.s_setup_fingerprints), - onPressed: () async { - ref - .read(currentAppProvider.notifier) - .setCurrentApp(Application.fingerprints); - }, - avatar: const Icon(Icons.fingerprint_outlined), - ) - ]; - } - : null, + actionsBuilder: (context, expanded) { + return [ + if (isBio) + ActionChip( + label: Text(l10n.s_setup_fingerprints), + onPressed: () async { + ref + .read(currentAppProvider.notifier) + .setCurrentApp(Application.fingerprints); + }, + avatar: const Icon(Icons.fingerprint_outlined), + ), + if (!isBio && alwaysUv) + ActionChip( + label: Text(l10n.s_set_pin), + onPressed: () async { + await showBlurDialog( + context: context, + builder: (context) => FidoPinDialog(node.path, state)); + }, + avatar: const Icon(Icons.pin_outlined), + ) + ]; + }, header: state.credMgmt ? l10n.l_no_discoverable_accounts : l10n.l_ready_to_use, message: isBio ? l10n.p_setup_fingerprints_desc - : l10n.l_register_sk_on_websites, + : alwaysUv + ? l10n.l_pin_change_required_desc + : l10n.l_register_sk_on_websites, footnote: isBio ? null : l10n.l_non_passkeys_note, keyActionsBuilder: hasActions ? _buildActions : null, keyActionsBadge: fidoShowActionsNotifier(state), ); } - if (!state.credMgmt && state.bioEnroll == null) { + if (!state.credMgmt && !isBio) { return MessagePage( title: l10n.s_passkeys, capabilities: const [Capability.fido2],