Updated on 2026-08-14

This commit is contained in:
Tangem 2025-11-11 13:42:29 +04:00
parent 1959636f2e
commit 4b62c933bf
17 changed files with 48 additions and 49 deletions

View file

@ -10,7 +10,6 @@ import com.tangem.domain.appcurrency.model.AppCurrency
import com.tangem.domain.models.StatusSource
import com.tangem.domain.models.TotalFiatBalance
import com.tangem.domain.models.account.Account
import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.utils.converter.Converter
class AccountPortfolioItemUMConverter(
@ -25,7 +24,7 @@ class AccountPortfolioItemUMConverter(
override fun convert(value: Account): UserWalletItemUM {
return with(value) {
UserWalletItemUM(
id = UserWalletId(accountId.value),
id = accountId.value,
name = accountName.toUM().value,
information = getInfo(account = this),
balance = getBalanceInfo(),

View file

@ -37,10 +37,12 @@ import com.tangem.core.ui.components.account.AccountIconSize
import com.tangem.core.ui.components.block.BlockCard
import com.tangem.core.ui.components.block.TangemBlockCardColors
import com.tangem.core.ui.components.text.applyBladeBrush
import com.tangem.core.ui.extensions.*
import com.tangem.core.ui.extensions.TextReference
import com.tangem.core.ui.extensions.resolveReference
import com.tangem.core.ui.extensions.stringReference
import com.tangem.core.ui.extensions.wrappedList
import com.tangem.core.ui.res.TangemTheme
import com.tangem.core.ui.res.TangemThemePreview
import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.utils.StringsSigns.DASH_SIGN
import com.tangem.utils.StringsSigns.DOT
import com.tangem.utils.StringsSigns.THREE_STARS
@ -322,7 +324,7 @@ private class UserWalletItemUMPreviewProvider : PreviewParameterProvider<UserWal
override val values: Sequence<UserWalletItemUM>
get() = sequenceOf(
UserWalletItemUM(
id = UserWalletId("user_wallet_0".encodeToByteArray()),
id = "user_wallet_0",
name = stringReference("Mobile Wallet"),
information = getInformation(cardCount = 1),
balance = UserWalletItemUM.Balance.Locked,
@ -331,7 +333,7 @@ private class UserWalletItemUMPreviewProvider : PreviewParameterProvider<UserWal
onClick = {},
),
UserWalletItemUM(
id = UserWalletId("user_wallet_1".encodeToByteArray()),
id = "user_wallet_1",
name = stringReference("My Wallet"),
information = getInformation(cardCount = 1),
balance = UserWalletItemUM.Balance.Locked,
@ -339,7 +341,7 @@ private class UserWalletItemUMPreviewProvider : PreviewParameterProvider<UserWal
onClick = {},
),
UserWalletItemUM(
id = UserWalletId("user_wallet_2".encodeToByteArray()),
id = "user_wallet_2",
name = stringReference("Old wallet"),
information = getInformation(cardCount = 2),
balance = UserWalletItemUM.Balance.Hidden,
@ -348,7 +350,7 @@ private class UserWalletItemUMPreviewProvider : PreviewParameterProvider<UserWal
endIcon = UserWalletItemUM.EndIcon.Arrow,
),
UserWalletItemUM(
id = UserWalletId("user_wallet_3".encodeToByteArray()),
id = "user_wallet_3",
name = stringReference("Multi Card"),
information = getInformation(cardCount = 3),
balance = UserWalletItemUM.Balance.Failed,
@ -357,7 +359,7 @@ private class UserWalletItemUMPreviewProvider : PreviewParameterProvider<UserWal
onClick = {},
),
UserWalletItemUM(
id = UserWalletId("user_wallet_3".encodeToByteArray()),
id = "user_wallet_3",
name = stringReference("Multi Card"),
information = getInformation(cardCount = 3),
balance = UserWalletItemUM.Balance.Loading,
@ -366,7 +368,7 @@ private class UserWalletItemUMPreviewProvider : PreviewParameterProvider<UserWal
onClick = {},
),
UserWalletItemUM(
id = UserWalletId("user_wallet_3".encodeToByteArray()),
id = "user_wallet_3",
name = stringReference("Multi Card"),
information = UserWalletItemUM.Information.Loading,
balance = UserWalletItemUM.Balance.Loading,
@ -375,7 +377,7 @@ private class UserWalletItemUMPreviewProvider : PreviewParameterProvider<UserWal
onClick = {},
),
UserWalletItemUM(
id = UserWalletId("user_wallet_3".encodeToByteArray()),
id = "user_wallet_3",
name = stringReference("Multi Card"),
information = getInformation(cardCount = 3),
balance = UserWalletItemUM.Balance.Loaded(
@ -387,7 +389,7 @@ private class UserWalletItemUMPreviewProvider : PreviewParameterProvider<UserWal
onClick = {},
),
UserWalletItemUM(
id = UserWalletId("user_wallet_3".encodeToByteArray()),
id = "user_wallet_3",
name = stringReference("Multi Card"),
information = getInformation(cardCount = 3),
balance = UserWalletItemUM.Balance.Loaded(
@ -399,7 +401,7 @@ private class UserWalletItemUMPreviewProvider : PreviewParameterProvider<UserWal
onClick = {},
),
UserWalletItemUM(
id = UserWalletId("user_wallet_3".encodeToByteArray()),
id = "user_wallet_3",
name = stringReference("Multi Card"),
information = UserWalletItemUM.Information.Loading,
balance = UserWalletItemUM.Balance.Loaded(
@ -410,7 +412,7 @@ private class UserWalletItemUMPreviewProvider : PreviewParameterProvider<UserWal
onClick = {},
),
UserWalletItemUM(
id = UserWalletId("user_wallet_3".encodeToByteArray()),
id = "user_wallet_3",
name = stringReference("Multi Card"),
information = UserWalletItemUM.Information.Failed,
balance = UserWalletItemUM.Balance.Loaded(
@ -421,7 +423,7 @@ private class UserWalletItemUMPreviewProvider : PreviewParameterProvider<UserWal
onClick = {},
),
UserWalletItemUM(
id = UserWalletId("user_wallet_3".encodeToByteArray()),
id = "user_wallet_3",
name = stringReference("Multi Card"),
information = UserWalletItemUM.Information.Failed,
balance = UserWalletItemUM.Balance.Loaded(
@ -433,7 +435,7 @@ private class UserWalletItemUMPreviewProvider : PreviewParameterProvider<UserWal
onClick = {},
),
UserWalletItemUM(
id = UserWalletId("user_wallet_3".encodeToByteArray()),
id = "user_wallet_3",
name = stringReference("Multi Card"),
information = getInformation(cardCount = 3),
balance = UserWalletItemUM.Balance.NotShowing,
@ -442,7 +444,7 @@ private class UserWalletItemUMPreviewProvider : PreviewParameterProvider<UserWal
onClick = {},
),
UserWalletItemUM(
id = UserWalletId("user_wallet_4".encodeToByteArray()),
id = "user_wallet_4",
name = stringReference("Main account"),
information = getInformation(cardCount = 3),
balance = UserWalletItemUM.Balance.NotShowing,

View file

@ -41,7 +41,7 @@ class UserWalletItemUMConverter(
override fun convert(value: UserWallet): UserWalletItemUM {
return with(value) {
UserWalletItemUM(
id = walletId,
id = walletId.stringValue,
name = stringReference(name),
information = getInfo(userWallet = this),
balance = getBalanceInfo(userWallet = this),

View file

@ -3,12 +3,11 @@ package com.tangem.common.ui.userwallet.state
import com.tangem.common.ui.account.CryptoPortfolioIconUM
import com.tangem.core.ui.components.artwork.ArtworkUM
import com.tangem.core.ui.extensions.TextReference
import com.tangem.domain.models.wallet.UserWalletId
import javax.annotation.concurrent.Immutable
@Immutable
data class UserWalletItemUM(
val id: UserWalletId,
val id: String,
val name: TextReference,
val information: Information,
val balance: Balance,
@ -25,6 +24,7 @@ data class UserWalletItemUM(
Warning,
}
@Immutable
sealed class Balance {
data object Hidden : Balance()
@ -43,6 +43,7 @@ data class UserWalletItemUM(
) : Balance()
}
@Immutable
sealed class Information {
data object Failed : Information()