CAKE-158 | merged 4.0.8 into current branch; renamed _onMoneroTransactionsChange() on _onMoneroTransactionsUpdate(); applied _onMoneroTransactionsUpdate() in the dashboard_view_model.dart

This commit is contained in:
OleksandrSobol 2020-11-18 19:09:34 +02:00
parent 17ba74bce7
commit 7aecb33044
2 changed files with 8 additions and 24 deletions

View file

@ -1,3 +1,4 @@
import 'package:cake_wallet/src/widgets/keyboard_done_button.dart';
import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';

View file

@ -89,7 +89,7 @@ abstract class DashboardViewModelBase with Store {
_onMoneroTransactionsChangeReaction = reaction((_) => _wallet.transactionHistory,
(MoneroTransactionHistory transactionHistory) =>
_onMoneroTransactionsChange(_wallet));
_onMoneroTransactionsUpdate(_wallet));
final _accountTransactions = _wallet
.transactionHistory.transactions.values
@ -204,7 +204,6 @@ abstract class DashboardViewModelBase with Store {
void _onWalletChange(WalletBase wallet) {
this.wallet = wallet;
name = wallet.name;
transactions.clear();
if (wallet is MoneroWallet) {
subname = wallet.account?.label;
@ -217,18 +216,12 @@ abstract class DashboardViewModelBase with Store {
_onMoneroTransactionsChangeReaction = reaction((_) => wallet.transactionHistory,
(MoneroTransactionHistory transactionHistory) =>
_onMoneroTransactionsChange(wallet));
_onMoneroTransactionsUpdate(wallet));
final _accountTransactions = wallet
.transactionHistory.transactions.values
.where((tx) => tx.accountIndex == wallet.account.id).toList();
transactions.addAll(_accountTransactions
.map((transaction) => TransactionListItem(
transaction: transaction,
balanceViewModel: balanceViewModel,
settingsStore: appStore.settingsStore)));
_onMoneroTransactionsUpdate(wallet);
} else {
transactions.clear();
transactions.addAll(wallet.transactionHistory.transactions.values.map(
(transaction) => TransactionListItem(
transaction: transaction,
@ -240,21 +233,11 @@ abstract class DashboardViewModelBase with Store {
@action
void _onMoneroAccountChange(MoneroWallet wallet) {
subname = wallet.account?.label;
transactions.clear();
final _accountTransactions = wallet
.transactionHistory.transactions.values
.where((tx) => tx.accountIndex == wallet.account.id).toList();
transactions.addAll(_accountTransactions
.map((transaction) => TransactionListItem(
transaction: transaction,
balanceViewModel: balanceViewModel,
settingsStore: appStore.settingsStore)));
_onMoneroTransactionsUpdate(wallet);
}
@action
void _onMoneroTransactionsChange(MoneroWallet wallet) {
void _onMoneroTransactionsUpdate(MoneroWallet wallet) {
transactions.clear();
final _accountTransactions = wallet