mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-11-22 16:32:01 +03:00
Change FIDO ActionListItem
subtitles and logic for actions notifier.
This commit is contained in:
parent
212083b9cc
commit
c690da7c3c
@ -110,7 +110,7 @@ class _FidoLockedPage extends ConsumerWidget {
|
||||
header: l10n.s_fingerprints_get_started,
|
||||
message: l10n.p_set_fingerprints_desc,
|
||||
keyActionsBuilder: hasActions ? _buildActions : null,
|
||||
keyActionsBadge: fidoShowActionsNotifier(state),
|
||||
keyActionsBadge: fingerprintsShowActionsNotifier(state),
|
||||
);
|
||||
}
|
||||
|
||||
@ -121,7 +121,7 @@ class _FidoLockedPage extends ConsumerWidget {
|
||||
header: l10n.s_pin_change_required,
|
||||
message: l10n.l_pin_change_required_desc,
|
||||
keyActionsBuilder: hasActions ? _buildActions : null,
|
||||
keyActionsBadge: fidoShowActionsNotifier(state),
|
||||
keyActionsBadge: fingerprintsShowActionsNotifier(state),
|
||||
actionsBuilder: (context, expanded) => [
|
||||
if (!expanded)
|
||||
ActionChip(
|
||||
@ -201,7 +201,7 @@ class _FidoUnlockedPageState extends ConsumerState<_FidoUnlockedPage> {
|
||||
? (context) =>
|
||||
fingerprintsBuildActions(context, widget.node, widget.state, 0)
|
||||
: null,
|
||||
keyActionsBadge: fidoShowActionsNotifier(widget.state),
|
||||
keyActionsBadge: fingerprintsShowActionsNotifier(widget.state),
|
||||
);
|
||||
}
|
||||
|
||||
@ -296,7 +296,7 @@ class _FidoUnlockedPageState extends ConsumerState<_FidoUnlockedPage> {
|
||||
? (context) => fingerprintsBuildActions(
|
||||
context, widget.node, widget.state, fingerprints.length)
|
||||
: null,
|
||||
keyActionsBadge: fidoShowActionsNotifier(widget.state),
|
||||
keyActionsBadge: fingerprintsShowActionsNotifier(widget.state),
|
||||
builder: (context, expanded) {
|
||||
// De-select if window is resized to be non-expanded.
|
||||
if (!expanded && _selected != null) {
|
||||
|
@ -26,10 +26,12 @@ import '../models.dart';
|
||||
import 'add_fingerprint_dialog.dart';
|
||||
import 'pin_dialog.dart';
|
||||
|
||||
bool fidoShowActionsNotifier(FidoState state) {
|
||||
return (state.alwaysUv && !state.hasPin) ||
|
||||
state.bioEnroll == false ||
|
||||
state.forcePinChange;
|
||||
bool passkeysShowActionsNotifier(FidoState state) {
|
||||
return (state.alwaysUv && !state.hasPin) || state.forcePinChange;
|
||||
}
|
||||
|
||||
bool fingerprintsShowActionsNotifier(FidoState state) {
|
||||
return !state.hasPin || state.bioEnroll == false || state.forcePinChange;
|
||||
}
|
||||
|
||||
Widget passkeysBuildActions(
|
||||
@ -63,8 +65,9 @@ Widget _fidoBuildActions(BuildContext context, DeviceNode node, FidoState state,
|
||||
: state.hasPin
|
||||
? l10n.l_unlock_pin_first
|
||||
: l10n.l_set_pin_first,
|
||||
trailing: fingerprints == 0
|
||||
? Icon(Icons.warning_amber, color: colors.tertiary)
|
||||
trailing: fingerprints == 0 || fingerprints == -1
|
||||
? Icon(Icons.warning_amber,
|
||||
color: state.unlocked ? colors.tertiary : null)
|
||||
: null,
|
||||
onTap: state.unlocked && fingerprints < 5
|
||||
? (context) {
|
||||
@ -90,7 +93,7 @@ Widget _fidoBuildActions(BuildContext context, DeviceNode node, FidoState state,
|
||||
? (state.forcePinChange
|
||||
? l10n.s_pin_change_required
|
||||
: l10n.s_fido_pin_protection)
|
||||
: l10n.l_fido_pin_protection_optional,
|
||||
: l10n.s_fido_pin_protection,
|
||||
trailing: state.alwaysUv && !state.hasPin || state.forcePinChange
|
||||
? Icon(Icons.warning_amber, color: colors.tertiary)
|
||||
: null,
|
||||
|
@ -132,7 +132,7 @@ class _FidoLockedPage extends ConsumerWidget {
|
||||
: l10n.l_register_sk_on_websites,
|
||||
footnote: isBio ? null : l10n.l_non_passkeys_note,
|
||||
keyActionsBuilder: hasActions ? _buildActions : null,
|
||||
keyActionsBadge: fidoShowActionsNotifier(state),
|
||||
keyActionsBadge: passkeysShowActionsNotifier(state),
|
||||
);
|
||||
}
|
||||
|
||||
@ -144,7 +144,7 @@ class _FidoLockedPage extends ConsumerWidget {
|
||||
message: l10n.l_register_sk_on_websites,
|
||||
footnote: l10n.l_non_passkeys_note,
|
||||
keyActionsBuilder: hasActions ? _buildActions : null,
|
||||
keyActionsBadge: fidoShowActionsNotifier(state),
|
||||
keyActionsBadge: passkeysShowActionsNotifier(state),
|
||||
);
|
||||
}
|
||||
|
||||
@ -167,7 +167,7 @@ class _FidoLockedPage extends ConsumerWidget {
|
||||
header: l10n.s_pin_change_required,
|
||||
message: l10n.l_pin_change_required_desc,
|
||||
keyActionsBuilder: hasActions ? _buildActions : null,
|
||||
keyActionsBadge: fidoShowActionsNotifier(state),
|
||||
keyActionsBadge: passkeysShowActionsNotifier(state),
|
||||
);
|
||||
}
|
||||
|
||||
@ -220,7 +220,7 @@ class _FidoUnlockedPageState extends ConsumerState<_FidoUnlockedPage> {
|
||||
? (context) =>
|
||||
passkeysBuildActions(context, widget.node, widget.state)
|
||||
: null,
|
||||
keyActionsBadge: fidoShowActionsNotifier(widget.state),
|
||||
keyActionsBadge: passkeysShowActionsNotifier(widget.state),
|
||||
);
|
||||
}
|
||||
|
||||
@ -257,7 +257,7 @@ class _FidoUnlockedPageState extends ConsumerState<_FidoUnlockedPage> {
|
||||
? (context) =>
|
||||
passkeysBuildActions(context, widget.node, widget.state)
|
||||
: null,
|
||||
keyActionsBadge: fidoShowActionsNotifier(widget.state),
|
||||
keyActionsBadge: passkeysShowActionsNotifier(widget.state),
|
||||
footnote: l10n.l_non_passkeys_note,
|
||||
);
|
||||
}
|
||||
@ -358,7 +358,7 @@ class _FidoUnlockedPageState extends ConsumerState<_FidoUnlockedPage> {
|
||||
? (context) =>
|
||||
passkeysBuildActions(context, widget.node, widget.state)
|
||||
: null,
|
||||
keyActionsBadge: fidoShowActionsNotifier(widget.state),
|
||||
keyActionsBadge: passkeysShowActionsNotifier(widget.state),
|
||||
builder: (context, expanded) {
|
||||
// De-select if window is resized to be non-expanded.
|
||||
if (!expanded && _selected != null) {
|
||||
|
Loading…
Reference in New Issue
Block a user