Updated on 2026-08-14

This commit is contained in:
Tangem 2025-12-29 17:48:35 +04:00
parent 33f2e5f297
commit d128f48b05
7 changed files with 84 additions and 1 deletions

View file

@ -51,6 +51,8 @@ class TokenItemStateConverter(
},
private val onApyLabelClick: ((CryptoCurrencyStatus, ApySource, String) -> Unit)? = null,
private val onYieldPromoCloseClick: (() -> Unit)? = null,
private val onYieldPromoShown: ((cryptoCurrency: CryptoCurrency) -> Unit)? = null,
private val onYieldPromoClicked: ((cryptoCurrency: CryptoCurrency) -> Unit)? = null,
private val titleStateProvider: (CryptoCurrencyStatus) -> TokenItemState.TitleState = { currencyStatus ->
createTitleState(
currencyStatus = currencyStatus,
@ -75,6 +77,8 @@ class TokenItemStateConverter(
yieldSupplyPromoBannerKey = yieldSupplyPromoBannerKey,
onApyLabelClick = onApyLabelClick,
onYieldPromoCloseClick = onYieldPromoCloseClick,
onYieldPromoShown = onYieldPromoShown,
onYieldPromoClicked = onYieldPromoClicked,
)
},
private val onItemClick: ((TokenItemState, CryptoCurrencyStatus) -> Unit)? = null,
@ -389,12 +393,15 @@ class TokenItemStateConverter(
}
}
@Suppress("LongParameterList")
private fun createPromoBannerState(
status: CryptoCurrencyStatus,
yieldModuleApyMap: Map<String, BigDecimal>,
yieldSupplyPromoBannerKey: String?,
onApyLabelClick: ((CryptoCurrencyStatus, ApySource, String) -> Unit)?,
onYieldPromoCloseClick: (() -> Unit)?,
onYieldPromoShown: ((cryptoCurrency: CryptoCurrency) -> Unit)?,
onYieldPromoClicked: ((cryptoCurrency: CryptoCurrency) -> Unit)?,
): TokenItemState.PromoBannerState {
val token = status.currency as? CryptoCurrency.Token ?: return TokenItemState.PromoBannerState.Empty
if (status.value !is CryptoCurrencyStatus.Loaded) {
@ -414,11 +421,15 @@ class TokenItemStateConverter(
wrappedList(yieldSupplyApy),
),
onPromoBannerClick = {
onYieldPromoClicked?.invoke(status.currency)
onApyLabelClick?.invoke(status, ApySource.YIELD_SUPPLY, yieldSupplyApy.toString())
},
onCloseClick = {
onYieldPromoCloseClick?.invoke()
},
onPromoShown = {
onYieldPromoShown?.invoke(status.currency)
},
)
}