From d5c492303162deed62b30454e870ccd1064cf3fc Mon Sep 17 00:00:00 2001 From: sneurlax Date: Thu, 19 Oct 2023 12:52:21 -0500 Subject: [PATCH] refactor maxConsecutiveFusionRoundsFailed->failed --- lib/models/fusion_progress_ui_state.dart | 15 +++++++++------ lib/services/mixins/fusion_wallet_interface.dart | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/models/fusion_progress_ui_state.dart b/lib/models/fusion_progress_ui_state.dart index 60217b2d6..78c32bead 100644 --- a/lib/models/fusion_progress_ui_state.dart +++ b/lib/models/fusion_progress_ui_state.dart @@ -109,7 +109,7 @@ class FusionProgressUIState extends ChangeNotifier { void incrementFusionRoundsCompleted() { _fusionRoundsCompleted++; _fusionRoundsFailed = 0; // Reset failed round count on success. - _maxConsecutiveFusionRoundsFailed = false; // Reset failed flag on success. + _failed = false; // Reset failed flag on success. notifyListeners(); } @@ -129,11 +129,14 @@ class FusionProgressUIState extends ChangeNotifier { /// A flag indicating that fusion has stopped because the maximum number of /// consecutive failed fusion rounds has been reached. - bool _maxConsecutiveFusionRoundsFailed = false; - bool get maxConsecutiveFusionRoundsFailed => - _maxConsecutiveFusionRoundsFailed; - set maxConsecutiveFusionRoundsFailed(bool maxConsecutiveFusionRoundsFailed) { - _maxConsecutiveFusionRoundsFailed = maxConsecutiveFusionRoundsFailed; + /// + /// Set from the interface. I didn't want to have to configure + /// + /// Used to be named maxConsecutiveFusionRoundsFailed. + bool _failed = true; + bool get failed => _failed; + set failed(bool failed) { + _failed = failed; notifyListeners(); } } diff --git a/lib/services/mixins/fusion_wallet_interface.dart b/lib/services/mixins/fusion_wallet_interface.dart index 6bcb86817..28eb61082 100644 --- a/lib/services/mixins/fusion_wallet_interface.dart +++ b/lib/services/mixins/fusion_wallet_interface.dart @@ -572,7 +572,7 @@ mixin FusionWalletInterface { // If we fail too many times in a row, stop trying. if (_failedFuseCount >= maxFailedFuseCount) { _stopRequested = true; - _uiState?.maxConsecutiveFusionRoundsFailed = true; + _uiState?.failed = true; } } finally { // Increment the number of successfully completed fusion rounds.