mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-28 20:39:51 +00:00
Merge pull request #2040 from cake-tech/CW-855-Transactions-not-cleared-correctly-when-switching-wallets
Cw 855 transactions not cleared correctly when switching wallets
This commit is contained in:
commit
4b03fc763f
1 changed files with 56 additions and 51 deletions
|
@ -258,33 +258,34 @@ abstract class DashboardViewModelBase with Store {
|
||||||
_checkMweb();
|
_checkMweb();
|
||||||
});
|
});
|
||||||
|
|
||||||
connectMapToListWithTransform(
|
_transactionDisposer?.reaction.dispose();
|
||||||
appStore.wallet!.transactionHistory.transactions,
|
|
||||||
transactions,
|
|
||||||
(TransactionInfo? transaction) => TransactionListItem(
|
|
||||||
transaction: transaction!,
|
|
||||||
balanceViewModel: balanceViewModel,
|
|
||||||
settingsStore: appStore.settingsStore,
|
|
||||||
key: ValueKey(
|
|
||||||
'${_wallet.type.name}_transaction_history_item_${transaction.id}_key',
|
|
||||||
),
|
|
||||||
), filter: (TransactionInfo? transaction) {
|
|
||||||
if (transaction == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
final wallet = _wallet;
|
_transactionDisposer = reaction(
|
||||||
|
(_) => appStore.wallet!.transactionHistory.transactions.values.toList(),
|
||||||
|
(List<TransactionInfo> txs) {
|
||||||
|
|
||||||
|
transactions.clear();
|
||||||
|
|
||||||
|
transactions.addAll(
|
||||||
|
txs.where((tx) {
|
||||||
if (wallet.type == WalletType.monero) {
|
if (wallet.type == WalletType.monero) {
|
||||||
return monero!.getTransactionInfoAccountId(transaction) ==
|
return monero!.getTransactionInfoAccountId(tx) == monero!.getCurrentAccount(wallet).id;
|
||||||
monero!.getCurrentAccount(wallet).id;
|
|
||||||
}
|
}
|
||||||
if (wallet.type == WalletType.wownero) {
|
if (wallet.type == WalletType.wownero) {
|
||||||
return wow.wownero!.getTransactionInfoAccountId(transaction) ==
|
return wow.wownero!.getTransactionInfoAccountId(tx) == wow.wownero!.getCurrentAccount(wallet).id;
|
||||||
wow.wownero!.getCurrentAccount(wallet).id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
});
|
}).map(
|
||||||
|
(tx) => TransactionListItem(
|
||||||
|
transaction: tx,
|
||||||
|
balanceViewModel: balanceViewModel,
|
||||||
|
settingsStore: appStore.settingsStore,
|
||||||
|
key: ValueKey('${wallet.type.name}_transaction_history_item_${tx.id}_key'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
if (hasSilentPayments) {
|
if (hasSilentPayments) {
|
||||||
silentPaymentsScanningActive = bitcoin!.getScanningActive(wallet);
|
silentPaymentsScanningActive = bitcoin!.getScanningActive(wallet);
|
||||||
|
@ -583,6 +584,8 @@ abstract class DashboardViewModelBase with Store {
|
||||||
|
|
||||||
ReactionDisposer? _onMoneroBalanceChangeReaction;
|
ReactionDisposer? _onMoneroBalanceChangeReaction;
|
||||||
|
|
||||||
|
ReactionDisposer? _transactionDisposer;
|
||||||
|
|
||||||
@computed
|
@computed
|
||||||
bool get hasPowNodes => [WalletType.nano, WalletType.banano].contains(wallet.type);
|
bool get hasPowNodes => [WalletType.nano, WalletType.banano].contains(wallet.type);
|
||||||
|
|
||||||
|
@ -687,32 +690,34 @@ abstract class DashboardViewModelBase with Store {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
connectMapToListWithTransform(
|
_transactionDisposer?.reaction.dispose();
|
||||||
appStore.wallet!.transactionHistory.transactions,
|
|
||||||
transactions,
|
|
||||||
(TransactionInfo? transaction) => TransactionListItem(
|
|
||||||
transaction: transaction!,
|
|
||||||
balanceViewModel: balanceViewModel,
|
|
||||||
settingsStore: appStore.settingsStore,
|
|
||||||
key: ValueKey(
|
|
||||||
'${wallet.type.name}_transaction_history_item_${transaction.id}_key',
|
|
||||||
),
|
|
||||||
), filter: (TransactionInfo? tx) {
|
|
||||||
if (tx == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
_transactionDisposer = reaction(
|
||||||
|
(_) => appStore.wallet!.transactionHistory.transactions.values.toList(),
|
||||||
|
(List<TransactionInfo> txs) {
|
||||||
|
|
||||||
|
transactions.clear();
|
||||||
|
|
||||||
|
transactions.addAll(
|
||||||
|
txs.where((tx) {
|
||||||
if (wallet.type == WalletType.monero) {
|
if (wallet.type == WalletType.monero) {
|
||||||
return monero!.getTransactionInfoAccountId(tx) == monero!.getCurrentAccount(wallet).id;
|
return monero!.getTransactionInfoAccountId(tx) == monero!.getCurrentAccount(wallet).id;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wallet.type == WalletType.wownero) {
|
if (wallet.type == WalletType.wownero) {
|
||||||
return wow.wownero!.getTransactionInfoAccountId(tx) ==
|
return wow.wownero!.getTransactionInfoAccountId(tx) == wow.wownero!.getCurrentAccount(wallet).id;
|
||||||
wow.wownero!.getCurrentAccount(wallet).id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
});
|
}).map(
|
||||||
|
(tx) => TransactionListItem(
|
||||||
|
transaction: tx,
|
||||||
|
balanceViewModel: balanceViewModel,
|
||||||
|
settingsStore: appStore.settingsStore,
|
||||||
|
key: ValueKey('${wallet.type.name}_transaction_history_item_${tx.id}_key'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue