mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-18 02:07:43 +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/cupertino.dart';
|
||||||
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:stackwallet/pages_desktop_specific/cashfusion/sub_widgets/fusion_dialog.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';
|
import 'fusion_progress_state.dart';
|
||||||
|
|
||||||
|
@ -22,10 +24,10 @@ class FusionProgressUIState extends ChangeNotifier {
|
||||||
_done &= (_complete == CashFusionStatus.success) ||
|
_done &= (_complete == CashFusionStatus.success) ||
|
||||||
(_complete == CashFusionStatus.failed);
|
(_complete == CashFusionStatus.failed);
|
||||||
|
|
||||||
// for (final wallet in _walletStates.values) {
|
for (final wallet in _fusionState.values) {
|
||||||
// _done &= (wallet.restoringState == CashFusionStatus.success) ||
|
_done &= (wallet.fusionState == CashFusionStatus.success) ||
|
||||||
// (wallet.restoringState == CashFusionStatus.failed);
|
(wallet.fusionState == CashFusionStatus.failed);
|
||||||
// }
|
}
|
||||||
|
|
||||||
return _done;
|
return _done;
|
||||||
}
|
}
|
||||||
|
@ -41,9 +43,9 @@ class FusionProgressUIState extends ChangeNotifier {
|
||||||
_succeeded &= _fusing == CashFusionStatus.success;
|
_succeeded &= _fusing == CashFusionStatus.success;
|
||||||
_succeeded &= _complete == CashFusionStatus.success;
|
_succeeded &= _complete == CashFusionStatus.success;
|
||||||
|
|
||||||
// for (final wallet in _walletStates.values) {
|
for (final wallet in _fusionState.values) {
|
||||||
// _succeeded &= wallet.restoringState == StackRestoringStatus.success;
|
_succeeded &= wallet.fusionState == CashFusionStatus.success;
|
||||||
// }
|
}
|
||||||
|
|
||||||
return _succeeded;
|
return _succeeded;
|
||||||
}
|
}
|
||||||
|
@ -83,23 +85,55 @@ class FusionProgressUIState extends ChangeNotifier {
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
// List<Manager> get managers {
|
List<Manager> get managers {
|
||||||
// List<Manager> _managers = [];
|
List<Manager> _managers = [];
|
||||||
// for (final item in _walletStates.values) {
|
for (final item in _fusionState.values) {
|
||||||
// if (item.manager != null) {
|
if (item.manager != null) {
|
||||||
// _managers.add(item.manager!);
|
_managers.add(item.manager!);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// return _managers;
|
return _managers;
|
||||||
// }
|
}
|
||||||
|
|
||||||
Map<String, FusionProgressState> _fusionState = {};
|
Map<String, FusionProgressState> _fusionState = {};
|
||||||
|
Map<String, ChangeNotifierProvider<FusionProgressState>>
|
||||||
|
_fusionStateProviders = {};
|
||||||
|
Map<String, ChangeNotifierProvider<FusionProgressState>>
|
||||||
|
get fusionStateProviders => _fusionStateProviders;
|
||||||
|
|
||||||
set fusionState(Map<String, FusionProgressState> state) {
|
set fusionState(Map<String, FusionProgressState> state) {
|
||||||
_fusionState = state;
|
_fusionState = state;
|
||||||
// _fusionStateProviders = {};
|
_fusionStateProviders = {};
|
||||||
// for (final wallet in _fusionState.values) {
|
for (final wallet in _fusionState.values) {
|
||||||
// _fusionStateProviders[wallet.walletId] =
|
_fusionStateProviders[wallet.walletId] =
|
||||||
// ChangeNotifierProvider<FusionProgressState>((_) => wallet);
|
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)
|
// .wallet as FusionWalletInterface)
|
||||||
// .fuse();
|
// .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(
|
await showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
|
|
Loading…
Reference in a new issue