From 5193b7ada4a8d4dca20842ca5ba973343ee6b821 Mon Sep 17 00:00:00 2001 From: Tangem Date: Fri, 18 Apr 2025 18:19:05 +0500 Subject: [PATCH] Updated on 2026-08-14 --- core/res/src/main/res/values/strings.xml | 1 + .../features/nft/collections/entity/NFTCollectionUM.kt | 2 +- .../entity/transformer/UpdateDataStateTransformer.kt | 2 +- .../com/tangem/features/nft/collections/ui/NFTCollection.kt | 3 ++- .../nft/details/entity/factory/NFTDetailsUMFactory.kt | 6 ++++-- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/core/res/src/main/res/values/strings.xml b/core/res/src/main/res/values/strings.xml index 0e158723f2..42b9c6762c 100644 --- a/core/res/src/main/res/values/strings.xml +++ b/core/res/src/main/res/values/strings.xml @@ -534,6 +534,7 @@ Tap here to receive first NFT NFT collections Unable to load the data + No collection Set up a single access code to protect all your devices. Protect Set an individual access code for each card or ring later. diff --git a/features/nft/impl/src/main/kotlin/com/tangem/features/nft/collections/entity/NFTCollectionUM.kt b/features/nft/impl/src/main/kotlin/com/tangem/features/nft/collections/entity/NFTCollectionUM.kt index e7e24ded3b..771f9515fc 100644 --- a/features/nft/impl/src/main/kotlin/com/tangem/features/nft/collections/entity/NFTCollectionUM.kt +++ b/features/nft/impl/src/main/kotlin/com/tangem/features/nft/collections/entity/NFTCollectionUM.kt @@ -5,7 +5,7 @@ import com.tangem.core.ui.extensions.TextReference internal data class NFTCollectionUM( val id: String, - val name: String, + val name: String?, @DrawableRes val networkIconId: Int, val logoUrl: String?, val description: TextReference, diff --git a/features/nft/impl/src/main/kotlin/com/tangem/features/nft/collections/entity/transformer/UpdateDataStateTransformer.kt b/features/nft/impl/src/main/kotlin/com/tangem/features/nft/collections/entity/transformer/UpdateDataStateTransformer.kt index 234ba96ceb..a0cfab6956 100644 --- a/features/nft/impl/src/main/kotlin/com/tangem/features/nft/collections/entity/transformer/UpdateDataStateTransformer.kt +++ b/features/nft/impl/src/main/kotlin/com/tangem/features/nft/collections/entity/transformer/UpdateDataStateTransformer.kt @@ -83,7 +83,7 @@ internal class UpdateDataStateTransformer( NFTCollectionUM( id = it.id.toString(), networkIconId = getActiveIconRes(it.network.id.value), - name = it.name.orEmpty(), + name = it.name, description = TextReference.PluralRes( R.plurals.nft_collections_count, it.count, diff --git a/features/nft/impl/src/main/kotlin/com/tangem/features/nft/collections/ui/NFTCollection.kt b/features/nft/impl/src/main/kotlin/com/tangem/features/nft/collections/ui/NFTCollection.kt index e89b5bbe41..3851542d90 100644 --- a/features/nft/impl/src/main/kotlin/com/tangem/features/nft/collections/ui/NFTCollection.kt +++ b/features/nft/impl/src/main/kotlin/com/tangem/features/nft/collections/ui/NFTCollection.kt @@ -18,6 +18,7 @@ import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.tooling.preview.datasource.CollectionPreviewParameterProvider import com.tangem.core.ui.extensions.TextReference import com.tangem.core.ui.extensions.resolveReference +import com.tangem.core.ui.extensions.stringResourceSafe import com.tangem.core.ui.res.TangemTheme import com.tangem.core.ui.res.TangemThemePreview import com.tangem.features.nft.collections.entity.NFTCollectionAssetsListUM @@ -89,7 +90,7 @@ private fun RowScope.Text(state: NFTCollectionUM) { ) { Text( modifier = Modifier, - text = state.name, + text = state.name.takeUnless { it.isNullOrEmpty() } ?: stringResourceSafe(R.string.nft_no_collection), style = TangemTheme.typography.subtitle2, color = TangemTheme.colors.text.primary1, maxLines = 1, diff --git a/features/nft/impl/src/main/kotlin/com/tangem/features/nft/details/entity/factory/NFTDetailsUMFactory.kt b/features/nft/impl/src/main/kotlin/com/tangem/features/nft/details/entity/factory/NFTDetailsUMFactory.kt index faf5d73b1d..f23446ab57 100644 --- a/features/nft/impl/src/main/kotlin/com/tangem/features/nft/details/entity/factory/NFTDetailsUMFactory.kt +++ b/features/nft/impl/src/main/kotlin/com/tangem/features/nft/details/entity/factory/NFTDetailsUMFactory.kt @@ -37,11 +37,11 @@ internal class NFTDetailsUMFactory( ) } ?: NFTAssetUM.Media.Empty, topInfo = when { - salePrice is NFTSalePrice.Empty && description.isNullOrEmpty() && rarity == null -> { + !hasSalePrice() && description.isNullOrEmpty() && rarity == null -> { NFTAssetUM.TopInfo.Empty } else -> { - val hasSalePrice = salePrice !is NFTSalePrice.Empty + val hasSalePrice = hasSalePrice() val hasDescription = !description.isNullOrEmpty() val rarity = rarity NFTAssetUM.TopInfo.Content( @@ -73,6 +73,8 @@ internal class NFTDetailsUMFactory( baseInfoItems = buildBaseInfoItems(), ) + private fun NFTAsset.hasSalePrice() = salePrice !is NFTSalePrice.Empty && salePrice !is NFTSalePrice.Error + private fun NFTAsset.buildBaseInfoItems() = when (val id = id) { is NFTAsset.Identifier.EVM -> persistentListOf( NFTAssetUM.BlockItem(