Updated on 2026-08-14

This commit is contained in:
Tangem 2022-06-14 16:32:05 +04:00
commit d4bc43e92a
4 changed files with 19 additions and 7 deletions

@ -1 +1 @@
Subproject commit 985642c135606ba1f59fd739127aec03024da79b
Subproject commit 64ae04d2086e5a605dd4da3cba4af32a60d46c79

View file

@ -187,7 +187,7 @@ fun Context.safeStartActivity(
}
fun View.getString(resId: Int, vararg formatArgs: Any?): String {
return context.getString(resId, formatArgs)
return context.getString(resId, *formatArgs)
}
fun View.animateVisibility(

View file

@ -31,6 +31,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.models.Currency
@ -332,7 +333,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)

View file

@ -8,6 +8,7 @@ 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.Currency
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
@ -103,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 {
@ -137,7 +138,8 @@ class MultiWalletReducer {
token = action.token,
blockchain = action.blockchain.blockchain,
derivationPath = action.blockchain.derivationPath
)
),
walletRent = findWalletRent(state.getWalletStore(walletManager.wallet))
)
state.updateWalletData(newTokenWalletData)
}
@ -161,6 +163,12 @@ class MultiWalletReducer {
is WalletAction.MultiWallet.TryToRemoveWallet -> state
}
}
private fun findWalletRent(walletStore: WalletStore?): WalletRent? {
return walletStore?.walletsData?.firstOrNull {
it.walletRent != null
}?.walletRent
}
}
private fun addTokens(