Add PIN CTA for keys with alwaysUv enabled.

This commit is contained in:
Elias Bonnici 2024-02-07 17:11:38 +01:00
parent ffbd9733bc
commit b045dbf4ec
No known key found for this signature in database
GPG Key ID: 5EAC28EA3F980CCF

View File

@ -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],