Updated on 2026-08-14

This commit is contained in:
Tangem 2024-04-04 13:07:18 +03:00
parent bc00198797
commit ddb8de4964
20 changed files with 447 additions and 84 deletions

View file

@ -106,13 +106,11 @@ class SwapDomainModule {
currenciesRepository: CurrenciesRepository,
quotesRepository: QuotesRepository,
networksRepository: NetworksRepository,
dispatchers: CoroutineDispatcherProvider,
): GetCardTokensListUseCase {
return GetCardTokensListUseCase(
currenciesRepository = currenciesRepository,
quotesRepository = quotesRepository,
networksRepository = networksRepository,
dispatchers = dispatchers,
)
}

View file

@ -84,7 +84,7 @@ internal class TokenDetailsLoadedBalanceConverter(
}
private fun getMarketPriceState(
status: CryptoCurrencyStatus.Status,
status: CryptoCurrencyStatus.Value,
currencySymbol: String,
): MarketPriceBlockState {
return when (status) {
@ -106,7 +106,7 @@ internal class TokenDetailsLoadedBalanceConverter(
}
}
private fun CryptoCurrencyStatus.Status.toContentConfig(currencySymbol: String): MarketPriceBlockState.Content {
private fun CryptoCurrencyStatus.Value.toContentConfig(currencySymbol: String): MarketPriceBlockState.Content {
return MarketPriceBlockState.Content(
currencySymbol = currencySymbol,
price = formatPrice(status = this, appCurrency = appCurrencyProvider()),
@ -117,11 +117,11 @@ internal class TokenDetailsLoadedBalanceConverter(
)
}
private fun getPriceChangeType(status: CryptoCurrencyStatus.Status): PriceChangeType {
private fun getPriceChangeType(status: CryptoCurrencyStatus.Value): PriceChangeType {
return PriceChangeConverter.fromBigDecimal(status.priceChange)
}
private fun formatPriceChange(status: CryptoCurrencyStatus.Status): String {
private fun formatPriceChange(status: CryptoCurrencyStatus.Value): String {
val priceChange = status.priceChange ?: return BigDecimalFormatter.EMPTY_BALANCE_SIGN
return BigDecimalFormatter.formatPercent(
@ -130,7 +130,7 @@ internal class TokenDetailsLoadedBalanceConverter(
)
}
private fun formatPrice(status: CryptoCurrencyStatus.Status, appCurrency: AppCurrency): String {
private fun formatPrice(status: CryptoCurrencyStatus.Value, appCurrency: AppCurrency): String {
val fiatRate = status.fiatRate ?: return BigDecimalFormatter.EMPTY_BALANCE_SIGN
return BigDecimalFormatter.formatFiatAmount(
@ -140,7 +140,7 @@ internal class TokenDetailsLoadedBalanceConverter(
)
}
private fun formatFiatAmount(status: CryptoCurrencyStatus.Status, appCurrency: AppCurrency): String {
private fun formatFiatAmount(status: CryptoCurrencyStatus.Value, appCurrency: AppCurrency): String {
val fiatAmount = status.fiatAmount ?: return BigDecimalFormatter.EMPTY_BALANCE_SIGN
return BigDecimalFormatter.formatFiatAmount(

View file

@ -10,7 +10,7 @@ import com.tangem.feature.wallet.presentation.wallet.state.model.WalletCardState
import com.tangem.utils.converter.Converter
internal class SingleWalletCardStateConverter(
private val status: CryptoCurrencyStatus.Status,
private val status: CryptoCurrencyStatus.Value,
private val selectedWallet: UserWallet,
private val appCurrency: AppCurrency,
) : Converter<WalletCardState, WalletCardState> {
@ -50,7 +50,7 @@ internal class SingleWalletCardStateConverter(
)
}
private fun WalletCardState.toContentState(status: CryptoCurrencyStatus.Status): WalletCardState {
private fun WalletCardState.toContentState(status: CryptoCurrencyStatus.Value): WalletCardState {
return WalletCardState.Content(
id = id,
title = title,
@ -66,7 +66,7 @@ internal class SingleWalletCardStateConverter(
)
}
private fun formatFiatAmount(status: CryptoCurrencyStatus.Status, appCurrency: AppCurrency): String {
private fun formatFiatAmount(status: CryptoCurrencyStatus.Value, appCurrency: AppCurrency): String {
val fiatAmount = status.fiatAmount ?: return BigDecimalFormatter.EMPTY_BALANCE_SIGN
return BigDecimalFormatter.formatFiatAmount(

View file

@ -10,7 +10,7 @@ import com.tangem.domain.tokens.model.CryptoCurrencyStatus
import com.tangem.utils.converter.Converter
internal class SingleWalletMarketPriceConverter(
private val status: CryptoCurrencyStatus.Status,
private val status: CryptoCurrencyStatus.Value,
private val appCurrency: AppCurrency,
) : Converter<MarketPriceBlockState, MarketPriceBlockState> {
@ -44,7 +44,7 @@ internal class SingleWalletMarketPriceConverter(
)
}
private fun formatPrice(status: CryptoCurrencyStatus.Status, appCurrency: AppCurrency): String {
private fun formatPrice(status: CryptoCurrencyStatus.Value, appCurrency: AppCurrency): String {
val fiatRate = status.fiatRate ?: return BigDecimalFormatter.EMPTY_BALANCE_SIGN
return BigDecimalFormatter.formatFiatAmount(
@ -54,13 +54,13 @@ internal class SingleWalletMarketPriceConverter(
)
}
private fun formatPriceChange(status: CryptoCurrencyStatus.Status): String {
private fun formatPriceChange(status: CryptoCurrencyStatus.Value): String {
val priceChange = status.priceChange ?: return BigDecimalFormatter.EMPTY_BALANCE_SIGN
return BigDecimalFormatter.formatPercent(percent = priceChange, useAbsoluteValue = true)
}
private fun getPriceChangeType(status: CryptoCurrencyStatus.Status): PriceChangeType {
private fun getPriceChangeType(status: CryptoCurrencyStatus.Value): PriceChangeType {
return PriceChangeConverter.fromBigDecimal(status.priceChange)
}
}

View file

@ -121,7 +121,7 @@ internal class WalletCurrencyActionsClickIntentsImplementor @Inject constructor(
private fun sendToken(
cryptoCurrency: CryptoCurrency.Token,
cryptoCurrencyStatus: CryptoCurrencyStatus.Status,
cryptoCurrencyStatus: CryptoCurrencyStatus.Value,
feeCurrencyStatus: CryptoCurrencyStatus?,
userWallet: UserWallet,
) {