mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-23 20:09:23 +00:00
Merge remote-tracking branch 'origin/fusion' into fusion
This commit is contained in:
commit
c850348de9
2 changed files with 59 additions and 21 deletions
|
@ -1,5 +1,7 @@
|
|||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:stackwallet/pages_desktop_specific/cashfusion/sub_widgets/fusion_dialog.dart';
|
||||
import 'package:stackwallet/services/coins/manager.dart';
|
||||
|
||||
import 'fusion_progress_state.dart';
|
||||
|
||||
|
@ -22,10 +24,10 @@ class FusionProgressUIState extends ChangeNotifier {
|
|||
_done &= (_complete == CashFusionStatus.success) ||
|
||||
(_complete == CashFusionStatus.failed);
|
||||
|
||||
// for (final wallet in _walletStates.values) {
|
||||
// _done &= (wallet.restoringState == CashFusionStatus.success) ||
|
||||
// (wallet.restoringState == CashFusionStatus.failed);
|
||||
// }
|
||||
for (final wallet in _fusionState.values) {
|
||||
_done &= (wallet.fusionState == CashFusionStatus.success) ||
|
||||
(wallet.fusionState == CashFusionStatus.failed);
|
||||
}
|
||||
|
||||
return _done;
|
||||
}
|
||||
|
@ -41,9 +43,9 @@ class FusionProgressUIState extends ChangeNotifier {
|
|||
_succeeded &= _fusing == CashFusionStatus.success;
|
||||
_succeeded &= _complete == CashFusionStatus.success;
|
||||
|
||||
// for (final wallet in _walletStates.values) {
|
||||
// _succeeded &= wallet.restoringState == StackRestoringStatus.success;
|
||||
// }
|
||||
for (final wallet in _fusionState.values) {
|
||||
_succeeded &= wallet.fusionState == CashFusionStatus.success;
|
||||
}
|
||||
|
||||
return _succeeded;
|
||||
}
|
||||
|
@ -83,23 +85,55 @@ class FusionProgressUIState extends ChangeNotifier {
|
|||
notifyListeners();
|
||||
}
|
||||
|
||||
// List<Manager> get managers {
|
||||
// List<Manager> _managers = [];
|
||||
// for (final item in _walletStates.values) {
|
||||
// if (item.manager != null) {
|
||||
// _managers.add(item.manager!);
|
||||
// }
|
||||
// }
|
||||
// return _managers;
|
||||
// }
|
||||
List<Manager> get managers {
|
||||
List<Manager> _managers = [];
|
||||
for (final item in _fusionState.values) {
|
||||
if (item.manager != null) {
|
||||
_managers.add(item.manager!);
|
||||
}
|
||||
}
|
||||
return _managers;
|
||||
}
|
||||
|
||||
Map<String, FusionProgressState> _fusionState = {};
|
||||
Map<String, ChangeNotifierProvider<FusionProgressState>>
|
||||
_fusionStateProviders = {};
|
||||
Map<String, ChangeNotifierProvider<FusionProgressState>>
|
||||
get fusionStateProviders => _fusionStateProviders;
|
||||
|
||||
set fusionState(Map<String, FusionProgressState> state) {
|
||||
_fusionState = state;
|
||||
// _fusionStateProviders = {};
|
||||
// for (final wallet in _fusionState.values) {
|
||||
// _fusionStateProviders[wallet.walletId] =
|
||||
// ChangeNotifierProvider<FusionProgressState>((_) => wallet);
|
||||
// }
|
||||
_fusionStateProviders = {};
|
||||
for (final wallet in _fusionState.values) {
|
||||
_fusionStateProviders[wallet.walletId] =
|
||||
ChangeNotifierProvider<FusionProgressState>((_) => wallet);
|
||||
}
|
||||
|
||||
/// todo: is this true
|
||||
_ableToConnect = true;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
FusionProgressState getFusionProgressState(String walletId) {
|
||||
return _fusionState[walletId]!;
|
||||
}
|
||||
|
||||
ChangeNotifierProvider<FusionProgressState> getFusionProgressStateProvider(
|
||||
String walletId) {
|
||||
return _fusionStateProviders[walletId]!;
|
||||
}
|
||||
|
||||
void update({
|
||||
required String walletId,
|
||||
required CashFusionStatus fusionStatus,
|
||||
Manager? manager,
|
||||
String? address,
|
||||
}) {
|
||||
_fusionState[walletId]!.fusionState = fusionStatus;
|
||||
_fusionState[walletId]!.manager =
|
||||
manager ?? _fusionState[walletId]!.manager;
|
||||
_fusionState[walletId]!.address =
|
||||
address ?? _fusionState[walletId]!.address;
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -634,6 +634,10 @@ class _DesktopCashFusion extends ConsumerState<DesktopCashFusionView> {
|
|||
// .wallet as FusionWalletInterface)
|
||||
// .fuse();
|
||||
|
||||
// have nullable of variable type that can be set or unset; of notifier
|
||||
// when pressed, grab wallet as wallet id
|
||||
// add to fusion wallet interface and connect to provider
|
||||
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
|
|
Loading…
Reference in a new issue