Updated on 2026-08-14
This commit is contained in:
parent
3920719b01
commit
fcd16ea486
7 changed files with 51 additions and 5 deletions
|
|
@ -30,6 +30,8 @@ data class TokenMarketInfoResponse(
|
|||
val links: Links?,
|
||||
@Json(name = "price_performance")
|
||||
val pricePerformance: PricePerformance?,
|
||||
@Json(name = "exchanges_amount")
|
||||
val exchangesAmount: Int?,
|
||||
) {
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ internal object TokenMarketInfoConverter : Converter<TokenMarketInfoResponse, To
|
|||
metrics = metrics?.convert(),
|
||||
links = links?.convert(),
|
||||
pricePerformance = pricePerformance?.convert(),
|
||||
exchangesAmount = exchangesAmount,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ data class TokenMarketInfo(
|
|||
val metrics: Metrics?,
|
||||
val links: Links?,
|
||||
val pricePerformance: PricePerformance?,
|
||||
val exchangesAmount: Int?,
|
||||
) {
|
||||
data class Network(
|
||||
val networkId: String,
|
||||
|
|
|
|||
|
|
@ -25,9 +25,6 @@ import com.tangem.features.markets.details.impl.analytics.MarketDetailsAnalytics
|
|||
import com.tangem.features.markets.details.impl.model.converters.DescriptionConverter
|
||||
import com.tangem.features.markets.details.impl.model.converters.TokenMarketInfoConverter
|
||||
import com.tangem.features.markets.details.impl.model.formatter.*
|
||||
import com.tangem.features.markets.details.impl.model.formatter.formatAsPrice
|
||||
import com.tangem.features.markets.details.impl.model.formatter.getChangePercentBetween
|
||||
import com.tangem.features.markets.details.impl.model.formatter.getPercentByInterval
|
||||
import com.tangem.features.markets.details.impl.model.state.QuotesStateUpdater
|
||||
import com.tangem.features.markets.details.impl.model.state.TokenNetworksState
|
||||
import com.tangem.features.markets.details.impl.ui.state.InfoBottomSheetContent
|
||||
|
|
@ -76,8 +73,9 @@ internal class MarketsTokenDetailsModel @Inject constructor(
|
|||
|
||||
private val infoConverter = TokenMarketInfoConverter(
|
||||
appCurrency = Provider { currentAppCurrency.value },
|
||||
onInfoClick = {
|
||||
showInfoBottomSheet(it)
|
||||
onInfoClick = { showInfoBottomSheet(it) },
|
||||
onListedOnClick = {
|
||||
// TODO: [REDACTED_JIRA]
|
||||
},
|
||||
onLinkClick = { link ->
|
||||
urlOpener.openUrl(link.url)
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import com.tangem.domain.markets.PriceChangeInterval
|
|||
import com.tangem.domain.markets.TokenMarketInfo
|
||||
import com.tangem.features.markets.details.impl.ui.state.InfoBottomSheetContent
|
||||
import com.tangem.features.markets.details.impl.ui.state.LinksUM
|
||||
import com.tangem.features.markets.details.impl.ui.state.ListedOnUM
|
||||
import com.tangem.features.markets.details.impl.ui.state.MarketsTokenDetailsUM
|
||||
import com.tangem.utils.Provider
|
||||
import com.tangem.utils.converter.Converter
|
||||
|
|
@ -14,6 +15,7 @@ import com.tangem.utils.converter.Converter
|
|||
internal class TokenMarketInfoConverter(
|
||||
private val appCurrency: Provider<AppCurrency>,
|
||||
private val onInfoClick: (InfoBottomSheetContent) -> Unit,
|
||||
private val onListedOnClick: () -> Unit,
|
||||
onLinkClick: (LinksUM.Link) -> Unit,
|
||||
onPricePerformanceIntervalChanged: (PriceChangeInterval) -> Unit,
|
||||
onInsightsIntervalChanged: (PriceChangeInterval) -> Unit,
|
||||
|
|
@ -41,6 +43,7 @@ internal class TokenMarketInfoConverter(
|
|||
onInfoClick = onInfoClick,
|
||||
)
|
||||
|
||||
val exchangesAmount = value.exchangesAmount
|
||||
return MarketsTokenDetailsUM.InformationBlocks(
|
||||
insights = value.insights?.let { insightsConverter.convert(it) },
|
||||
securityScore = null,
|
||||
|
|
@ -51,6 +54,11 @@ internal class TokenMarketInfoConverter(
|
|||
currentPrice = value.quotes.currentPrice,
|
||||
)
|
||||
},
|
||||
listedOn = if (exchangesAmount != null && exchangesAmount > 0) {
|
||||
ListedOnUM.Content(onClick = onListedOnClick, amount = exchangesAmount)
|
||||
} else {
|
||||
ListedOnUM.Empty
|
||||
},
|
||||
links = value.links?.let { linksConverter.convert(it) },
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
package com.tangem.features.markets.details.impl.ui.state
|
||||
|
||||
import com.tangem.core.ui.extensions.TextReference
|
||||
import com.tangem.core.ui.extensions.stringReference
|
||||
|
||||
/**
|
||||
* "Listed on" block UI model
|
||||
*
|
||||
[REDACTED_AUTHOR]
|
||||
*/
|
||||
internal sealed interface ListedOnUM {
|
||||
|
||||
/** Description */
|
||||
val description: TextReference
|
||||
|
||||
/** Empty state. No exchanges found */
|
||||
data object Empty : ListedOnUM {
|
||||
// TODO [REDACTED_JIRA]
|
||||
override val description: TextReference = stringReference(value = "No exchanges found")
|
||||
}
|
||||
|
||||
/**
|
||||
* Content with number of exchanges
|
||||
*
|
||||
* @property onClick lambda be invoked when button is clicked
|
||||
* @property amount amount of exchanges
|
||||
*/
|
||||
data class Content(
|
||||
val onClick: () -> Unit,
|
||||
private val amount: Int,
|
||||
) : ListedOnUM {
|
||||
// TODO [REDACTED_JIRA]
|
||||
override val description: TextReference = stringReference(value = "$amount exchanges")
|
||||
}
|
||||
}
|
||||
|
|
@ -41,6 +41,7 @@ internal data class MarketsTokenDetailsUM(
|
|||
val securityScore: SecurityScoreUM?,
|
||||
val metrics: MetricsUM?,
|
||||
val pricePerformance: PricePerformanceUM?,
|
||||
val listedOn: ListedOnUM,
|
||||
val links: LinksUM?,
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue