From 034e28405b321b3c3ae71deb3bbd387d518a0d39 Mon Sep 17 00:00:00 2001 From: Tangem Date: Thu, 9 Jun 2022 20:09:11 +0300 Subject: [PATCH 1/2] Updated on 2026-08-14 --- app/src/main/assets/tangem-app-config | 2 +- .../redux/reducers/MultiWalletReducer.kt | 24 ++++++++++--------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/app/src/main/assets/tangem-app-config b/app/src/main/assets/tangem-app-config index 7f058ec409..64ae04d208 160000 --- a/app/src/main/assets/tangem-app-config +++ b/app/src/main/assets/tangem-app-config @@ -1 +1 @@ -Subproject commit 7f058ec409b4eaaf8688ecd4bf944ef8d58d3564 +Subproject commit 64ae04d2086e5a605dd4da3cba4af32a60d46c79 diff --git a/app/src/main/java/com/tangem/tap/features/wallet/redux/reducers/MultiWalletReducer.kt b/app/src/main/java/com/tangem/tap/features/wallet/redux/reducers/MultiWalletReducer.kt index 28a7675472..21ca817883 100644 --- a/app/src/main/java/com/tangem/tap/features/wallet/redux/reducers/MultiWalletReducer.kt +++ b/app/src/main/java/com/tangem/tap/features/wallet/redux/reducers/MultiWalletReducer.kt @@ -8,16 +8,11 @@ import com.tangem.tap.common.extensions.toFiatString import com.tangem.tap.common.extensions.toFormattedCurrencyString import com.tangem.tap.domain.getFirstToken import com.tangem.tap.domain.tokens.models.BlockchainNetwork +import com.tangem.tap.features.wallet.models.WalletRent import com.tangem.tap.features.wallet.models.filterByToken import com.tangem.tap.features.wallet.models.getPendingTransactions import com.tangem.tap.features.wallet.models.removeUnknownTransactions -import com.tangem.tap.features.wallet.models.toPendingTransactions -import com.tangem.tap.features.wallet.redux.Currency -import com.tangem.tap.features.wallet.redux.WalletAction -import com.tangem.tap.features.wallet.redux.WalletData -import com.tangem.tap.features.wallet.redux.WalletMainButton -import com.tangem.tap.features.wallet.redux.WalletState -import com.tangem.tap.features.wallet.redux.WalletStore +import com.tangem.tap.features.wallet.redux.* import com.tangem.tap.features.wallet.ui.BalanceStatus import com.tangem.tap.features.wallet.ui.BalanceWidgetData import com.tangem.tap.features.wallet.ui.TokenData @@ -109,10 +104,10 @@ class MultiWalletReducer { } is WalletAction.MultiWallet.TokenLoaded -> { val currency = Currency.fromBlockchainNetwork(action.blockchain, action.token) - val wallet = state.getWalletManager(currency)?.wallet.guard { - throw NullPointerException("MultiWallet.TokenLoaded: WalletManager must be no NULL") + val walletManager = state.getWalletManager(currency).guard { + throw NullPointerException("MultiWallet.TokenLoaded: WalletManager must be not NULL") } - + val wallet = walletManager.wallet val pendingTransactions = wallet.getPendingTransactions() val tokenPendingTransactions = pendingTransactions.filterByToken(action.token) val tokenBalanceStatus = when { @@ -142,7 +137,8 @@ class MultiWalletReducer { token = action.token, blockchain = action.blockchain.blockchain, derivationPath = action.blockchain.derivationPath - ) + ), + walletRent = findWalletRent(state.getWalletStore(walletManager.wallet)) ) state.updateWalletData(newTokenWalletData) } @@ -165,6 +161,12 @@ class MultiWalletReducer { is WalletAction.MultiWallet.SaveCurrencies -> state } } + + private fun findWalletRent(walletStore: WalletStore?): WalletRent? { + return walletStore?.walletsData?.firstOrNull { + it.walletRent != null + }?.walletRent + } } private fun addTokens( From 3749575e6023ee60497d62767b62f2e04790d2a3 Mon Sep 17 00:00:00 2001 From: Tangem Date: Thu, 9 Jun 2022 20:54:52 +0300 Subject: [PATCH 2/2] Updated on 2026-08-14 --- .../features/wallet/redux/middlewares/WalletMiddleware.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/tangem/tap/features/wallet/redux/middlewares/WalletMiddleware.kt b/app/src/main/java/com/tangem/tap/features/wallet/redux/middlewares/WalletMiddleware.kt index a4862b21b8..e1691d632e 100644 --- a/app/src/main/java/com/tangem/tap/features/wallet/redux/middlewares/WalletMiddleware.kt +++ b/app/src/main/java/com/tangem/tap/features/wallet/redux/middlewares/WalletMiddleware.kt @@ -26,6 +26,7 @@ import com.tangem.tap.features.demo.DemoHelper import com.tangem.tap.features.home.redux.HomeAction import com.tangem.tap.features.send.redux.PrepareSendScreen import com.tangem.tap.features.wallet.models.PendingTransactionType +import com.tangem.tap.features.wallet.models.filterByCoin import com.tangem.tap.features.wallet.models.getPendingTransactions import com.tangem.tap.features.wallet.models.getSendableAmounts import com.tangem.tap.features.wallet.redux.* @@ -322,7 +323,10 @@ class WalletMiddleware { } val balance = walletManager.wallet.fundsAvailable(AmountType.Coin) - val outgoingTxs = walletManager.wallet.getPendingTransactions(PendingTransactionType.Outgoing) + val outgoingTxs = walletManager.wallet.getPendingTransactions( + PendingTransactionType.Outgoing + ).filterByCoin() + val rentExempt = result.data val show = if (outgoingTxs.isEmpty()) { isNeedToShowWarning(balance, rentExempt)