mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-28 12:29: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();
|
||||
});
|
||||
|
||||
connectMapToListWithTransform(
|
||||
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;
|
||||
}
|
||||
_transactionDisposer?.reaction.dispose();
|
||||
|
||||
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) {
|
||||
return monero!.getTransactionInfoAccountId(transaction) ==
|
||||
monero!.getCurrentAccount(wallet).id;
|
||||
return monero!.getTransactionInfoAccountId(tx) == monero!.getCurrentAccount(wallet).id;
|
||||
}
|
||||
if (wallet.type == WalletType.wownero) {
|
||||
return wow.wownero!.getTransactionInfoAccountId(transaction) ==
|
||||
wow.wownero!.getCurrentAccount(wallet).id;
|
||||
return wow.wownero!.getTransactionInfoAccountId(tx) == wow.wownero!.getCurrentAccount(wallet).id;
|
||||
}
|
||||
|
||||
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) {
|
||||
silentPaymentsScanningActive = bitcoin!.getScanningActive(wallet);
|
||||
|
@ -583,6 +584,8 @@ abstract class DashboardViewModelBase with Store {
|
|||
|
||||
ReactionDisposer? _onMoneroBalanceChangeReaction;
|
||||
|
||||
ReactionDisposer? _transactionDisposer;
|
||||
|
||||
@computed
|
||||
bool get hasPowNodes => [WalletType.nano, WalletType.banano].contains(wallet.type);
|
||||
|
||||
|
@ -687,32 +690,34 @@ abstract class DashboardViewModelBase with Store {
|
|||
);
|
||||
}
|
||||
|
||||
connectMapToListWithTransform(
|
||||
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.dispose();
|
||||
|
||||
_transactionDisposer = reaction(
|
||||
(_) => appStore.wallet!.transactionHistory.transactions.values.toList(),
|
||||
(List<TransactionInfo> txs) {
|
||||
|
||||
transactions.clear();
|
||||
|
||||
transactions.addAll(
|
||||
txs.where((tx) {
|
||||
if (wallet.type == WalletType.monero) {
|
||||
return monero!.getTransactionInfoAccountId(tx) == monero!.getCurrentAccount(wallet).id;
|
||||
}
|
||||
|
||||
if (wallet.type == WalletType.wownero) {
|
||||
return wow.wownero!.getTransactionInfoAccountId(tx) ==
|
||||
wow.wownero!.getCurrentAccount(wallet).id;
|
||||
return wow.wownero!.getTransactionInfoAccountId(tx) == wow.wownero!.getCurrentAccount(wallet).id;
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
}).map(
|
||||
(tx) => TransactionListItem(
|
||||
transaction: tx,
|
||||
balanceViewModel: balanceViewModel,
|
||||
settingsStore: appStore.settingsStore,
|
||||
key: ValueKey('${wallet.type.name}_transaction_history_item_${tx.id}_key'),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@action
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue