mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 17:57:40 +00:00
add flag to show try again button
This commit is contained in:
parent
e88676cf40
commit
94fd8bc0ec
2 changed files with 13 additions and 1 deletions
|
@ -109,6 +109,7 @@ class FusionProgressUIState extends ChangeNotifier {
|
|||
void incrementFusionRoundsCompleted() {
|
||||
_fusionRoundsCompleted++;
|
||||
_fusionRoundsFailed = 0; // Reset failed round count on success.
|
||||
_maxConsecutiveFusionRoundsFailed = false; // Reset failed flag on success.
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
|
@ -125,4 +126,14 @@ class FusionProgressUIState extends ChangeNotifier {
|
|||
_fusionRoundsFailed++;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
/// 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;
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -569,9 +569,10 @@ mixin FusionWalletInterface {
|
|||
// Do the same for the UI state.
|
||||
_uiState?.incrementFusionRoundsFailed();
|
||||
|
||||
// If we fail 5 times in a row, stop trying.
|
||||
// If we fail too many times in a row, stop trying.
|
||||
if (_failedFuseCount >= maxFailedFuseCount) {
|
||||
_stopRequested = true;
|
||||
_uiState?.maxConsecutiveFusionRoundsFailed = true;
|
||||
}
|
||||
} finally {
|
||||
// Increment the number of successfully completed fusion rounds.
|
||||
|
|
Loading…
Reference in a new issue