Updated on 2026-08-14

This commit is contained in:
Tangem 2024-08-16 17:56:34 +04:00
parent 826eaece13
commit a837544817
4 changed files with 42 additions and 21 deletions

View file

@ -38,7 +38,7 @@ sealed class CurrencyIconState {
* Represents a token icon.
*
* @property url The URL where the token icon can be fetched from. May be `null` if not found.
* @property topBadgeIconResId The drawable resource ID for the network badge.
* @property topBadgeIconResId The drawable resource ID for the network badge. May be `null`.
* @property isGrayscale Specifies whether to show the icon in grayscale.
* @property showCustomBadge Specifies whether to show the custom token badge.
* @property fallbackTint The color to be used for tinting the fallback icon.
@ -46,7 +46,7 @@ sealed class CurrencyIconState {
*/
data class TokenIcon(
val url: String?,
@DrawableRes override val topBadgeIconResId: Int,
@DrawableRes override val topBadgeIconResId: Int?,
override val isGrayscale: Boolean,
override val showCustomBadge: Boolean,
val fallbackTint: Color,
@ -81,4 +81,28 @@ sealed class CurrencyIconState {
override val showCustomBadge: Boolean = false
override val topBadgeIconResId: Int? = null
}
fun copySealed(
isGrayscale: Boolean = this.isGrayscale,
showCustomBadge: Boolean = this.showCustomBadge,
topBadgeIconResId: Int? = this.topBadgeIconResId,
): CurrencyIconState = when (this) {
is CoinIcon -> copy(
isGrayscale = isGrayscale,
showCustomBadge = showCustomBadge,
)
is CustomTokenIcon -> copy(
isGrayscale = isGrayscale,
showCustomBadge = showCustomBadge,
topBadgeIconResId = topBadgeIconResId ?: this.topBadgeIconResId,
)
is TokenIcon -> copy(
isGrayscale = isGrayscale,
showCustomBadge = showCustomBadge,
topBadgeIconResId = topBadgeIconResId,
)
is Loading,
is Locked,
-> this
}
}

View file

@ -0,0 +1,14 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="28"
android:viewportHeight="28">
<path
android:fillColor="#1E1E1E"
android:pathData="M8.82,17.87C9.04,16.02 9.74,14.31 10.8,12.89C10.41,13.08 9.93,13.2 9.38,13.24V14H8.55V13.25C6.83,13.13 5.74,12.22 5.74,10.86H7.02C7.08,11.56 7.66,12.04 8.55,12.14V9.48L8.02,9.35C6.67,9.02 5.94,8.23 5.94,7.09C5.94,5.75 6.93,4.85 8.55,4.71V3.9H9.38V4.71C10.94,4.84 11.97,5.77 12,7.06H10.74C10.72,6.42 10.18,5.92 9.38,5.83V8.34L9.94,8.47C11.45,8.82 12.16,9.56 12.16,10.77C12.16,11.03 12.13,11.27 12.07,11.49C13.63,10.05 15.64,9.08 17.87,8.82C17.81,3.94 13.83,0 8.94,0C4,0 0,4 0,8.94C0,13.83 3.94,17.81 8.82,17.87ZM17.78,10.22C13.87,10.79 10.79,13.87 10.22,17.78L17.78,10.22ZM8.55,8.17C7.69,8.01 7.23,7.59 7.23,6.99C7.23,6.35 7.78,5.86 8.55,5.82V8.17ZM9.38,12.15V9.63C10.4,9.83 10.88,10.24 10.88,10.91C10.88,11.65 10.33,12.1 9.38,12.15Z" />
<path
android:fillColor="#1E1E1E"
android:pathData="M10.13,19.07C10.13,14.13 14.13,10.13 19.06,10.13C24,10.13 28,14.13 28,19.07C28,24 24,28 19.06,28C14.13,28 10.13,24 10.13,19.07ZM19.53,17.53L20.48,14.82L19.07,14.32L17.78,17.96L15.34,18.57L15.7,20.03L17.18,19.66L16.23,22.36C16.15,22.59 16.18,22.84 16.33,23.04C16.47,23.24 16.69,23.36 16.94,23.36H22.61V21.86H18L18.93,19.22L21.37,18.61L21.01,17.16L19.53,17.53Z" />
</vector>

View file

@ -1,17 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="28dp"
android:height="28dp"
android:viewportWidth="28"
android:viewportHeight="28">
<group>
<clip-path android:pathData="M0,0h28v28h-28z" />
<path
android:pathData="M8.821,17.869C9.035,16.016 9.741,14.312 10.803,12.892C10.407,13.076 9.929,13.195 9.38,13.241V14H8.552V13.247C6.83,13.134 5.744,12.22 5.738,10.863H7.015C7.077,11.556 7.657,12.04 8.552,12.142V9.483L8.015,9.346C6.67,9.017 5.935,8.234 5.935,7.093C5.935,5.749 6.929,4.852 8.552,4.709V3.902H9.38V4.709C10.941,4.84 11.966,5.766 12.003,7.063H10.744C10.719,6.424 10.176,5.922 9.38,5.826V8.342L9.941,8.467C11.454,8.82 12.163,9.561 12.163,10.768C12.163,11.028 12.13,11.27 12.065,11.493C13.628,10.047 15.64,9.079 17.869,8.822C17.808,3.939 13.831,0 8.935,0C4,0 0,4 0,8.935C0,13.831 3.939,17.808 8.821,17.869ZM17.776,10.222C13.873,10.786 10.786,13.873 10.222,17.776L17.776,10.222ZM8.552,8.174C7.688,8.007 7.225,7.589 7.225,6.991C7.225,6.352 7.781,5.862 8.552,5.82V8.174ZM9.38,12.154V9.632C10.404,9.83 10.88,10.236 10.88,10.905C10.88,11.646 10.33,12.1 9.38,12.154Z"
android:fillColor="#000000"
android:fillType="evenOdd" />
<path
android:pathData="M10.13,19.066C10.13,14.132 14.13,10.131 19.064,10.131C23.998,10.131 27.999,14.132 27.999,19.066C27.999,24 23.998,28.001 19.064,28.001C14.13,28.001 10.13,24 10.13,19.066ZM19.527,17.526L20.48,14.823L19.066,14.323L17.782,17.962L15.337,18.573L15.701,20.028L17.183,19.658L16.23,22.36C16.149,22.589 16.184,22.844 16.325,23.043C16.465,23.241 16.694,23.36 16.937,23.36H22.61V21.86H17.997L18.928,19.222L21.374,18.61L21.01,17.155L19.527,17.526Z"
android:fillColor="#000000"
android:fillType="evenOdd" />
</group>
</vector>

View file

@ -195,7 +195,7 @@ private fun ReferralInfo(
}
is ReferralInfoState.Loading -> {
LoadingCondition(iconResId = R.drawable.ic_tether_28)
LoadingCondition(iconResId = R.drawable.ic_tether_24)
SpacerH32()
LoadingCondition(iconResId = R.drawable.ic_discount_28)
}
@ -211,7 +211,7 @@ private fun Conditions(state: ReferralInfoContentState) {
@Composable
private fun ConditionForYou(state: ReferralInfoContentState) {
Condition(iconResId = R.drawable.ic_tether_28) {
Condition(iconResId = R.drawable.ic_tether_24) {
when (state) {
is ReferralInfoState.ParticipantContent -> InfoForYou(
award = state.award,