diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/currency/tokenicon/TokenIcon.kt b/core/ui/src/main/java/com/tangem/core/ui/components/currency/tokenicon/TokenIcon.kt index 9ad7d42cc8..07d299f583 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/currency/tokenicon/TokenIcon.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/currency/tokenicon/TokenIcon.kt @@ -27,15 +27,9 @@ private const val NORMAL_ALPHA = 1f * @param state cryptocurrency icon config * @param modifier component modifier * @param shouldDisplayNetwork specifies whether to display network badge - * @param shouldDisplayCustom specifies whether to display custom badge */ @Composable -fun TokenIcon( - state: TokenIconState, - modifier: Modifier = Modifier, - shouldDisplayNetwork: Boolean = true, - shouldDisplayCustom: Boolean = true, -) { +fun TokenIcon(state: TokenIconState, modifier: Modifier = Modifier, shouldDisplayNetwork: Boolean = true) { BaseContainer(modifier = modifier) { val iconModifier = Modifier .align(Alignment.Center) @@ -52,7 +46,6 @@ fun TokenIcon( icon = state, modifier = iconModifier, shouldDisplayNetwork = shouldDisplayNetwork, - shouldDisplayCustom = shouldDisplayCustom, ) } } @@ -83,7 +76,6 @@ private fun BoxScope.ContentIconContainer( icon: TokenIconState, modifier: Modifier = Modifier, shouldDisplayNetwork: Boolean = true, - shouldDisplayCustom: Boolean = true, ) { val networkBadgeOffset = TangemTheme.dimens.spacing4 val (alpha, colorFilter) = remember(icon.isGrayscale) { @@ -112,7 +104,7 @@ private fun BoxScope.ContentIconContainer( ) } - if (icon.showCustomBadge && shouldDisplayCustom) { + if (icon.showCustomBadge) { CustomBadge(modifier = Modifier.align(Alignment.BottomEnd)) } } diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/currency/tokenicon/TokenIconState.kt b/core/ui/src/main/java/com/tangem/core/ui/components/currency/tokenicon/TokenIconState.kt index f51adb19b3..0f7ff350de 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/currency/tokenicon/TokenIconState.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/currency/tokenicon/TokenIconState.kt @@ -60,24 +60,23 @@ sealed class TokenIconState { * @property background The background color to be used for the icon. * @property networkBadgeIconResId The drawable resource ID for the network badge. * @property isGrayscale Specifies whether to show the icon in grayscale. + * @property showCustomBadge Specifies whether to show the custom token badge. */ data class CustomTokenIcon( val tint: Color, val background: Color, @DrawableRes override val networkBadgeIconResId: Int, override val isGrayscale: Boolean, - ) : TokenIconState() { + override val showCustomBadge: Boolean = true, + ) : TokenIconState() - override val showCustomBadge: Boolean = true - } - - object Loading : TokenIconState() { + data object Loading : TokenIconState() { override val isGrayscale: Boolean = false override val showCustomBadge: Boolean = false override val networkBadgeIconResId: Int? = null } - object Locked : TokenIconState() { + data object Locked : TokenIconState() { override val isGrayscale: Boolean = false override val showCustomBadge: Boolean = false override val networkBadgeIconResId: Int? = null diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/currency/tokenicon/converter/CryptoCurrencyToIconStateConverter.kt b/core/ui/src/main/java/com/tangem/core/ui/components/currency/tokenicon/converter/CryptoCurrencyToIconStateConverter.kt index fbcc6e3caa..3e62e98992 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/currency/tokenicon/converter/CryptoCurrencyToIconStateConverter.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/currency/tokenicon/converter/CryptoCurrencyToIconStateConverter.kt @@ -30,6 +30,7 @@ class CryptoCurrencyToIconStateConverter : Converter getIconStateForToken( token = currency, @@ -50,13 +51,14 @@ class CryptoCurrencyToIconStateConverter : Converter