CAKE-158 | added _onMoneroBalanceChangeReaction instead _onMoneroTransactionsChangeReaction in the dashboard_view_model.dart

This commit is contained in:
OleksandrSobol 2020-11-20 18:27:56 +02:00
parent 7aecb33044
commit 5787bac658
2 changed files with 13 additions and 10 deletions

View file

@ -367,17 +367,18 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance> with Store {
void _onNewBlock(int height, int blocksLeft, double ptc) async {
if (walletInfo.isRecovery) {
_askForUpdateTransactionHistory();
await _askForUpdateTransactionHistory();
_askForUpdateBalance();
}
if (blocksLeft < 100) {
await _askForUpdateTransactionHistory();
_askForUpdateBalance();
syncStatus = SyncedSyncStatus();
await _afterSyncSave();
if (walletInfo.isRecovery) {
setAsRecovered();
await setAsRecovered();
}
} else {
syncStatus = SyncingSyncStatus(blocksLeft, ptc);

View file

@ -2,7 +2,9 @@ import 'package:cake_wallet/bitcoin/bitcoin_transaction_info.dart';
import 'package:cake_wallet/bitcoin/bitcoin_wallet.dart';
import 'package:cake_wallet/entities/transaction_history.dart';
import 'package:cake_wallet/monero/account.dart';
import 'package:cake_wallet/monero/monero_balance.dart';
import 'package:cake_wallet/monero/monero_transaction_history.dart';
import 'package:cake_wallet/monero/monero_transaction_info.dart';
import 'package:cake_wallet/monero/monero_wallet.dart';
import 'package:cake_wallet/entities/balance_display_mode.dart';
import 'package:cake_wallet/entities/crypto_currency.dart';
@ -87,8 +89,8 @@ abstract class DashboardViewModelBase with Store {
_onMoneroAccountChangeReaction = reaction((_) => _wallet.account,
(Account account) => _onMoneroAccountChange(_wallet));
_onMoneroTransactionsChangeReaction = reaction((_) => _wallet.transactionHistory,
(MoneroTransactionHistory transactionHistory) =>
_onMoneroBalanceChangeReaction = reaction((_) =>
_wallet.balance, (MoneroBalance balance) =>
_onMoneroTransactionsUpdate(_wallet));
final _accountTransactions = _wallet
@ -193,7 +195,7 @@ abstract class DashboardViewModelBase with Store {
ReactionDisposer _onMoneroAccountChangeReaction;
ReactionDisposer _onMoneroTransactionsChangeReaction;
ReactionDisposer _onMoneroBalanceChangeReaction;
Future<void> reconnect() async {
final node = appStore.settingsStore.getCurrentNode(wallet.type);
@ -209,13 +211,13 @@ abstract class DashboardViewModelBase with Store {
subname = wallet.account?.label;
_onMoneroAccountChangeReaction?.reaction?.dispose();
_onMoneroTransactionsChangeReaction?.reaction?.dispose();
_onMoneroBalanceChangeReaction?.reaction?.dispose();
_onMoneroAccountChangeReaction = reaction((_) => wallet.account,
(Account account) => _onMoneroAccountChange(wallet));
_onMoneroTransactionsChangeReaction = reaction((_) => wallet.transactionHistory,
(MoneroTransactionHistory transactionHistory) =>
_onMoneroBalanceChangeReaction = reaction((_) =>
wallet.balance, (MoneroBalance balance) =>
_onMoneroTransactionsUpdate(wallet));
_onMoneroTransactionsUpdate(wallet);