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

@ -23,6 +23,6 @@ sealed interface PortfolioSelectorItemUM {
val item: UserWalletItemUM,
val isSelected: Boolean,
) : 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.res.TangemTheme
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.selector.entity.PortfolioSelectorItemUM
import com.tangem.features.account.selector.entity.PortfolioSelectorUM
@ -132,7 +131,7 @@ internal object PortfolioSelectorPreviewData {
private val accountItem: UserWalletItemUM
get() = UserWalletItemUM(
id = UserWalletId(UUID.randomUUID().toString().encodeToByteArray()),
id = UUID.randomUUID().toString(),
name = accountName,
information = UserWalletItemUM.Information.Loaded(stringReference("12 tokens")),
balance = UserWalletItemUM.Balance.Loaded("$726.04", false),
@ -149,7 +148,7 @@ internal object PortfolioSelectorPreviewData {
private val walletItem: UserWalletItemUM
get() = UserWalletItemUM(
id = UserWalletId(UUID.randomUUID().toString().encodeToByteArray()),
id = UUID.randomUUID().toString(),
name = walletName,
information = UserWalletItemUM.Information.Loaded(stringReference("12 tokens")),
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.stringReference
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.entity.UserWalletListUM
import com.tangem.features.details.impl.R
@ -25,7 +24,7 @@ internal class PreviewUserWalletListComponent : UserWalletListComponent {
UserWalletListUM(
userWallets = persistentListOf(
UserWalletItemUM(
id = UserWalletId("user_wallet_1".encodeToByteArray()),
id = "user_wallet_1",
name = stringReference("My Wallet"),
information = getInformation(cardCount = 1),
balance = UserWalletItemUM.Balance.Loading,
@ -33,7 +32,7 @@ internal class PreviewUserWalletListComponent : UserWalletListComponent {
onClick = {},
),
UserWalletItemUM(
id = UserWalletId("user_wallet_2".encodeToByteArray()),
id = "user_wallet_2",
name = stringReference("Old wallet"),
information = getInformation(cardCount = 2),
balance = UserWalletItemUM.Balance.Loading,
@ -41,7 +40,7 @@ internal class PreviewUserWalletListComponent : UserWalletListComponent {
onClick = {},
),
UserWalletItemUM(
id = UserWalletId("user_wallet_3".encodeToByteArray()),
id = "user_wallet_3",
name = stringReference("Multi Card"),
information = getInformation(cardCount = 3),
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.extensions.TextReference
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.portfolio.impl.ui.state.AddToPortfolioBSContentUM
import com.tangem.features.markets.portfolio.impl.ui.state.SelectNetworkUM
@ -24,7 +23,7 @@ internal class PreviewAddToPortfolioBSContentProvider : PreviewParameterProvider
)
val userWallet = UserWalletItemUM(
id = UserWalletId("1"),
id = "1",
name = stringReference("Wallet 1"),
information = UserWalletItemUM.Information.Loaded(TextReference.Str("3 cards")),
balance = UserWalletItemUM.Balance.Loading,

View file

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

View file

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

View file

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

View file

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

View file

@ -119,7 +119,7 @@ private fun WcSelectWalletContent(
val baseModifier = Modifier
.clip(RoundedCornerShape(14.dp))
.clickable(onClick = state.onClick)
val itemModifier = if (state.id == selectedWalletId) {
val itemModifier = if (state.id == selectedWalletId.stringValue) {
baseModifier.border(
width = 1.dp,
color = TangemTheme.colors.text.accent,
@ -148,7 +148,7 @@ private fun WcSelectWalletContent(
private fun WcSelectWalletContent_Preview() {
val wallets = persistentListOf(
UserWalletItemUM(
id = UserWalletId("user_wallet_1".encodeToByteArray()),
id = "user_wallet_1",
name = stringReference("Tangem 2.0"),
information = getInformation(42),
balance = UserWalletItemUM.Balance.Loaded("1 496,34 $", isFlickering = false),
@ -156,7 +156,7 @@ private fun WcSelectWalletContent_Preview() {
onClick = {},
),
UserWalletItemUM(
id = UserWalletId("user_wallet_2".encodeToByteArray()),
id = "user_wallet_2",
name = stringReference("Tangem White"),
information = getInformation(24),
balance = UserWalletItemUM.Balance.Loaded("1 496,34 $", isFlickering = false),
@ -164,7 +164,7 @@ private fun WcSelectWalletContent_Preview() {
onClick = {},
),
UserWalletItemUM(
id = UserWalletId("user_wallet_3".encodeToByteArray()),
id = "user_wallet_3",
name = stringReference("Bitcoin"),
information = getInformation(1),
balance = UserWalletItemUM.Balance.Loaded("1 496,34 $", isFlickering = false),
@ -172,7 +172,7 @@ private fun WcSelectWalletContent_Preview() {
onClick = {},
),
UserWalletItemUM(
id = UserWalletId("user_wallet_4".encodeToByteArray()),
id = "user_wallet_4",
name = stringReference("Tangem 1.0"),
information = getInformation(21),
balance = UserWalletItemUM.Balance.Loaded("1 496,34 $", isFlickering = false),
@ -180,7 +180,7 @@ private fun WcSelectWalletContent_Preview() {
onClick = {},
),
UserWalletItemUM(
id = UserWalletId("user_wallet_4".encodeToByteArray()),
id = "user_wallet_4",
name = stringReference("Tangem 1.0"),
information = UserWalletItemUM.Information.Loading,
balance = UserWalletItemUM.Balance.Loaded("1 496,34 $", isFlickering = false),
@ -188,7 +188,7 @@ private fun WcSelectWalletContent_Preview() {
onClick = {},
),
UserWalletItemUM(
id = UserWalletId("user_wallet_4".encodeToByteArray()),
id = "user_wallet_4",
name = stringReference("Tangem 1.0"),
information = UserWalletItemUM.Information.Failed,
balance = UserWalletItemUM.Balance.Loaded("1 496,34 $", isFlickering = false),
@ -199,7 +199,7 @@ private fun WcSelectWalletContent_Preview() {
TangemThemePreview {
WcSelectWalletModalBS(
wallets = wallets,
selectedWalletId = wallets.first().id,
selectedWalletId = UserWalletId(wallets.first().id.encodeToByteArray()),
onBack = {},
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.ui.extensions.TextReference
import com.tangem.core.ui.extensions.wrappedList
import com.tangem.domain.tokens.GetTokenListUseCase
import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.domain.tokens.GetTokenListUseCase
import com.tangem.features.wallet.utils.UserWalletsFetcher
import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.toImmutableList
@ -41,7 +41,7 @@ internal class WcUserWalletsFetcher(
}
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(
ifLoading = { UserWalletItemUM.Information.Loading },
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.res.TangemTheme
import com.tangem.core.ui.res.TangemThemePreview
import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.features.welcome.impl.ui.state.WelcomeUM
import kotlinx.collections.immutable.persistentListOf
@ -48,7 +47,7 @@ private fun Preview() {
val state = WelcomeUM.SelectWallet(
wallets = persistentListOf(
UserWalletItemUM(
id = UserWalletId("user_wallet_3".encodeToByteArray()),
id = "user_wallet_3",
name = stringReference("Multi Card"),
information = UserWalletItemUM.Information.Loading,
balance = UserWalletItemUM.Balance.Loaded(
@ -59,7 +58,7 @@ private fun Preview() {
onClick = {},
),
UserWalletItemUM(
id = UserWalletId("user_wallet_3".encodeToByteArray()),
id = "user_wallet_3",
name = stringReference("Multi Card"),
information = UserWalletItemUM.Information.Failed,
imageState = UserWalletItemUM.ImageState.MobileWallet,