Updated on 2026-08-14
This commit is contained in:
parent
b51b57cf89
commit
1efdecab4a
13 changed files with 119 additions and 33 deletions
|
|
@ -238,19 +238,31 @@ internal class WalletContentClickIntentsImplementor @Inject constructor(
|
|||
|
||||
override fun onNFTClick(userWallet: UserWallet) {
|
||||
val selectedWallet = stateHolder.getSelectedWallet() as? WalletState.MultiCurrency.Content ?: return
|
||||
val analyticsState = when (val nftState = selectedWallet.nftState) {
|
||||
is WalletNFTItemUM.Content -> NFTAnalyticsEvent.NFTListScreenOpened.State.Full(
|
||||
assetsCount = nftState.assetsCount,
|
||||
collectionsCount = nftState.collectionsCount,
|
||||
)
|
||||
is WalletNFTItemUM.Empty -> NFTAnalyticsEvent.NFTListScreenOpened.State.Empty
|
||||
when (val state = selectedWallet.nftState) {
|
||||
is WalletNFTItemUM.Content -> {
|
||||
analyticsEventHandler.send(
|
||||
NFTAnalyticsEvent.NFTListScreenOpened(
|
||||
state = NFTAnalyticsEvent.NFTListScreenOpened.State.Full,
|
||||
allAssetsCount = state.allAssetsCount,
|
||||
collectionsCount = state.collectionsCount,
|
||||
noCollectionAssetsCount = state.noCollectionAssetsCount,
|
||||
),
|
||||
)
|
||||
}
|
||||
is WalletNFTItemUM.Empty -> {
|
||||
analyticsEventHandler.send(
|
||||
NFTAnalyticsEvent.NFTListScreenOpened(
|
||||
state = NFTAnalyticsEvent.NFTListScreenOpened.State.Empty,
|
||||
allAssetsCount = 0,
|
||||
collectionsCount = 0,
|
||||
noCollectionAssetsCount = 0,
|
||||
),
|
||||
)
|
||||
}
|
||||
is WalletNFTItemUM.Failed,
|
||||
is WalletNFTItemUM.Hidden,
|
||||
is WalletNFTItemUM.Loading,
|
||||
-> null
|
||||
}
|
||||
analyticsState?.let {
|
||||
analyticsEventHandler.send(NFTAnalyticsEvent.NFTListScreenOpened(analyticsState))
|
||||
-> Unit
|
||||
}
|
||||
|
||||
router.openNFT(userWallet)
|
||||
|
|
|
|||
|
|
@ -123,7 +123,8 @@ internal object WalletScreenPreviewData {
|
|||
nftState = WalletNFTItemUM.Content(
|
||||
previews = persistentListOf(WalletNFTItemUM.Content.CollectionPreview.Image("img1")),
|
||||
collectionsCount = 1,
|
||||
assetsCount = 3,
|
||||
allAssetsCount = 3,
|
||||
noCollectionAssetsCount = 0,
|
||||
isFlickering = false,
|
||||
onItemClick = { },
|
||||
),
|
||||
|
|
|
|||
|
|
@ -19,7 +19,8 @@ sealed class WalletNFTItemUM {
|
|||
data class Content(
|
||||
val previews: ImmutableList<CollectionPreview>,
|
||||
val collectionsCount: Int,
|
||||
val assetsCount: Int,
|
||||
val allAssetsCount: Int,
|
||||
val noCollectionAssetsCount: Int,
|
||||
val isFlickering: Boolean,
|
||||
val onItemClick: () -> Unit,
|
||||
) : WalletNFTItemUM() {
|
||||
|
|
|
|||
|
|
@ -52,8 +52,24 @@ internal class SetNFTCollectionsTransformer(
|
|||
.toPersistentList()
|
||||
},
|
||||
collectionsCount = collections.size,
|
||||
assetsCount = collections
|
||||
.sumOf { it.count },
|
||||
allAssetsCount = collections.sumOf { it.count },
|
||||
noCollectionAssetsCount = collections.sumOf { collection ->
|
||||
when (val collectionId = collection.id) {
|
||||
is NFTCollection.Identifier.Solana ->
|
||||
collection
|
||||
.count
|
||||
.takeIf { collectionId.collectionAddress == null }
|
||||
?: 0
|
||||
is NFTCollection.Identifier.TON ->
|
||||
collection
|
||||
.count
|
||||
.takeIf { collectionId.contractAddress == null }
|
||||
?: 0
|
||||
is NFTCollection.Identifier.EVM,
|
||||
is NFTCollection.Identifier.Unknown,
|
||||
-> 0
|
||||
}
|
||||
},
|
||||
isFlickering = false,
|
||||
onItemClick = onItemClick,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ private fun WalletNFTItemContent(state: WalletNFTItemUM.Content, onClick: () ->
|
|||
Text(
|
||||
text = stringResourceSafe(
|
||||
id = R.string.nft_wallet_count,
|
||||
state.assetsCount,
|
||||
state.allAssetsCount,
|
||||
state.collectionsCount,
|
||||
),
|
||||
style = TangemTheme.typography.caption2.applyBladeBrush(
|
||||
|
|
@ -411,8 +411,9 @@ private class WalletNFTItemProvider : CollectionPreviewParameterProvider<WalletN
|
|||
previews = persistentListOf(
|
||||
CollectionPreview.Image("img1"),
|
||||
),
|
||||
assetsCount = 125,
|
||||
allAssetsCount = 125,
|
||||
collectionsCount = 11,
|
||||
noCollectionAssetsCount = 0,
|
||||
isFlickering = true,
|
||||
onItemClick = { },
|
||||
),
|
||||
|
|
@ -421,8 +422,9 @@ private class WalletNFTItemProvider : CollectionPreviewParameterProvider<WalletN
|
|||
CollectionPreview.Image("img1"),
|
||||
CollectionPreview.Image("img2"),
|
||||
),
|
||||
assetsCount = 125,
|
||||
allAssetsCount = 125,
|
||||
collectionsCount = 11,
|
||||
noCollectionAssetsCount = 0,
|
||||
isFlickering = false,
|
||||
onItemClick = { },
|
||||
),
|
||||
|
|
@ -432,8 +434,9 @@ private class WalletNFTItemProvider : CollectionPreviewParameterProvider<WalletN
|
|||
CollectionPreview.Image("img2"),
|
||||
CollectionPreview.Image("img3"),
|
||||
),
|
||||
assetsCount = 125,
|
||||
allAssetsCount = 125,
|
||||
collectionsCount = 11,
|
||||
noCollectionAssetsCount = 0,
|
||||
isFlickering = false,
|
||||
onItemClick = { },
|
||||
),
|
||||
|
|
@ -444,8 +447,9 @@ private class WalletNFTItemProvider : CollectionPreviewParameterProvider<WalletN
|
|||
CollectionPreview.Image("img3"),
|
||||
CollectionPreview.Image("img4"),
|
||||
),
|
||||
assetsCount = 125,
|
||||
allAssetsCount = 125,
|
||||
collectionsCount = 11,
|
||||
noCollectionAssetsCount = 0,
|
||||
isFlickering = false,
|
||||
onItemClick = { },
|
||||
),
|
||||
|
|
@ -456,9 +460,10 @@ private class WalletNFTItemProvider : CollectionPreviewParameterProvider<WalletN
|
|||
CollectionPreview.Image("img3"),
|
||||
CollectionPreview.More,
|
||||
),
|
||||
assetsCount = 125,
|
||||
allAssetsCount = 125,
|
||||
collectionsCount = 11,
|
||||
isFlickering = true,
|
||||
noCollectionAssetsCount = 0,
|
||||
onItemClick = { },
|
||||
),
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue