mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-11-22 00:12:09 +03:00
[OATH] show action badges
This commit is contained in:
parent
f6b405363d
commit
6408cffa7e
@ -30,6 +30,15 @@ import '../keys.dart' as keys;
|
||||
import '../models.dart';
|
||||
import 'utils.dart';
|
||||
|
||||
bool oathShowActionNotifier(DeviceInfo? info) {
|
||||
if (info == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final (fipsCapable, fipsApproved) = info.getFipsStatus(Capability.oath);
|
||||
return fipsCapable && !fipsApproved;
|
||||
}
|
||||
|
||||
Widget oathBuildActions(
|
||||
BuildContext context,
|
||||
DevicePath devicePath,
|
||||
@ -62,6 +71,10 @@ Widget oathBuildActions(
|
||||
enabled = true;
|
||||
}
|
||||
|
||||
final colors = Theme.of(context).buttonTheme.colorScheme ??
|
||||
Theme.of(context).colorScheme;
|
||||
final alertIcon = Icon(Symbols.warning_amber, color: colors.tertiary);
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
ActionListSection(l10n.s_setup, children: [
|
||||
@ -102,6 +115,7 @@ Widget oathBuildActions(
|
||||
oathState.hasKey ? l10n.s_manage_password : l10n.s_set_password,
|
||||
subtitle: l10n.l_password_protection,
|
||||
icon: const Icon(Symbols.password),
|
||||
trailing: fipsCapable && !fipsApproved ? alertIcon : null,
|
||||
onTap: (context) {
|
||||
Navigator.of(context).popUntil((route) => route.isFirst);
|
||||
setManagePassword(context, ref, devicePath, oathState);
|
||||
|
@ -167,7 +167,8 @@ class _UnlockedViewState extends ConsumerState<_UnlockedView> {
|
||||
final hasFeature = ref.watch(featureProvider);
|
||||
final hasActions = hasFeature(features.actions);
|
||||
final searchText = searchController.text;
|
||||
|
||||
final deviceInfo =
|
||||
ref.watch(currentDeviceDataProvider.select((s) => s.valueOrNull?.info));
|
||||
Future<void> onFileDropped(File file) async {
|
||||
final qrScanner = ref.read(qrScannerProvider);
|
||||
if (qrScanner != null) {
|
||||
@ -186,13 +187,11 @@ class _UnlockedViewState extends ConsumerState<_UnlockedView> {
|
||||
|
||||
if (numCreds == 0) {
|
||||
return MessagePage(
|
||||
keyActionsBadge: oathShowActionNotifier(deviceInfo),
|
||||
actionsBuilder: (context, expanded) {
|
||||
final (fipsCapable, fipsApproved) = ref
|
||||
.watch(currentDeviceDataProvider)
|
||||
.valueOrNull
|
||||
?.info
|
||||
.getFipsStatus(Capability.oath) ??
|
||||
(false, false);
|
||||
final (fipsCapable, fipsApproved) =
|
||||
deviceInfo?.getFipsStatus(Capability.oath) ?? (false, false);
|
||||
|
||||
return [
|
||||
if (!expanded && (!fipsCapable || (fipsCapable && fipsApproved)))
|
||||
ActionChip(
|
||||
@ -242,6 +241,7 @@ class _UnlockedViewState extends ConsumerState<_UnlockedView> {
|
||||
capabilities: const [Capability.oath],
|
||||
centered: true,
|
||||
delayedContent: true,
|
||||
keyActionsBadge: oathShowActionNotifier(deviceInfo),
|
||||
builder: (context, _) => const CircularProgressIndicator(),
|
||||
);
|
||||
}
|
||||
@ -307,6 +307,7 @@ class _UnlockedViewState extends ConsumerState<_UnlockedView> {
|
||||
alternativeTitle:
|
||||
searchText != '' ? l10n.l_results_for(searchText) : null,
|
||||
capabilities: const [Capability.oath],
|
||||
keyActionsBadge: oathShowActionNotifier(deviceInfo),
|
||||
keyActionsBuilder: hasActions
|
||||
? (context) => oathBuildActions(
|
||||
context,
|
||||
|
Loading…
Reference in New Issue
Block a user