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.StatusSource
import com.tangem.domain.models.TotalFiatBalance import com.tangem.domain.models.TotalFiatBalance
import com.tangem.domain.models.account.Account import com.tangem.domain.models.account.Account
import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.utils.converter.Converter import com.tangem.utils.converter.Converter
class AccountPortfolioItemUMConverter( class AccountPortfolioItemUMConverter(
@ -25,7 +24,7 @@ class AccountPortfolioItemUMConverter(
override fun convert(value: Account): UserWalletItemUM { override fun convert(value: Account): UserWalletItemUM {
return with(value) { return with(value) {
UserWalletItemUM( UserWalletItemUM(
id = UserWalletId(accountId.value), id = accountId.value,
name = accountName.toUM().value, name = accountName.toUM().value,
information = getInfo(account = this), information = getInfo(account = this),
balance = getBalanceInfo(), 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.BlockCard
import com.tangem.core.ui.components.block.TangemBlockCardColors import com.tangem.core.ui.components.block.TangemBlockCardColors
import com.tangem.core.ui.components.text.applyBladeBrush 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.TangemTheme
import com.tangem.core.ui.res.TangemThemePreview 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.DASH_SIGN
import com.tangem.utils.StringsSigns.DOT import com.tangem.utils.StringsSigns.DOT
import com.tangem.utils.StringsSigns.THREE_STARS import com.tangem.utils.StringsSigns.THREE_STARS
@ -322,7 +324,7 @@ private class UserWalletItemUMPreviewProvider : PreviewParameterProvider<UserWal
override val values: Sequence<UserWalletItemUM> override val values: Sequence<UserWalletItemUM>
get() = sequenceOf( get() = sequenceOf(
UserWalletItemUM( UserWalletItemUM(
id = UserWalletId("user_wallet_0".encodeToByteArray()), id = "user_wallet_0",
name = stringReference("Mobile Wallet"), name = stringReference("Mobile Wallet"),
information = getInformation(cardCount = 1), information = getInformation(cardCount = 1),
balance = UserWalletItemUM.Balance.Locked, balance = UserWalletItemUM.Balance.Locked,
@ -331,7 +333,7 @@ private class UserWalletItemUMPreviewProvider : PreviewParameterProvider<UserWal
onClick = {}, onClick = {},
), ),
UserWalletItemUM( UserWalletItemUM(
id = UserWalletId("user_wallet_1".encodeToByteArray()), id = "user_wallet_1",
name = stringReference("My Wallet"), name = stringReference("My Wallet"),
information = getInformation(cardCount = 1), information = getInformation(cardCount = 1),
balance = UserWalletItemUM.Balance.Locked, balance = UserWalletItemUM.Balance.Locked,
@ -339,7 +341,7 @@ private class UserWalletItemUMPreviewProvider : PreviewParameterProvider<UserWal
onClick = {}, onClick = {},
), ),
UserWalletItemUM( UserWalletItemUM(
id = UserWalletId("user_wallet_2".encodeToByteArray()), id = "user_wallet_2",
name = stringReference("Old wallet"), name = stringReference("Old wallet"),
information = getInformation(cardCount = 2), information = getInformation(cardCount = 2),
balance = UserWalletItemUM.Balance.Hidden, balance = UserWalletItemUM.Balance.Hidden,
@ -348,7 +350,7 @@ private class UserWalletItemUMPreviewProvider : PreviewParameterProvider<UserWal
endIcon = UserWalletItemUM.EndIcon.Arrow, endIcon = UserWalletItemUM.EndIcon.Arrow,
), ),
UserWalletItemUM( UserWalletItemUM(
id = UserWalletId("user_wallet_3".encodeToByteArray()), id = "user_wallet_3",
name = stringReference("Multi Card"), name = stringReference("Multi Card"),
information = getInformation(cardCount = 3), information = getInformation(cardCount = 3),
balance = UserWalletItemUM.Balance.Failed, balance = UserWalletItemUM.Balance.Failed,
@ -357,7 +359,7 @@ private class UserWalletItemUMPreviewProvider : PreviewParameterProvider<UserWal
onClick = {}, onClick = {},
), ),
UserWalletItemUM( UserWalletItemUM(
id = UserWalletId("user_wallet_3".encodeToByteArray()), id = "user_wallet_3",
name = stringReference("Multi Card"), name = stringReference("Multi Card"),
information = getInformation(cardCount = 3), information = getInformation(cardCount = 3),
balance = UserWalletItemUM.Balance.Loading, balance = UserWalletItemUM.Balance.Loading,
@ -366,7 +368,7 @@ private class UserWalletItemUMPreviewProvider : PreviewParameterProvider<UserWal
onClick = {}, onClick = {},
), ),
UserWalletItemUM( UserWalletItemUM(
id = UserWalletId("user_wallet_3".encodeToByteArray()), id = "user_wallet_3",
name = stringReference("Multi Card"), name = stringReference("Multi Card"),
information = UserWalletItemUM.Information.Loading, information = UserWalletItemUM.Information.Loading,
balance = UserWalletItemUM.Balance.Loading, balance = UserWalletItemUM.Balance.Loading,
@ -375,7 +377,7 @@ private class UserWalletItemUMPreviewProvider : PreviewParameterProvider<UserWal
onClick = {}, onClick = {},
), ),
UserWalletItemUM( UserWalletItemUM(
id = UserWalletId("user_wallet_3".encodeToByteArray()), id = "user_wallet_3",
name = stringReference("Multi Card"), name = stringReference("Multi Card"),
information = getInformation(cardCount = 3), information = getInformation(cardCount = 3),
balance = UserWalletItemUM.Balance.Loaded( balance = UserWalletItemUM.Balance.Loaded(
@ -387,7 +389,7 @@ private class UserWalletItemUMPreviewProvider : PreviewParameterProvider<UserWal
onClick = {}, onClick = {},
), ),
UserWalletItemUM( UserWalletItemUM(
id = UserWalletId("user_wallet_3".encodeToByteArray()), id = "user_wallet_3",
name = stringReference("Multi Card"), name = stringReference("Multi Card"),
information = getInformation(cardCount = 3), information = getInformation(cardCount = 3),
balance = UserWalletItemUM.Balance.Loaded( balance = UserWalletItemUM.Balance.Loaded(
@ -399,7 +401,7 @@ private class UserWalletItemUMPreviewProvider : PreviewParameterProvider<UserWal
onClick = {}, onClick = {},
), ),
UserWalletItemUM( UserWalletItemUM(
id = UserWalletId("user_wallet_3".encodeToByteArray()), id = "user_wallet_3",
name = stringReference("Multi Card"), name = stringReference("Multi Card"),
information = UserWalletItemUM.Information.Loading, information = UserWalletItemUM.Information.Loading,
balance = UserWalletItemUM.Balance.Loaded( balance = UserWalletItemUM.Balance.Loaded(
@ -410,7 +412,7 @@ private class UserWalletItemUMPreviewProvider : PreviewParameterProvider<UserWal
onClick = {}, onClick = {},
), ),
UserWalletItemUM( UserWalletItemUM(
id = UserWalletId("user_wallet_3".encodeToByteArray()), id = "user_wallet_3",
name = stringReference("Multi Card"), name = stringReference("Multi Card"),
information = UserWalletItemUM.Information.Failed, information = UserWalletItemUM.Information.Failed,
balance = UserWalletItemUM.Balance.Loaded( balance = UserWalletItemUM.Balance.Loaded(
@ -421,7 +423,7 @@ private class UserWalletItemUMPreviewProvider : PreviewParameterProvider<UserWal
onClick = {}, onClick = {},
), ),
UserWalletItemUM( UserWalletItemUM(
id = UserWalletId("user_wallet_3".encodeToByteArray()), id = "user_wallet_3",
name = stringReference("Multi Card"), name = stringReference("Multi Card"),
information = UserWalletItemUM.Information.Failed, information = UserWalletItemUM.Information.Failed,
balance = UserWalletItemUM.Balance.Loaded( balance = UserWalletItemUM.Balance.Loaded(
@ -433,7 +435,7 @@ private class UserWalletItemUMPreviewProvider : PreviewParameterProvider<UserWal
onClick = {}, onClick = {},
), ),
UserWalletItemUM( UserWalletItemUM(
id = UserWalletId("user_wallet_3".encodeToByteArray()), id = "user_wallet_3",
name = stringReference("Multi Card"), name = stringReference("Multi Card"),
information = getInformation(cardCount = 3), information = getInformation(cardCount = 3),
balance = UserWalletItemUM.Balance.NotShowing, balance = UserWalletItemUM.Balance.NotShowing,
@ -442,7 +444,7 @@ private class UserWalletItemUMPreviewProvider : PreviewParameterProvider<UserWal
onClick = {}, onClick = {},
), ),
UserWalletItemUM( UserWalletItemUM(
id = UserWalletId("user_wallet_4".encodeToByteArray()), id = "user_wallet_4",
name = stringReference("Main account"), name = stringReference("Main account"),
information = getInformation(cardCount = 3), information = getInformation(cardCount = 3),
balance = UserWalletItemUM.Balance.NotShowing, balance = UserWalletItemUM.Balance.NotShowing,

View file

@ -41,7 +41,7 @@ class UserWalletItemUMConverter(
override fun convert(value: UserWallet): UserWalletItemUM { override fun convert(value: UserWallet): UserWalletItemUM {
return with(value) { return with(value) {
UserWalletItemUM( UserWalletItemUM(
id = walletId, id = walletId.stringValue,
name = stringReference(name), name = stringReference(name),
information = getInfo(userWallet = this), information = getInfo(userWallet = this),
balance = getBalanceInfo(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.common.ui.account.CryptoPortfolioIconUM
import com.tangem.core.ui.components.artwork.ArtworkUM import com.tangem.core.ui.components.artwork.ArtworkUM
import com.tangem.core.ui.extensions.TextReference import com.tangem.core.ui.extensions.TextReference
import com.tangem.domain.models.wallet.UserWalletId
import javax.annotation.concurrent.Immutable import javax.annotation.concurrent.Immutable
@Immutable @Immutable
data class UserWalletItemUM( data class UserWalletItemUM(
val id: UserWalletId, val id: String,
val name: TextReference, val name: TextReference,
val information: Information, val information: Information,
val balance: Balance, val balance: Balance,
@ -25,6 +24,7 @@ data class UserWalletItemUM(
Warning, Warning,
} }
@Immutable
sealed class Balance { sealed class Balance {
data object Hidden : Balance() data object Hidden : Balance()
@ -43,6 +43,7 @@ data class UserWalletItemUM(
) : Balance() ) : Balance()
} }
@Immutable
sealed class Information { sealed class Information {
data object Failed : Information() data object Failed : Information()

View file

@ -82,7 +82,7 @@ private fun Preview_TooltipText() {
) { ) {
TooltipText( TooltipText(
text = stringReference("Text"), text = stringReference("Text"),
onInfoClick = { /* [REDACTED_TODO_COMMENT]*/ }, onInfoClick = { },
) )
} }
} }

View file

@ -602,7 +602,6 @@ internal class DefaultCurrenciesRepository(
return demoConfig.isDemoCardId(userWallet.cardId) && response == null return demoConfig.isDemoCardId(userWallet.cardId) && response == null
} }
// TODO [REDACTED_JIRA]
private suspend fun fetchExpressAssetsByNetworkIds(userWallet: UserWallet, userTokens: UserTokensResponse) { private suspend fun fetchExpressAssetsByNetworkIds(userWallet: UserWallet, userTokens: UserTokensResponse) {
val tokens = userTokens.tokens.mapTo(hashSetOf()) { token -> val tokens = userTokens.tokens.mapTo(hashSetOf()) { token ->
ExpressAsset.ID( ExpressAsset.ID(

View file

@ -23,6 +23,6 @@ sealed interface PortfolioSelectorItemUM {
val item: UserWalletItemUM, val item: UserWalletItemUM,
val isSelected: Boolean, val isSelected: Boolean,
) : PortfolioSelectorItemUM { ) : PortfolioSelectorItemUM {
override val id: String = item.id.stringValue override val id: String = item.id
} }
} }

View file

@ -32,7 +32,6 @@ import com.tangem.core.ui.extensions.resourceReference
import com.tangem.core.ui.extensions.stringReference import com.tangem.core.ui.extensions.stringReference
import com.tangem.core.ui.res.TangemTheme import com.tangem.core.ui.res.TangemTheme
import com.tangem.core.ui.res.TangemThemePreview import com.tangem.core.ui.res.TangemThemePreview
import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.features.account.impl.R import com.tangem.features.account.impl.R
import com.tangem.features.account.selector.entity.PortfolioSelectorItemUM import com.tangem.features.account.selector.entity.PortfolioSelectorItemUM
import com.tangem.features.account.selector.entity.PortfolioSelectorUM import com.tangem.features.account.selector.entity.PortfolioSelectorUM
@ -132,7 +131,7 @@ internal object PortfolioSelectorPreviewData {
private val accountItem: UserWalletItemUM private val accountItem: UserWalletItemUM
get() = UserWalletItemUM( get() = UserWalletItemUM(
id = UserWalletId(UUID.randomUUID().toString().encodeToByteArray()), id = UUID.randomUUID().toString(),
name = accountName, name = accountName,
information = UserWalletItemUM.Information.Loaded(stringReference("12 tokens")), information = UserWalletItemUM.Information.Loaded(stringReference("12 tokens")),
balance = UserWalletItemUM.Balance.Loaded("$726.04", false), balance = UserWalletItemUM.Balance.Loaded("$726.04", false),
@ -149,7 +148,7 @@ internal object PortfolioSelectorPreviewData {
private val walletItem: UserWalletItemUM private val walletItem: UserWalletItemUM
get() = UserWalletItemUM( get() = UserWalletItemUM(
id = UserWalletId(UUID.randomUUID().toString().encodeToByteArray()), id = UUID.randomUUID().toString(),
name = walletName, name = walletName,
information = UserWalletItemUM.Information.Loaded(stringReference("12 tokens")), information = UserWalletItemUM.Information.Loaded(stringReference("12 tokens")),
balance = UserWalletItemUM.Balance.Loaded("$726.04", false), balance = UserWalletItemUM.Balance.Loaded("$726.04", false),

View file

@ -10,7 +10,6 @@ import com.tangem.core.ui.extensions.TextReference
import com.tangem.core.ui.extensions.resourceReference import com.tangem.core.ui.extensions.resourceReference
import com.tangem.core.ui.extensions.stringReference import com.tangem.core.ui.extensions.stringReference
import com.tangem.core.ui.extensions.wrappedList import com.tangem.core.ui.extensions.wrappedList
import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.features.details.component.UserWalletListComponent import com.tangem.features.details.component.UserWalletListComponent
import com.tangem.features.details.entity.UserWalletListUM import com.tangem.features.details.entity.UserWalletListUM
import com.tangem.features.details.impl.R import com.tangem.features.details.impl.R
@ -25,7 +24,7 @@ internal class PreviewUserWalletListComponent : UserWalletListComponent {
UserWalletListUM( UserWalletListUM(
userWallets = persistentListOf( userWallets = persistentListOf(
UserWalletItemUM( UserWalletItemUM(
id = UserWalletId("user_wallet_1".encodeToByteArray()), id = "user_wallet_1",
name = stringReference("My Wallet"), name = stringReference("My Wallet"),
information = getInformation(cardCount = 1), information = getInformation(cardCount = 1),
balance = UserWalletItemUM.Balance.Loading, balance = UserWalletItemUM.Balance.Loading,
@ -33,7 +32,7 @@ internal class PreviewUserWalletListComponent : UserWalletListComponent {
onClick = {}, onClick = {},
), ),
UserWalletItemUM( UserWalletItemUM(
id = UserWalletId("user_wallet_2".encodeToByteArray()), id = "user_wallet_2",
name = stringReference("Old wallet"), name = stringReference("Old wallet"),
information = getInformation(cardCount = 2), information = getInformation(cardCount = 2),
balance = UserWalletItemUM.Balance.Loading, balance = UserWalletItemUM.Balance.Loading,
@ -41,7 +40,7 @@ internal class PreviewUserWalletListComponent : UserWalletListComponent {
onClick = {}, onClick = {},
), ),
UserWalletItemUM( UserWalletItemUM(
id = UserWalletId("user_wallet_3".encodeToByteArray()), id = "user_wallet_3",
name = stringReference("Multi Card"), name = stringReference("Multi Card"),
information = getInformation(cardCount = 3), information = getInformation(cardCount = 3),
balance = UserWalletItemUM.Balance.Loading, balance = UserWalletItemUM.Balance.Loading,

View file

@ -6,7 +6,6 @@ import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfig
import com.tangem.core.ui.components.rows.model.BlockchainRowUM import com.tangem.core.ui.components.rows.model.BlockchainRowUM
import com.tangem.core.ui.extensions.TextReference import com.tangem.core.ui.extensions.TextReference
import com.tangem.core.ui.extensions.stringReference import com.tangem.core.ui.extensions.stringReference
import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.features.markets.impl.R import com.tangem.features.markets.impl.R
import com.tangem.features.markets.portfolio.impl.ui.state.AddToPortfolioBSContentUM import com.tangem.features.markets.portfolio.impl.ui.state.AddToPortfolioBSContentUM
import com.tangem.features.markets.portfolio.impl.ui.state.SelectNetworkUM import com.tangem.features.markets.portfolio.impl.ui.state.SelectNetworkUM
@ -24,7 +23,7 @@ internal class PreviewAddToPortfolioBSContentProvider : PreviewParameterProvider
) )
val userWallet = UserWalletItemUM( val userWallet = UserWalletItemUM(
id = UserWalletId("1"), id = "1",
name = stringReference("Wallet 1"), name = stringReference("Wallet 1"),
information = UserWalletItemUM.Information.Loaded(TextReference.Str("3 cards")), information = UserWalletItemUM.Information.Loaded(TextReference.Str("3 cards")),
balance = UserWalletItemUM.Balance.Loading, balance = UserWalletItemUM.Balance.Loading,

View file

@ -29,7 +29,7 @@ internal class PreviewWalletSettingsComponent : WalletSettingsComponent {
private val accountItem: UserWalletItemUM private val accountItem: UserWalletItemUM
get() = UserWalletItemUM( get() = UserWalletItemUM(
id = UserWalletId(UUID.randomUUID().toString().encodeToByteArray()), id = UUID.randomUUID().toString(),
name = accountName, name = accountName,
information = UserWalletItemUM.Information.Loaded(stringReference("12 tokens")), information = UserWalletItemUM.Information.Loaded(stringReference("12 tokens")),
balance = UserWalletItemUM.Balance.Loaded("$726.04", false), balance = UserWalletItemUM.Balance.Loaded("$726.04", false),

View file

@ -67,7 +67,7 @@ internal sealed class WalletSettingsAccountsUM : WalletSettingsItemUM() {
data class Account( data class Account(
val state: UserWalletItemUM, val state: UserWalletItemUM,
) : WalletSettingsAccountsUM() { ) : WalletSettingsAccountsUM() {
override val id: String get() = state.id.stringValue override val id: String = state.id
} }
data class Footer( data class Footer(

View file

@ -448,7 +448,7 @@ internal class WalletSettingsModel @Inject constructor(
val id = (it as? WalletSettingsAccountsUM.Account)?.state?.id val id = (it as? WalletSettingsAccountsUM.Account)?.state?.id
?: return@mapNotNull null ?: return@mapNotNull null
AccountId.forCryptoPortfolio(userWalletId = params.userWalletId, value = id.stringValue).getOrNull() AccountId.forCryptoPortfolio(userWalletId = params.userWalletId, value = id).getOrNull()
} }
accountListSortingSaver.save(accountIds = accountIds) accountListSortingSaver.save(accountIds = accountIds)

View file

@ -114,6 +114,7 @@ private fun Content(state: WalletSettingsUM, modifier: Modifier = Modifier) {
items( items(
items = state.items, items = state.items,
key = WalletSettingsItemUM::id, key = WalletSettingsItemUM::id,
contentType = { it::class.java },
) { item -> ) { item ->
val offsetModifier = when (item) { val offsetModifier = when (item) {
is WalletSettingsAccountsUM.Account, is WalletSettingsAccountsUM.Account,
@ -335,6 +336,7 @@ private fun LazyItemScope.AccountItem(
ReorderableItem( ReorderableItem(
state = reorderableListState, state = reorderableListState,
key = model.id, key = model.id,
modifier = modifier,
) { isDragging -> ) { isDragging ->
val elevation by animateDpAsState(if (isDragging) 9.dp else 0.dp) val elevation by animateDpAsState(if (isDragging) 9.dp else 0.dp)
val scale by animateFloatAsState(if (isDragging) 1.04f else 1f) val scale by animateFloatAsState(if (isDragging) 1.04f else 1f)
@ -343,7 +345,7 @@ private fun LazyItemScope.AccountItem(
Surface( Surface(
shape = RoundedCornerShape(shapeRadius), shape = RoundedCornerShape(shapeRadius),
shadowElevation = elevation, shadowElevation = elevation,
modifier = modifier.scale(scale), modifier = Modifier.scale(scale),
) { ) {
UserWalletItem( UserWalletItem(
state = model.state, state = model.state,

View file

@ -119,7 +119,7 @@ private fun WcSelectWalletContent(
val baseModifier = Modifier val baseModifier = Modifier
.clip(RoundedCornerShape(14.dp)) .clip(RoundedCornerShape(14.dp))
.clickable(onClick = state.onClick) .clickable(onClick = state.onClick)
val itemModifier = if (state.id == selectedWalletId) { val itemModifier = if (state.id == selectedWalletId.stringValue) {
baseModifier.border( baseModifier.border(
width = 1.dp, width = 1.dp,
color = TangemTheme.colors.text.accent, color = TangemTheme.colors.text.accent,
@ -148,7 +148,7 @@ private fun WcSelectWalletContent(
private fun WcSelectWalletContent_Preview() { private fun WcSelectWalletContent_Preview() {
val wallets = persistentListOf( val wallets = persistentListOf(
UserWalletItemUM( UserWalletItemUM(
id = UserWalletId("user_wallet_1".encodeToByteArray()), id = "user_wallet_1",
name = stringReference("Tangem 2.0"), name = stringReference("Tangem 2.0"),
information = getInformation(42), information = getInformation(42),
balance = UserWalletItemUM.Balance.Loaded("1 496,34 $", isFlickering = false), balance = UserWalletItemUM.Balance.Loaded("1 496,34 $", isFlickering = false),
@ -156,7 +156,7 @@ private fun WcSelectWalletContent_Preview() {
onClick = {}, onClick = {},
), ),
UserWalletItemUM( UserWalletItemUM(
id = UserWalletId("user_wallet_2".encodeToByteArray()), id = "user_wallet_2",
name = stringReference("Tangem White"), name = stringReference("Tangem White"),
information = getInformation(24), information = getInformation(24),
balance = UserWalletItemUM.Balance.Loaded("1 496,34 $", isFlickering = false), balance = UserWalletItemUM.Balance.Loaded("1 496,34 $", isFlickering = false),
@ -164,7 +164,7 @@ private fun WcSelectWalletContent_Preview() {
onClick = {}, onClick = {},
), ),
UserWalletItemUM( UserWalletItemUM(
id = UserWalletId("user_wallet_3".encodeToByteArray()), id = "user_wallet_3",
name = stringReference("Bitcoin"), name = stringReference("Bitcoin"),
information = getInformation(1), information = getInformation(1),
balance = UserWalletItemUM.Balance.Loaded("1 496,34 $", isFlickering = false), balance = UserWalletItemUM.Balance.Loaded("1 496,34 $", isFlickering = false),
@ -172,7 +172,7 @@ private fun WcSelectWalletContent_Preview() {
onClick = {}, onClick = {},
), ),
UserWalletItemUM( UserWalletItemUM(
id = UserWalletId("user_wallet_4".encodeToByteArray()), id = "user_wallet_4",
name = stringReference("Tangem 1.0"), name = stringReference("Tangem 1.0"),
information = getInformation(21), information = getInformation(21),
balance = UserWalletItemUM.Balance.Loaded("1 496,34 $", isFlickering = false), balance = UserWalletItemUM.Balance.Loaded("1 496,34 $", isFlickering = false),
@ -180,7 +180,7 @@ private fun WcSelectWalletContent_Preview() {
onClick = {}, onClick = {},
), ),
UserWalletItemUM( UserWalletItemUM(
id = UserWalletId("user_wallet_4".encodeToByteArray()), id = "user_wallet_4",
name = stringReference("Tangem 1.0"), name = stringReference("Tangem 1.0"),
information = UserWalletItemUM.Information.Loading, information = UserWalletItemUM.Information.Loading,
balance = UserWalletItemUM.Balance.Loaded("1 496,34 $", isFlickering = false), balance = UserWalletItemUM.Balance.Loaded("1 496,34 $", isFlickering = false),
@ -188,7 +188,7 @@ private fun WcSelectWalletContent_Preview() {
onClick = {}, onClick = {},
), ),
UserWalletItemUM( UserWalletItemUM(
id = UserWalletId("user_wallet_4".encodeToByteArray()), id = "user_wallet_4",
name = stringReference("Tangem 1.0"), name = stringReference("Tangem 1.0"),
information = UserWalletItemUM.Information.Failed, information = UserWalletItemUM.Information.Failed,
balance = UserWalletItemUM.Balance.Loaded("1 496,34 $", isFlickering = false), balance = UserWalletItemUM.Balance.Loaded("1 496,34 $", isFlickering = false),
@ -199,7 +199,7 @@ private fun WcSelectWalletContent_Preview() {
TangemThemePreview { TangemThemePreview {
WcSelectWalletModalBS( WcSelectWalletModalBS(
wallets = wallets, wallets = wallets,
selectedWalletId = wallets.first().id, selectedWalletId = UserWalletId(wallets.first().id.encodeToByteArray()),
onBack = {}, onBack = {},
onDismiss = {}, onDismiss = {},
) )

View file

@ -6,8 +6,8 @@ import com.tangem.core.decompose.di.ModelScoped
import com.tangem.core.decompose.ui.UiMessageSender import com.tangem.core.decompose.ui.UiMessageSender
import com.tangem.core.ui.extensions.TextReference import com.tangem.core.ui.extensions.TextReference
import com.tangem.core.ui.extensions.wrappedList import com.tangem.core.ui.extensions.wrappedList
import com.tangem.domain.tokens.GetTokenListUseCase
import com.tangem.domain.models.wallet.UserWalletId import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.domain.tokens.GetTokenListUseCase
import com.tangem.features.wallet.utils.UserWalletsFetcher import com.tangem.features.wallet.utils.UserWalletsFetcher
import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.toImmutableList import kotlinx.collections.immutable.toImmutableList
@ -41,7 +41,7 @@ internal class WcUserWalletsFetcher(
} }
private fun getTokenListFlow(walletItem: UserWalletItemUM): Flow<UserWalletItemUM> { private fun getTokenListFlow(walletItem: UserWalletItemUM): Flow<UserWalletItemUM> {
return getTokenListUseCase.launch(walletItem.id).map { lce -> return getTokenListUseCase.launch(UserWalletId(walletItem.id)).map { lce ->
val information = lce.fold( val information = lce.fold(
ifLoading = { UserWalletItemUM.Information.Loading }, ifLoading = { UserWalletItemUM.Information.Loading },
ifError = { UserWalletItemUM.Information.Failed }, ifError = { UserWalletItemUM.Information.Failed },

View file

@ -14,7 +14,6 @@ import com.tangem.common.ui.userwallet.state.UserWalletItemUM
import com.tangem.core.ui.extensions.stringReference import com.tangem.core.ui.extensions.stringReference
import com.tangem.core.ui.res.TangemTheme import com.tangem.core.ui.res.TangemTheme
import com.tangem.core.ui.res.TangemThemePreview import com.tangem.core.ui.res.TangemThemePreview
import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.features.welcome.impl.ui.state.WelcomeUM import com.tangem.features.welcome.impl.ui.state.WelcomeUM
import kotlinx.collections.immutable.persistentListOf import kotlinx.collections.immutable.persistentListOf
@ -48,7 +47,7 @@ private fun Preview() {
val state = WelcomeUM.SelectWallet( val state = WelcomeUM.SelectWallet(
wallets = persistentListOf( wallets = persistentListOf(
UserWalletItemUM( UserWalletItemUM(
id = UserWalletId("user_wallet_3".encodeToByteArray()), id = "user_wallet_3",
name = stringReference("Multi Card"), name = stringReference("Multi Card"),
information = UserWalletItemUM.Information.Loading, information = UserWalletItemUM.Information.Loading,
balance = UserWalletItemUM.Balance.Loaded( balance = UserWalletItemUM.Balance.Loaded(
@ -59,7 +58,7 @@ private fun Preview() {
onClick = {}, onClick = {},
), ),
UserWalletItemUM( UserWalletItemUM(
id = UserWalletId("user_wallet_3".encodeToByteArray()), id = "user_wallet_3",
name = stringReference("Multi Card"), name = stringReference("Multi Card"),
information = UserWalletItemUM.Information.Failed, information = UserWalletItemUM.Information.Failed,
imageState = UserWalletItemUM.ImageState.MobileWallet, imageState = UserWalletItemUM.ImageState.MobileWallet,