Updated on 2026-08-14

This commit is contained in:
Tangem 2026-04-20 19:03:25 +04:00
parent 91942930d6
commit 6b75b48f1e
61 changed files with 193 additions and 436 deletions

View file

@ -3,9 +3,13 @@ package com.tangem.features.nft.collections.entity.transformer
import com.tangem.common.ui.account.AccountTitleUM
import com.tangem.common.ui.account.CryptoPortfolioIconConverter
import com.tangem.common.ui.account.toUM
import com.tangem.common.ui.extensions.iconResId
import com.tangem.core.ui.components.fields.entity.SearchBarUM
import com.tangem.core.ui.components.notifications.NotificationConfig
import com.tangem.core.ui.extensions.*
import com.tangem.core.ui.extensions.TextReference
import com.tangem.core.ui.extensions.resourceReference
import com.tangem.core.ui.extensions.stringReference
import com.tangem.core.ui.extensions.wrappedList
import com.tangem.core.ui.format.bigdecimal.crypto
import com.tangem.core.ui.format.bigdecimal.format
import com.tangem.domain.models.account.Account
@ -118,24 +122,24 @@ internal class UpdateDataStateTransformer(
.map { it.collections.orEmpty().transform(this) }
.flatten()
private fun List<NFTCollection>.transform(state: NFTCollectionsStateUM): ImmutableList<NFTCollectionUM> = map {
NFTCollectionUM(
id = it.collectionIdProvider(),
networkIconId = getActiveIconRes(it.network.rawId),
name = it.name.orEmpty(),
description = TextReference.PluralRes(
R.plurals.nft_collections_count,
it.count,
wrappedList(it.count),
),
logoUrl = it.logoUrl,
assets = it.transformAssets(),
onExpandClick = {
onExpandCollectionClick(it)
},
isExpanded = it.isExpanded(state),
)
}.toPersistentList()
private fun List<NFTCollection>.transform(state: NFTCollectionsStateUM): ImmutableList<NFTCollectionUM> {
return map { collection ->
NFTCollectionUM(
id = collection.collectionIdProvider(),
networkIconId = collection.network.iconResId,
name = collection.name.orEmpty(),
description = TextReference.PluralRes(
R.plurals.nft_collections_count,
collection.count,
wrappedList(collection.count),
),
logoUrl = collection.logoUrl,
assets = collection.transformAssets(),
onExpandClick = { onExpandCollectionClick(collection) },
isExpanded = collection.isExpanded(state),
)
}.toPersistentList()
}
private fun transformNotifications(): ImmutableList<NFTCollectionsWarningUM> = buildList {
val nftCollections = walletNFTCollections?.flattenCollections

View file

@ -6,7 +6,7 @@ import com.tangem.common.ui.account.AccountTitleUM
import com.tangem.common.ui.account.CryptoPortfolioIconConverter
import com.tangem.common.ui.account.toUM
import com.tangem.core.decompose.context.AppComponentContext
import com.tangem.core.ui.extensions.getActiveIconRes
import com.tangem.common.ui.extensions.iconResId
import com.tangem.core.ui.extensions.resourceReference
import com.tangem.core.ui.extensions.stringReference
import com.tangem.features.nft.component.NFTDetailsBlockComponent
@ -39,7 +39,7 @@ class DefaultNFTDetailsBlockComponent @AssistedInject constructor(
AccountTitleUM.Text(params.walletTitle)
},
isSuccessScreen = params.isSuccessScreen,
networkIconRes = getActiveIconRes(params.nftAsset.network.rawId),
networkIconRes = params.nftAsset.network.iconResId,
)
}

View file

@ -2,7 +2,7 @@ package com.tangem.features.nft.receive.entity.transformer
import com.tangem.core.ui.components.currency.icon.CurrencyIconState
import com.tangem.core.ui.components.rows.model.ChainRowUM
import com.tangem.core.ui.extensions.getActiveIconRes
import com.tangem.common.ui.extensions.iconResId
import com.tangem.domain.models.network.Network
import com.tangem.domain.nft.models.NFTNetworks
import com.tangem.features.nft.receive.entity.NFTNetworkUM
@ -41,7 +41,7 @@ internal class UpdateDataStateTransformer(
type = "",
icon = CurrencyIconState.CoinIcon(
url = null,
fallbackResId = getActiveIconRes(rawId),
fallbackResId = iconResId,
isGrayscale = !enabled,
shouldShowCustomBadge = custom,
),