From 034e28405b321b3c3ae71deb3bbd387d518a0d39 Mon Sep 17 00:00:00 2001 From: Tangem Date: Thu, 9 Jun 2022 20:09:11 +0300 Subject: [PATCH] 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(