Updated on 2026-08-14
This commit is contained in:
parent
660d00ffb2
commit
c49b3a9176
6 changed files with 20 additions and 2 deletions
|
|
@ -41,6 +41,7 @@ internal object TokenMarketListConverter : Converter<TokenMarketListResponse, To
|
|||
),
|
||||
tokenCharts = TokenMarket.Charts(h24 = null, week = null, month = null),
|
||||
stakingRate = stakingRate,
|
||||
updateTimestamp = value.timestamp,
|
||||
)
|
||||
}
|
||||
return TokenMarketListWithMaxApy(tokens, value.summary?.maxApy)
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ data class TokenMarket(
|
|||
val tokenQuotesShort: TokenQuotesShort,
|
||||
val tokenCharts: Charts,
|
||||
val stakingRate: BigDecimal?,
|
||||
val updateTimestamp: Long?,
|
||||
private val imageHost: String,
|
||||
) {
|
||||
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ internal class MarketsTokenItemConverter(
|
|||
stakingRate = value.stakingRate?.format { percent() }?.let {
|
||||
resourceReference(R.string.markets_apy_placeholder, wrappedList(it))
|
||||
},
|
||||
updateTimestamp = value.updateTimestamp,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,11 +23,11 @@ import com.tangem.core.ui.test.MarketsTestTags
|
|||
import com.tangem.domain.models.currency.CryptoCurrency
|
||||
import com.tangem.features.markets.impl.R
|
||||
import com.tangem.features.markets.tokenlist.impl.ui.state.ListUM
|
||||
import com.tangem.features.markets.tokenlist.impl.ui.state.MarketsListItemUM.Companion.TOKEN_LAZY_LIST_ID_SEPARATOR
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
private const val LOAD_NEXT_PAGE_ON_END_INDEX = 50
|
||||
private const val LOAD_NEXT_PAGE_ON_END_INDEX_SEARCH = 25
|
||||
private const val TOKEN_LAZY_LIST_ID_SEPARATOR = "***"
|
||||
|
||||
@Composable
|
||||
@Suppress("LongMethod")
|
||||
|
|
@ -92,7 +92,7 @@ internal fun MarketsListLazyColumn(
|
|||
is ListUM.Content -> {
|
||||
items(
|
||||
items = state.items,
|
||||
key = { it.id.value + TOKEN_LAZY_LIST_ID_SEPARATOR + it.marketCap.toString() },
|
||||
key = { it.getComposeKey() },
|
||||
) { item ->
|
||||
MarketsListItem(
|
||||
model = item,
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ internal class MarketChartListItemPreviewDataProvider : CollectionPreviewParamet
|
|||
),
|
||||
isUnder100kMarketCap = false,
|
||||
stakingRate = stringReference("APY 12.34%"),
|
||||
updateTimestamp = 0,
|
||||
),
|
||||
MarketsListItemUM(
|
||||
id = CryptoCurrency.RawID("1"),
|
||||
|
|
@ -41,6 +42,7 @@ internal class MarketChartListItemPreviewDataProvider : CollectionPreviewParamet
|
|||
chartData = null,
|
||||
isUnder100kMarketCap = false,
|
||||
stakingRate = stringReference("APY 12.34%"),
|
||||
updateTimestamp = 0,
|
||||
),
|
||||
MarketsListItemUM(
|
||||
id = CryptoCurrency.RawID("1"),
|
||||
|
|
@ -57,6 +59,7 @@ internal class MarketChartListItemPreviewDataProvider : CollectionPreviewParamet
|
|||
),
|
||||
isUnder100kMarketCap = false,
|
||||
stakingRate = stringReference("APY 12.34%"),
|
||||
updateTimestamp = 0,
|
||||
),
|
||||
MarketsListItemUM(
|
||||
id = CryptoCurrency.RawID("1"),
|
||||
|
|
@ -73,6 +76,7 @@ internal class MarketChartListItemPreviewDataProvider : CollectionPreviewParamet
|
|||
),
|
||||
isUnder100kMarketCap = false,
|
||||
stakingRate = stringReference("APY 12.34%"),
|
||||
updateTimestamp = 0,
|
||||
),
|
||||
MarketsListItemUM(
|
||||
id = CryptoCurrency.RawID("1"),
|
||||
|
|
@ -89,6 +93,7 @@ internal class MarketChartListItemPreviewDataProvider : CollectionPreviewParamet
|
|||
),
|
||||
isUnder100kMarketCap = false,
|
||||
stakingRate = stringReference("APY 12.34%"),
|
||||
updateTimestamp = 0,
|
||||
),
|
||||
MarketsListItemUM(
|
||||
id = CryptoCurrency.RawID("1"),
|
||||
|
|
@ -105,6 +110,7 @@ internal class MarketChartListItemPreviewDataProvider : CollectionPreviewParamet
|
|||
),
|
||||
isUnder100kMarketCap = false,
|
||||
stakingRate = stringReference("APY 12.34%"),
|
||||
updateTimestamp = 0,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
|
@ -21,6 +21,7 @@ data class MarketsListItemUM(
|
|||
val chartData: MarketChartRawData?,
|
||||
val isUnder100kMarketCap: Boolean,
|
||||
val stakingRate: TextReference?,
|
||||
val updateTimestamp: Long?,
|
||||
) {
|
||||
val chartType: MarketChartLook.Type = when (trendType) {
|
||||
PriceChangeType.UP -> MarketChartLook.Type.Growing
|
||||
|
|
@ -33,4 +34,12 @@ data class MarketsListItemUM(
|
|||
val text: String,
|
||||
val changeType: PriceChangeType? = null,
|
||||
)
|
||||
|
||||
fun getComposeKey(): String {
|
||||
return id.value + TOKEN_LAZY_LIST_ID_SEPARATOR + marketCap.toString() + updateTimestamp
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val TOKEN_LAZY_LIST_ID_SEPARATOR = "@"
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue