From 815150d11372abbd0d9e6ffa8d1f08bbc8e69681 Mon Sep 17 00:00:00 2001 From: Adam Velebil Date: Fri, 13 Sep 2024 09:16:13 +0200 Subject: [PATCH 1/3] don't show progress widgets when using NFC --- lib/app/views/reset_dialog.dart | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/app/views/reset_dialog.dart b/lib/app/views/reset_dialog.dart index 52c3d1ad..b651fa3f 100644 --- a/lib/app/views/reset_dialog.dart +++ b/lib/app/views/reset_dialog.dart @@ -123,6 +123,12 @@ class _ResetDialogState extends ConsumerState { _application == Capability.fido2 && !ref.watch(rpcStateProvider.select((state) => state.isAdmin)); + // show the progress widgets on desktop, or on Android when using USB + final showFidoResetProgress = !Platform.isAndroid || + (Platform.isAndroid && + (ref.read(currentDeviceProvider)?.transport == Transport.usb || + _currentStep == _totalSteps)); + return ResponsiveDialog( title: Text(l10n.s_factory_reset), key: factoryResetCancel, @@ -323,10 +329,12 @@ class _ResetDialogState extends ConsumerState { ), ], if (_resetting) - if (_application == Capability.fido2 && _currentStep >= 0) ...[ + if (_application == Capability.fido2 && + _currentStep >= 0 && + showFidoResetProgress) ...[ Text('${l10n.s_status}: ${_getMessage()}'), LinearProgressIndicator(value: progress), - ] else + ] else if (showFidoResetProgress) const LinearProgressIndicator() ] .map((e) => Padding( From 5637d906f9c60352c4a98ffa3b2e34a2ae7f5dff Mon Sep 17 00:00:00 2001 From: Adam Velebil Date: Fri, 13 Sep 2024 14:16:53 +0200 Subject: [PATCH 2/3] fix code style --- lib/app/views/reset_dialog.dart | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/lib/app/views/reset_dialog.dart b/lib/app/views/reset_dialog.dart index b651fa3f..06c68cb6 100644 --- a/lib/app/views/reset_dialog.dart +++ b/lib/app/views/reset_dialog.dart @@ -124,10 +124,11 @@ class _ResetDialogState extends ConsumerState { !ref.watch(rpcStateProvider.select((state) => state.isAdmin)); // show the progress widgets on desktop, or on Android when using USB - final showFidoResetProgress = !Platform.isAndroid || - (Platform.isAndroid && - (ref.read(currentDeviceProvider)?.transport == Transport.usb || - _currentStep == _totalSteps)); + final showResetProgress = _resetting && + (!Platform.isAndroid || + (Platform.isAndroid && + (ref.read(currentDeviceProvider)?.transport == Transport.usb || + _currentStep == _totalSteps))); return ResponsiveDialog( title: Text(l10n.s_factory_reset), @@ -328,13 +329,11 @@ class _ResetDialogState extends ConsumerState { }, ), ], - if (_resetting) - if (_application == Capability.fido2 && - _currentStep >= 0 && - showFidoResetProgress) ...[ + if (showResetProgress) + if (_application == Capability.fido2 && _currentStep >= 0) ...[ Text('${l10n.s_status}: ${_getMessage()}'), LinearProgressIndicator(value: progress), - ] else if (showFidoResetProgress) + ] else const LinearProgressIndicator() ] .map((e) => Padding( From 8d9e9e21590d6d778b654e5b4b33ad929448ef45 Mon Sep 17 00:00:00 2001 From: Adam Velebil Date: Fri, 13 Sep 2024 14:26:53 +0200 Subject: [PATCH 3/3] Simplify condition --- lib/app/views/reset_dialog.dart | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/app/views/reset_dialog.dart b/lib/app/views/reset_dialog.dart index 06c68cb6..a318f838 100644 --- a/lib/app/views/reset_dialog.dart +++ b/lib/app/views/reset_dialog.dart @@ -126,9 +126,8 @@ class _ResetDialogState extends ConsumerState { // show the progress widgets on desktop, or on Android when using USB final showResetProgress = _resetting && (!Platform.isAndroid || - (Platform.isAndroid && - (ref.read(currentDeviceProvider)?.transport == Transport.usb || - _currentStep == _totalSteps))); + ref.read(currentDeviceProvider)?.transport == Transport.usb || + _currentStep == _totalSteps); return ResponsiveDialog( title: Text(l10n.s_factory_reset),