mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 17:57:40 +00:00
refactor logic to fail currently-running state step
This commit is contained in:
parent
c61f3ca94b
commit
ad965e081c
1 changed files with 21 additions and 1 deletions
|
@ -112,10 +112,14 @@ mixin FusionWalletInterface {
|
|||
case fusion.FusionStatus.failed:
|
||||
_uiState?.fusing = CashFusionStatus.failed;
|
||||
_uiState?.complete = CashFusionStatus.failed;
|
||||
|
||||
failCurrentUiState();
|
||||
|
||||
break;
|
||||
case fusion.FusionStatus.exception:
|
||||
_uiState?.fusing = CashFusionStatus.failed;
|
||||
_uiState?.complete = CashFusionStatus.failed;
|
||||
|
||||
failCurrentUiState();
|
||||
break;
|
||||
case fusion.FusionStatus.reset:
|
||||
_uiState?.outputs = CashFusionStatus.waiting;
|
||||
|
@ -128,6 +132,22 @@ mixin FusionWalletInterface {
|
|||
}
|
||||
}
|
||||
|
||||
void failCurrentUiState() {
|
||||
// Check each _uiState value to see if it is running. If so, set it to failed.
|
||||
if (_uiState?.connecting == CashFusionStatus.running) {
|
||||
_uiState?.connecting = CashFusionStatus.failed;
|
||||
}
|
||||
if (_uiState?.outputs == CashFusionStatus.running) {
|
||||
_uiState?.outputs = CashFusionStatus.failed;
|
||||
}
|
||||
if (_uiState?.peers == CashFusionStatus.running) {
|
||||
_uiState?.peers = CashFusionStatus.failed;
|
||||
}
|
||||
if (_uiState?.fusing == CashFusionStatus.running) {
|
||||
_uiState?.fusing = CashFusionStatus.failed;
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns a list of all transactions in the wallet for the given address.
|
||||
Future<List<Map<String, dynamic>>> _getTransactionsByAddress(
|
||||
String address,
|
||||
|
|
Loading…
Reference in a new issue