Updated on 2026-08-14

This commit is contained in:
Tangem 2024-11-13 15:02:44 +02:00
parent dfa8619c13
commit c49d680508
10 changed files with 52 additions and 33 deletions

View file

@ -10,9 +10,7 @@ import com.tangem.core.ui.extensions.resourceReference
import com.tangem.core.ui.pullToRefresh.PullToRefreshConfig
import com.tangem.core.ui.res.TangemTheme
import com.tangem.domain.card.NetworkHasDerivationUseCase
import com.tangem.domain.staking.GetStakingAvailabilityUseCase
import com.tangem.domain.staking.GetStakingIntegrationIdUseCase
import com.tangem.domain.staking.model.StakingAvailability
import com.tangem.domain.tokens.model.CryptoCurrency
import com.tangem.domain.tokens.model.Network
import com.tangem.domain.wallets.models.UserWalletId
@ -32,7 +30,6 @@ internal class TokenDetailsSkeletonStateConverter(
private val clickIntents: TokenDetailsClickIntents,
private val networkHasDerivationUseCase: NetworkHasDerivationUseCase,
private val getStakingIntegrationIdUseCase: GetStakingIntegrationIdUseCase,
private val getStakingAvailabilityUseCase: GetStakingAvailabilityUseCase,
private val getUserWalletUseCase: GetUserWalletUseCase,
private val userWalletId: UserWalletId,
) : Converter<CryptoCurrency, TokenDetailsState> {
@ -42,8 +39,6 @@ internal class TokenDetailsSkeletonStateConverter(
override fun convert(value: CryptoCurrency): TokenDetailsState {
val iconState = iconStateConverter.convert(value)
val isSupportedInMobileApp = getStakingIntegrationIdUseCase(value.id).isNullOrBlank().not()
val stakingAvailability = getStakingAvailabilityUseCase(userWalletId, value)
.getOrElse { StakingAvailability.Unavailable }
return TokenDetailsState(
topAppBarConfig = TokenDetailsTopAppBarConfig(
@ -68,11 +63,7 @@ internal class TokenDetailsSkeletonStateConverter(
selectedBalanceType = BalanceType.ALL,
),
marketPriceBlockState = MarketPriceBlockState.Loading(value.symbol),
stakingBlocksState = if (stakingAvailability == StakingAvailability.TemporaryUnavailable) {
StakingBlockUM.TemporaryUnavailable
} else {
StakingBlockUM.Loading(iconState).takeIf { isSupportedInMobileApp }
},
stakingBlocksState = StakingBlockUM.Loading(iconState).takeIf { isSupportedInMobileApp },
notifications = persistentListOf(),
pendingTxs = persistentListOf(),
swapTxs = persistentListOf(),

View file

@ -17,7 +17,6 @@ import com.tangem.core.ui.res.TangemTheme
import com.tangem.domain.appcurrency.model.AppCurrency
import com.tangem.domain.card.NetworkHasDerivationUseCase
import com.tangem.domain.common.CardTypesResolver
import com.tangem.domain.staking.GetStakingAvailabilityUseCase
import com.tangem.domain.staking.GetStakingIntegrationIdUseCase
import com.tangem.domain.staking.model.StakingAvailability
import com.tangem.domain.staking.model.StakingEntryInfo
@ -59,7 +58,6 @@ internal class TokenDetailsStateFactory(
private val userWalletId: UserWalletId,
stakingFeatureToggles: StakingFeatureToggles,
getStakingIntegrationIdUseCase: GetStakingIntegrationIdUseCase,
getStakingAvailabilityUseCase: GetStakingAvailabilityUseCase,
symbol: String,
decimals: Int,
) {
@ -69,7 +67,6 @@ internal class TokenDetailsStateFactory(
clickIntents = clickIntents,
networkHasDerivationUseCase = networkHasDerivationUseCase,
getStakingIntegrationIdUseCase = getStakingIntegrationIdUseCase,
getStakingAvailabilityUseCase = getStakingAvailabilityUseCase,
getUserWalletUseCase = getUserWalletUseCase,
userWalletId = userWalletId,
)

View file

@ -166,7 +166,6 @@ internal class TokenDetailsViewModel @Inject constructor(
userWalletId = userWalletId,
stakingFeatureToggles = stakingFeatureToggles,
getStakingIntegrationIdUseCase = getStakingIntegrationIdUseCase,
getStakingAvailabilityUseCase = getStakingAvailabilityUseCase,
symbol = cryptoCurrency.symbol,
decimals = cryptoCurrency.decimals,
)