Updated on 2026-08-14

This commit is contained in:
Tangem 2025-08-14 20:10:29 +04:00
parent 26ba1b1c4c
commit 58b345126c
2 changed files with 15 additions and 5 deletions

View file

@ -13,6 +13,7 @@ import com.tangem.domain.balancehiding.GetBalanceHidingSettingsUseCase
import com.tangem.domain.card.common.util.cardTypesResolver
import com.tangem.domain.models.wallet.UserWallet
import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.domain.models.wallet.isLocked
import com.tangem.domain.models.wallet.isMultiCurrency
import com.tangem.domain.nft.ObserveAndClearNFTCacheIfNeedUseCase
import com.tangem.domain.notifications.GetIsHuaweiDeviceWithoutGoogleServicesUseCase
@ -383,9 +384,11 @@ internal class WalletModel @Inject constructor(
val otherWallets = action.wallets.minus(action.selectedWallet)
if (tokensFeatureToggles.isWalletBalanceFetcherEnabled) {
otherWallets.onEach { userWallet ->
modelScope.launch { walletContentFetcher(userWalletId = userWallet.walletId) }
}
otherWallets
.filterNot(UserWallet::isLocked)
.onEach { userWallet ->
modelScope.launch { walletContentFetcher(userWalletId = userWallet.walletId) }
}
}
if (action.wallets.size > 1 && isWalletsScrollPreviewEnabled()) {
@ -500,6 +503,10 @@ internal class WalletModel @Inject constructor(
clickIntents = clickIntents,
coroutineScope = modelScope,
)
action.unlockedWallets.onEach { userWallet ->
modelScope.launch { fetchWalletContent(userWallet = userWallet) }
}
}
private fun demonstrateWalletsScrollPreview(direction: Direction) {
@ -541,6 +548,8 @@ internal class WalletModel @Inject constructor(
private suspend fun fetchWalletContent(userWallet: UserWallet) {
if (tokensFeatureToggles.isWalletBalanceFetcherEnabled) {
if (userWallet.isLocked) return
/*
* Updating the balance of the current wallet is an essential part of InitializationWallets,
* so the coroutine is launched in the current context

View file

@ -5,13 +5,14 @@ import com.tangem.domain.appcurrency.GetSelectedAppCurrencyUseCase
import com.tangem.domain.appcurrency.extenstions.unwrap
import com.tangem.domain.card.common.util.cardTypesResolver
import com.tangem.domain.exchange.RampStateManager
import com.tangem.domain.models.wallet.UserWallet
import com.tangem.domain.models.wallet.isLocked
import com.tangem.domain.onramp.FetchHotCryptoUseCase
import com.tangem.domain.settings.NeverToShowWalletsScrollPreview
import com.tangem.domain.tokens.FetchCardTokenListUseCase
import com.tangem.domain.tokens.FetchCurrencyStatusUseCase
import com.tangem.domain.tokens.FetchTokenListUseCase
import com.tangem.domain.tokens.TokensFeatureToggles
import com.tangem.domain.models.wallet.UserWallet
import com.tangem.domain.wallets.usecase.GetSelectedWalletSyncUseCase
import com.tangem.domain.wallets.usecase.SelectWalletUseCase
import com.tangem.feature.wallet.presentation.router.InnerWalletRouter
@ -87,7 +88,7 @@ internal class WalletClickIntents @Inject constructor(
stateHolder.update { it.copy(selectedWalletIndex = index) }
maybeUserWallet.onRight {
if (tokensFeatureToggles.isWalletBalanceFetcherEnabled) {
if (tokensFeatureToggles.isWalletBalanceFetcherEnabled && !it.isLocked) {
launch { walletContentFetcher(userWalletId = it.walletId) }
}