2023-09-20 22:14:34 +00:00
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:stackwallet/pages_desktop_specific/cashfusion/sub_widgets/fusion_dialog.dart';
|
2023-09-22 22:20:48 +00:00
|
|
|
|
2023-09-20 22:14:34 +00:00
|
|
|
class FusionProgressUIState extends ChangeNotifier {
|
2023-09-28 20:16:48 +00:00
|
|
|
bool _ableToConnect = true; // set to true for now
|
2023-09-20 22:14:34 +00:00
|
|
|
|
|
|
|
bool get done {
|
|
|
|
if (!_ableToConnect) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool _done = (_connecting == CashFusionStatus.success) ||
|
|
|
|
(_connecting == CashFusionStatus.failed);
|
|
|
|
_done &= (_outputs == CashFusionStatus.success) ||
|
|
|
|
(_outputs == CashFusionStatus.failed);
|
|
|
|
_done &= (_peers == CashFusionStatus.success) ||
|
|
|
|
(_peers == CashFusionStatus.failed);
|
|
|
|
_done &= (_fusing == CashFusionStatus.success) ||
|
|
|
|
(_fusing == CashFusionStatus.failed);
|
|
|
|
_done &= (_complete == CashFusionStatus.success) ||
|
|
|
|
(_complete == CashFusionStatus.failed);
|
2023-09-22 22:20:48 +00:00
|
|
|
|
2023-09-28 20:16:48 +00:00
|
|
|
_done &= (fusionState == CashFusionStatus.success) ||
|
|
|
|
(fusionState == CashFusionStatus.failed);
|
2023-09-22 22:20:48 +00:00
|
|
|
|
2023-09-20 22:14:34 +00:00
|
|
|
return _done;
|
|
|
|
}
|
|
|
|
|
2023-09-22 22:20:48 +00:00
|
|
|
bool get succeeded {
|
|
|
|
if (!_ableToConnect) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool _succeeded = _connecting == CashFusionStatus.success;
|
|
|
|
_succeeded &= _outputs == CashFusionStatus.success;
|
|
|
|
_succeeded &= _peers == CashFusionStatus.success;
|
|
|
|
_succeeded &= _fusing == CashFusionStatus.success;
|
|
|
|
_succeeded &= _complete == CashFusionStatus.success;
|
|
|
|
|
2023-09-28 20:16:48 +00:00
|
|
|
_succeeded &= fusionState == CashFusionStatus.success;
|
2023-09-22 22:20:48 +00:00
|
|
|
|
|
|
|
return _succeeded;
|
|
|
|
}
|
|
|
|
|
2023-09-20 22:14:34 +00:00
|
|
|
CashFusionStatus _connecting = CashFusionStatus.waiting;
|
|
|
|
CashFusionStatus get connecting => _connecting;
|
|
|
|
set connecting(CashFusionStatus state) {
|
|
|
|
_connecting = state;
|
|
|
|
notifyListeners();
|
|
|
|
}
|
|
|
|
|
|
|
|
CashFusionStatus _outputs = CashFusionStatus.waiting;
|
|
|
|
CashFusionStatus get outputs => _outputs;
|
|
|
|
set outputs(CashFusionStatus state) {
|
|
|
|
_outputs = state;
|
|
|
|
notifyListeners();
|
|
|
|
}
|
|
|
|
|
|
|
|
CashFusionStatus _peers = CashFusionStatus.waiting;
|
|
|
|
CashFusionStatus get peers => _peers;
|
|
|
|
set peers(CashFusionStatus state) {
|
|
|
|
_peers = state;
|
|
|
|
notifyListeners();
|
|
|
|
}
|
|
|
|
|
|
|
|
CashFusionStatus _fusing = CashFusionStatus.waiting;
|
|
|
|
CashFusionStatus get fusing => _fusing;
|
|
|
|
set fusing(CashFusionStatus state) {
|
|
|
|
_fusing = state;
|
|
|
|
notifyListeners();
|
|
|
|
}
|
|
|
|
|
|
|
|
CashFusionStatus _complete = CashFusionStatus.waiting;
|
|
|
|
CashFusionStatus get complete => _complete;
|
|
|
|
set complete(CashFusionStatus state) {
|
|
|
|
_complete = state;
|
|
|
|
notifyListeners();
|
|
|
|
}
|
2023-09-22 22:20:48 +00:00
|
|
|
|
2023-09-28 20:16:48 +00:00
|
|
|
CashFusionStatus _fusionStatus = CashFusionStatus.waiting;
|
|
|
|
CashFusionStatus get fusionState => _fusionStatus;
|
|
|
|
set fusionState(CashFusionStatus fusionStatus) {
|
|
|
|
_fusionStatus = fusionStatus;
|
2023-09-26 15:30:31 +00:00
|
|
|
notifyListeners();
|
2023-09-22 22:20:48 +00:00
|
|
|
}
|
2023-09-20 22:14:34 +00:00
|
|
|
}
|