Updated on 2026-08-14

This commit is contained in:
Tangem 2026-02-17 16:06:51 +05:00
commit 3fabe68051
39 changed files with 812 additions and 18 deletions

View file

@ -12,6 +12,7 @@ import com.tangem.feature.wallet.presentation.wallet.state.model.WalletCardState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletNotification
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletScreenState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletType
import timber.log.Timber
import javax.inject.Inject
@ -110,7 +111,7 @@ internal class WalletsUpdateActionResolver @Inject constructor(
when (walletState) {
is WalletState.MultiCurrency -> {
val wallet = wallets.firstOrNull { it.walletId == walletState.walletCardState.id }
walletState.type == WalletState.MultiCurrency.WalletType.Hot && wallet is UserWallet.Cold
walletState.type == WalletType.Hot && wallet is UserWallet.Cold
}
else -> false
}
@ -212,7 +213,7 @@ internal class WalletsUpdateActionResolver @Inject constructor(
val previousState = state.wallets.firstOrNull { it.walletCardState.id == wallet.walletId }
?: return@filter false
wallet is UserWallet.Cold && previousState is WalletState.MultiCurrency &&
previousState.type == WalletState.MultiCurrency.WalletType.Hot
previousState.type == WalletType.Hot
}
return Action.ReinitializeWallets(selectedWallet, walletsToUpdate)
}

View file

@ -186,7 +186,7 @@ internal object WalletScreenPreviewData {
onItemClick = { },
),
tangemPayState = TangemPayState.Empty,
type = WalletState.MultiCurrency.WalletType.Cold,
type = WalletType.Cold,
)
}
@ -218,6 +218,7 @@ internal object WalletScreenPreviewData {
singleWalletLockedState,
multiWalletState,
),
wallets2 = persistentListOf(),
onWalletChange = { _, _ -> },
event = consumedEvent(),
isHidingMode = false,

View file

@ -1,12 +1,10 @@
package com.tangem.feature.wallet.presentation.wallet.state
import com.tangem.core.ui.DesignFeatureToggles
import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfigContent
import com.tangem.core.ui.event.consumedEvent
import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.feature.wallet.presentation.wallet.state.model.NOT_INITIALIZED_WALLET_INDEX
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletScreenState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletTopBarConfig
import com.tangem.feature.wallet.presentation.wallet.state.model.*
import com.tangem.feature.wallet.presentation.wallet.state.transformers.CloseBottomSheetTransformer
import com.tangem.feature.wallet.presentation.wallet.state.transformers.OpenBottomSheetTransformer
import com.tangem.feature.wallet.presentation.wallet.state.transformers.WalletScreenStateTransformer
@ -25,7 +23,9 @@ import javax.inject.Singleton
[REDACTED_AUTHOR]
*/
@Singleton
internal class WalletStateController @Inject constructor() {
internal class WalletStateController @Inject constructor(
private val designFeatureToggles: DesignFeatureToggles,
) {
val uiState: StateFlow<WalletScreenState> get() = mutableUiState
@ -53,6 +53,10 @@ internal class WalletStateController @Inject constructor() {
return value.wallets.firstOrNull { it.walletCardState.id == userWalletId }
}
fun getWalletUM(userWalletId: UserWalletId): WalletUM? {
return value.wallets2.firstOrNull { it.walletsBalanceUM.id == userWalletId }
}
fun getWalletStateIfSelected(walletId: UserWalletId): WalletState? {
val selectedWalletId = getSelectedWalletId()
@ -61,16 +65,40 @@ internal class WalletStateController @Inject constructor() {
}
}
fun getWalletUMIfSelected(walletId: UserWalletId): WalletUM? {
val selectedWalletId = getSelectedWalletId()
return value.wallets2.firstOrNull {
it.walletsBalanceUM.id == walletId && it.walletsBalanceUM.id == selectedWalletId
}
}
fun getSelectedWallet(): WalletState {
return with(value) { wallets[selectedWalletIndex] }
}
fun getSelectedWalletUM(): WalletUM {
return with(value) { wallets2[selectedWalletIndex] }
}
fun getSelectedWalletId(): UserWalletId {
return with(value) { wallets[selectedWalletIndex].walletCardState.id }
return with(value) {
if (designFeatureToggles.isRedesignEnabled) {
wallets2[selectedWalletIndex].walletsBalanceUM.id
} else {
wallets[selectedWalletIndex].walletCardState.id
}
}
}
fun getWalletIndexByWalletId(userWalletId: UserWalletId): Int? {
return with(value) { wallets.indexOfFirstOrNull { it.walletCardState.id == userWalletId } }
return with(value) {
if (designFeatureToggles.isRedesignEnabled) {
wallets2.indexOfFirstOrNull { it.walletsBalanceUM.id == userWalletId }
} else {
wallets.indexOfFirstOrNull { it.walletCardState.id == userWalletId }
}
}
}
fun showBottomSheet(
@ -105,6 +133,7 @@ internal class WalletStateController @Inject constructor() {
topBarConfig = WalletTopBarConfig(onDetailsClick = {}),
selectedWalletIndex = NOT_INITIALIZED_WALLET_INDEX,
wallets = persistentListOf(),
wallets2 = persistentListOf(),
onWalletChange = { _, _ -> },
event = consumedEvent(),
isHidingMode = false,

View file

@ -0,0 +1,62 @@
package com.tangem.feature.wallet.presentation.wallet.state.model
import androidx.compose.runtime.Immutable
import com.tangem.core.ui.extensions.TextReference
import com.tangem.domain.models.wallet.UserWalletId
/** Wallet card state */
@Immutable
internal sealed interface WalletBalanceUM {
/** Wallet Id */
val id: UserWalletId
/** Wallet Name */
val name: String
/**
* Wallet card content state
*
* @property id wallet id
* @property name wallet name
* @property balance wallet balance
*/
data class Content(
override val id: UserWalletId,
override val name: String,
val balance: TextReference,
val isBalanceFlickering: Boolean,
val isZeroBalance: Boolean?,
) : WalletBalanceUM
/**
* Wallet card error state
*
* @property id wallet id
* @property name wallet name
*/
data class Error(
override val id: UserWalletId,
override val name: String,
) : WalletBalanceUM
/**
* Wallet card loading state
*
* @property id wallet id
* @property name wallet name
*/
data class Loading(
override val id: UserWalletId,
override val name: String,
) : WalletBalanceUM
fun copySealed(name: String): WalletBalanceUM {
return when (this) {
is Content -> copy(name = name)
is Error -> copy(name = name)
is Loading -> copy(name = name)
}
}
}

View file

@ -0,0 +1,429 @@
package com.tangem.feature.wallet.presentation.wallet.state.model
import androidx.annotation.DrawableRes
import com.tangem.core.ui.ds.button.TangemButtonType
import com.tangem.core.ui.ds.image.TangemIconUM
import com.tangem.core.ui.ds.message.TangemMessageButtonUM
import com.tangem.core.ui.ds.message.TangemMessageEffect
import com.tangem.core.ui.ds.message.TangemMessageUM
import com.tangem.core.ui.extensions.pluralReference
import com.tangem.core.ui.extensions.resourceReference
import com.tangem.core.ui.extensions.stringReference
import com.tangem.core.ui.extensions.wrappedList
import com.tangem.core.ui.res.TangemTheme
import com.tangem.feature.wallet.impl.R
import kotlinx.collections.immutable.persistentListOf
/**
* Wallet notification types
*/
internal enum class WalletNotificationType {
Status,
Critical,
Warning,
Promo,
Survey,
Informational,
}
/**
* Wallet notification UI model
*
* @property messageUM - message to show in notification
* @property type - type of notification, affects design and priority
*/
internal sealed class WalletNotificationUM(val messageUM: TangemMessageUM, val type: WalletNotificationType) {
data object DevCard : WalletNotificationUM(
messageUM = TangemMessageUM(
id = "DevCardNotification",
title = resourceReference(id = R.string.warning_developer_card_title),
subtitle = resourceReference(id = R.string.warning_developer_card_message),
messageEffect = TangemMessageEffect.None,
),
type = WalletNotificationType.Warning,
)
data object FailedCardValidation : WalletNotificationUM(
messageUM = TangemMessageUM(
id = "FailedCardValidationNotification",
title = resourceReference(id = R.string.warning_failed_to_verify_card_title),
subtitle = resourceReference(id = R.string.warning_failed_to_verify_card_message),
messageEffect = TangemMessageEffect.Warning,
),
type = WalletNotificationType.Status,
)
data class BackupError(val onClick: () -> Unit) : WalletNotificationUM(
messageUM = TangemMessageUM(
id = "BackupErrorNotification",
title = resourceReference(id = R.string.warning_backup_errors_title),
subtitle = resourceReference(id = R.string.warning_backup_errors_message),
messageEffect = TangemMessageEffect.Warning,
buttonsUM = persistentListOf(
TangemMessageButtonUM(
text = resourceReference(id = R.string.common_contact_support),
type = TangemButtonType.PrimaryInverse,
onClick = onClick,
),
),
),
type = WalletNotificationType.Warning,
)
data class SeedPhraseNotification(
val onDeclineClick: () -> Unit,
val onConfirmClick: () -> Unit,
) : WalletNotificationUM(
messageUM = TangemMessageUM(
id = "SeedPhraseIssueNotification",
title = resourceReference(id = R.string.warning_seedphrase_issue_title),
subtitle = resourceReference(id = R.string.warning_seedphrase_issue_message),
messageEffect = TangemMessageEffect.Warning,
buttonsUM = persistentListOf(
TangemMessageButtonUM(
text = resourceReference(id = R.string.common_no),
type = TangemButtonType.PrimaryInverse,
onClick = onDeclineClick,
),
TangemMessageButtonUM(
text = resourceReference(id = R.string.common_yes),
type = TangemButtonType.PrimaryInverse,
onClick = onConfirmClick,
),
),
),
type = WalletNotificationType.Critical,
)
data class SeedPhraseSecondNotification(
val onDeclineClick: () -> Unit,
val onConfirmClick: () -> Unit,
) : WalletNotificationUM(
messageUM = TangemMessageUM(
id = "SeedPhraseSecondIssueNotification",
title = resourceReference(id = R.string.warning_seedphrase_action_required_title),
subtitle = resourceReference(id = R.string.warning_seedphrase_contacted_support),
messageEffect = TangemMessageEffect.Warning,
buttonsUM = persistentListOf(
TangemMessageButtonUM(
text = resourceReference(id = R.string.seed_warning_no),
type = TangemButtonType.PrimaryInverse,
onClick = onDeclineClick,
),
TangemMessageButtonUM(
text = resourceReference(id = R.string.seed_warning_yes),
type = TangemButtonType.PrimaryInverse,
onClick = onConfirmClick,
),
),
),
type = WalletNotificationType.Critical,
)
data class MissingBackup(val onClick: () -> Unit) : WalletNotificationUM(
messageUM = TangemMessageUM(
id = "MissingBackupNotification",
title = resourceReference(id = R.string.warning_no_backup_title),
subtitle = resourceReference(id = R.string.warning_no_backup_message),
messageEffect = TangemMessageEffect.Warning,
buttonsUM = persistentListOf(
TangemMessageButtonUM(
text = resourceReference(id = R.string.button_start_backup_process),
type = TangemButtonType.PrimaryInverse,
onClick = onClick,
),
),
),
type = WalletNotificationType.Critical,
)
data object SomeNetworksUnreachable : WalletNotificationUM(
messageUM = TangemMessageUM(
id = "SomeNetworksUnreachableNotification",
title = resourceReference(id = R.string.warning_some_networks_unreachable_title),
subtitle = resourceReference(id = R.string.warning_some_networks_unreachable_message),
messageEffect = TangemMessageEffect.None,
),
type = WalletNotificationType.Status,
)
data class NumberOfSignedHashesIncorrect(val onCloseClick: () -> Unit) : WalletNotificationUM(
messageUM = TangemMessageUM(
id = "NumberOfSignedHashesIncorrectNotification",
title = resourceReference(id = R.string.warning_number_of_signed_hashes_incorrect_title),
subtitle = resourceReference(id = R.string.warning_number_of_signed_hashes_incorrect_message),
messageEffect = TangemMessageEffect.Warning,
onCloseClick = onCloseClick,
),
type = WalletNotificationType.Warning,
)
data object TestnetCard : WalletNotificationUM(
messageUM = TangemMessageUM(
id = "TestnetCardNotification",
title = resourceReference(id = R.string.warning_testnet_card_title),
subtitle = resourceReference(id = R.string.warning_testnet_card_message),
messageEffect = TangemMessageEffect.None,
),
type = WalletNotificationType.Warning,
)
data class LowSignatures(val count: Int) : WalletNotificationUM(
messageUM = TangemMessageUM(
id = "LowSignaturesNotification",
title = resourceReference(id = R.string.warning_low_signatures_title),
subtitle = resourceReference(
id = R.string.warning_low_signatures_message,
formatArgs = wrappedList(count.toString()),
),
messageEffect = TangemMessageEffect.None,
),
type = WalletNotificationType.Critical,
)
data class MissingAddresses(
@DrawableRes val tangemIcon: Int?,
val missingAddressesCount: Int,
val onGenerateClick: () -> Unit,
) : WalletNotificationUM(
messageUM = TangemMessageUM(
id = "MissingAddressesNotification",
title = resourceReference(id = R.string.warning_missing_derivation_title),
subtitle = pluralReference(
id = R.plurals.warning_missing_derivation_message,
count = missingAddressesCount,
formatArgs = wrappedList(missingAddressesCount),
),
isCentered = true,
iconUM = tangemIcon?.let { TangemIconUM.Icon(it) },
messageEffect = TangemMessageEffect.Magic,
buttonsUM = persistentListOf(
TangemMessageButtonUM(
text = resourceReference(id = R.string.common_generate_addresses),
type = TangemButtonType.PrimaryInverse,
iconRes = tangemIcon,
onClick = onGenerateClick,
),
),
),
type = WalletNotificationType.Warning,
)
data class NoAccount(val network: String, val symbol: String, val amount: String) : WalletNotificationUM(
messageUM = TangemMessageUM(
id = "NoAccountNotification",
title = resourceReference(id = R.string.warning_no_account_title),
subtitle = resourceReference(
id = R.string.no_account_generic,
wrappedList(network, amount, symbol),
),
messageEffect = TangemMessageEffect.None,
),
type = WalletNotificationType.Warning,
)
data object DemoCard : WalletNotificationUM(
messageUM = TangemMessageUM(
id = "DemoCardNotification",
title = resourceReference(id = R.string.warning_demo_mode_title),
subtitle = resourceReference(id = R.string.warning_demo_mode_message),
messageEffect = TangemMessageEffect.None,
),
type = WalletNotificationType.Warning,
)
data class NoteMigration(val onClick: () -> Unit) : WalletNotificationUM(
messageUM = TangemMessageUM(
id = "NoteMigrationNotification",
title = resourceReference(R.string.wallet_promo_banner_title),
subtitle = resourceReference(R.string.wallet_promo_banner_description),
messageEffect = TangemMessageEffect.None,
buttonsUM = persistentListOf(
TangemMessageButtonUM(
text = resourceReference(R.string.wallet_promo_banner_button_title),
onClick = onClick,
type = TangemButtonType.PrimaryInverse,
),
),
),
type = WalletNotificationType.Promo,
)
data class UnlockWallets(val onClick: () -> Unit) : WalletNotificationUM(
messageUM = TangemMessageUM(
id = "UnlockWalletsNotification",
title = resourceReference(id = R.string.common_access_denied),
subtitle = resourceReference(
id = R.string.warning_access_denied_message,
formatArgs = wrappedList(
resourceReference(R.string.common_biometrics),
),
),
onClick = onClick,
messageEffect = TangemMessageEffect.Magic,
isCentered = true,
),
type = WalletNotificationType.Warning,
)
data class RateApp(
val onLikeClick: () -> Unit,
val onDislikeClick: () -> Unit,
val onCloseClick: () -> Unit,
) : WalletNotificationUM(
messageUM = TangemMessageUM(
id = "RateAppNotification",
title = resourceReference(id = R.string.warning_rate_app_title),
subtitle = resourceReference(id = R.string.warning_rate_app_message),
isCentered = true,
buttonsUM = persistentListOf(
TangemMessageButtonUM(
text = resourceReference(id = R.string.warning_button_could_be_better),
type = TangemButtonType.PrimaryInverse,
onClick = onDislikeClick,
),
TangemMessageButtonUM(
text = resourceReference(id = R.string.warning_button_like_it),
type = TangemButtonType.Primary,
onClick = onLikeClick,
),
),
messageEffect = TangemMessageEffect.None,
onCloseClick = onCloseClick,
),
type = WalletNotificationType.Survey,
)
data object UsedOutdatedData : WalletNotificationUM(
messageUM = TangemMessageUM(
id = "UsedOutdatedDataNotification",
title = stringReference("Missing some token balances"), // todo redesign main lokalise
subtitle = stringReference("Will be updated as soon as possible"),
messageEffect = TangemMessageEffect.None,
),
type = WalletNotificationType.Status,
)
data class FinishWalletActivation(
val messageEffect: TangemMessageEffect,
val isBackupExists: Boolean,
val onClick: () -> Unit,
) : WalletNotificationUM(
messageUM = TangemMessageUM(
id = "FinishWalletActivationNotification",
title = resourceReference(R.string.hw_activation_need_title),
subtitle = if (isBackupExists) {
resourceReference(R.string.hw_activation_need_warning_description)
} else {
resourceReference(R.string.hw_activation_need_description)
},
iconUM = TangemIconUM.Icon(
iconRes = R.drawable.img_knight_shield_32,
tintReference = { TangemTheme.colors2.graphic.status.attention },
),
messageEffect = messageEffect,
buttonsUM = persistentListOf(
TangemMessageButtonUM(
text = resourceReference(R.string.hw_activation_need_finish),
type = TangemButtonType.PrimaryInverse,
onClick = onClick,
),
),
),
type = when (messageEffect) {
TangemMessageEffect.Card -> WalletNotificationType.Critical
else -> WalletNotificationType.Warning
},
)
data class PushNotifications(
val onCloseClick: () -> Unit,
val onEnabledClick: () -> Unit,
) : WalletNotificationUM(
messageUM = TangemMessageUM(
id = "PushNotificationsNotification",
title = resourceReference(R.string.user_push_notification_banner_title),
subtitle = resourceReference(R.string.user_push_notification_banner_subtitle),
onCloseClick = onCloseClick,
messageEffect = TangemMessageEffect.Card,
buttonsUM = persistentListOf(
TangemMessageButtonUM(
text = resourceReference(R.string.common_later),
type = TangemButtonType.PrimaryInverse,
onClick = onCloseClick,
),
TangemMessageButtonUM(
text = resourceReference(R.string.common_enable),
type = TangemButtonType.Primary,
onClick = onEnabledClick,
),
),
),
type = WalletNotificationType.Informational,
)
data class CloreMigration(
val onStartMigrationClick: () -> Unit,
) : WalletNotificationUM(
messageUM = TangemMessageUM(
id = "CloreMigrationNotification",
title = resourceReference(com.tangem.core.res.R.string.warning_clore_migration_title),
subtitle = resourceReference(com.tangem.core.res.R.string.warning_clore_migration_description),
iconUM = TangemIconUM.Icon(
iconRes = R.drawable.ic_attention_default_24,
tintReference = { TangemTheme.colors2.graphic.status.attention },
),
messageEffect = TangemMessageEffect.None,
buttonsUM = persistentListOf(
TangemMessageButtonUM(
text = resourceReference(com.tangem.core.res.R.string.warning_clore_migration_button),
onClick = onStartMigrationClick,
type = TangemButtonType.PrimaryInverse,
),
),
),
type = WalletNotificationType.Informational,
)
data class OnePlusOnePromo(
val onCloseClick: () -> Unit,
val onClick: () -> Unit,
) : WalletNotificationUM(
messageUM = TangemMessageUM(
id = "OnePlusOnePromoNotification",
title = resourceReference(R.string.notification_one_plus_one_title),
subtitle = resourceReference(R.string.notification_one_plus_one_text),
messageEffect = TangemMessageEffect.Magic,
buttonsUM = persistentListOf(
TangemMessageButtonUM(
text = resourceReference(R.string.notification_one_plus_one_button),
type = TangemButtonType.PrimaryInverse,
onClick = onCloseClick,
),
),
),
type = WalletNotificationType.Promo,
)
data class YieldPromo(
val onCloseClick: () -> Unit,
val onTermsAndConditionsClick: () -> Unit,
) : WalletNotificationUM(
messageUM = TangemMessageUM(
id = "YieldPromoNotification",
title = resourceReference(R.string.notification_yield_promo_title),
subtitle = resourceReference(R.string.notification_yield_promo_text),
onCloseClick = onCloseClick,
messageEffect = TangemMessageEffect.Magic,
buttonsUM = persistentListOf(
TangemMessageButtonUM(
text = resourceReference(R.string.notification_yield_promo_button),
type = TangemButtonType.Primary,
onClick = onTermsAndConditionsClick,
),
),
),
type = WalletNotificationType.Promo,
)
}

View file

@ -9,6 +9,7 @@ internal data class WalletScreenState(
val topBarConfig: WalletTopBarConfig,
val selectedWalletIndex: Int,
val wallets: ImmutableList<WalletState>,
val wallets2: ImmutableList<WalletUM>,
val onWalletChange: (index: Int, onlyState: Boolean) -> Unit,
val event: StateEvent<WalletEvent>,
val isHidingMode: Boolean,

View file

@ -55,11 +55,6 @@ internal sealed interface WalletState : WalletStateHolder {
override val nftState: WalletNFTItemUM = WalletNFTItemUM.Hidden
override val tangemPayState: TangemPayState = TangemPayState.Empty
}
enum class WalletType {
Hot,
Cold,
}
}
sealed class SingleCurrency : WalletState, TxHistoryStateHolder {
@ -96,4 +91,9 @@ internal sealed interface WalletState : WalletStateHolder {
override val marketPriceBlockState: MarketPriceBlockState? = null
}
}
}
enum class WalletType {
Hot,
Cold,
}

View file

@ -0,0 +1,79 @@
package com.tangem.feature.wallet.presentation.wallet.state.model
import androidx.compose.runtime.Immutable
import com.tangem.core.ui.ds.button.TangemButtonUM
import com.tangem.core.ui.ds.row.TangemRowUM
import com.tangem.core.ui.ds.row.header.TangemHeaderRowUM
import com.tangem.core.ui.ds.row.token.TangemTokenRowUM
import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.persistentListOf
/**
* State of the tokens list in the wallet screen
*
* @property tokenList list of tokens to display
* @property organizeButtonUM configuration for the "Organize Tokens" button, if it should
*/
@Immutable
internal sealed class WalletTokensListUM {
abstract val tokenList: ImmutableList<TokensListItemUM2>
abstract val organizeButtonUM: TangemButtonUM?
data object Empty : WalletTokensListUM() {
override val tokenList: ImmutableList<TokensListItemUM2.Portfolio> = persistentListOf()
override val organizeButtonUM: TangemButtonUM? = null
}
data object Loading : WalletTokensListUM() {
override val tokenList: ImmutableList<TokensListItemUM2> = persistentListOf(
TokensListItemUM2.Portfolio(
tokenRowUM = TangemTokenRowUM.Loading(id = "0"),
tokenList = persistentListOf(),
isExpanded = false,
isCollapsable = true,
),
TokensListItemUM2.Portfolio(
tokenRowUM = TangemTokenRowUM.Loading(id = "1"),
tokenList = persistentListOf(),
isExpanded = false,
isCollapsable = true,
),
TokensListItemUM2.Portfolio(
tokenRowUM = TangemTokenRowUM.Loading(id = "2"),
tokenList = persistentListOf(),
isExpanded = false,
isCollapsable = true,
),
)
override val organizeButtonUM: TangemButtonUM? = null
}
data class Content(
override val tokenList: ImmutableList<TokensListItemUM2>,
override val organizeButtonUM: TangemButtonUM?,
) : WalletTokensListUM()
}
/**
* State of token list item in the wallet screen
*/
@Immutable
internal sealed interface TokensListItemUM2 {
val tokenRowUM: TangemRowUM
data class GroupTitle(
override val tokenRowUM: TangemHeaderRowUM,
) : TokensListItemUM2
data class Token(
override val tokenRowUM: TangemTokenRowUM,
) : TokensListItemUM2
data class Portfolio(
override val tokenRowUM: TangemTokenRowUM,
val tokenList: ImmutableList<TokensListItemUM2>,
val isExpanded: Boolean,
val isCollapsable: Boolean,
) : TokensListItemUM2
}

View file

@ -0,0 +1,50 @@
package com.tangem.feature.wallet.presentation.wallet.state.model
import androidx.compose.runtime.Immutable
import com.tangem.core.ui.components.containers.pullToRefresh.PullToRefreshConfig
import com.tangem.core.ui.ds.button.TangemButtonUM
import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.PersistentList
import kotlinx.collections.immutable.persistentListOf
@Immutable
internal sealed interface WalletUM {
val pullToRefreshConfig: PullToRefreshConfig
val walletsBalanceUM: WalletBalanceUM
val buttons: PersistentList<TangemButtonUM>
val notifications: ImmutableList<WalletNotificationUM>
val tokensListUM: WalletTokensListUM
val nftState: WalletNFTItemUM
val type: WalletType
val tangemPayState: TangemPayState
data class Content(
override val pullToRefreshConfig: PullToRefreshConfig,
override val walletsBalanceUM: WalletBalanceUM,
override val buttons: PersistentList<TangemButtonUM>,
override val notifications: ImmutableList<WalletNotificationUM>,
override val tokensListUM: WalletTokensListUM,
override val nftState: WalletNFTItemUM,
override val type: WalletType,
override val tangemPayState: TangemPayState,
val stackableNotifications: ImmutableList<WalletNotificationUM>,
) : WalletUM
data class Locked(
override val walletsBalanceUM: WalletBalanceUM,
override val buttons: PersistentList<TangemButtonUM>,
override val type: WalletType,
override val notifications: ImmutableList<WalletNotificationUM> = persistentListOf(),
) : WalletUM {
override val pullToRefreshConfig = PullToRefreshConfig(false, {})
override val tokensListUM: WalletTokensListUM = WalletTokensListUM.Empty // todo redesign main locked state
override val nftState: WalletNFTItemUM = WalletNFTItemUM.Hidden
override val tangemPayState: TangemPayState = TangemPayState.Empty
}
}

View file

@ -2,6 +2,7 @@ package com.tangem.feature.wallet.presentation.wallet.state.transformers
import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletUM
internal class CloseBottomSheetTransformer(userWalletId: UserWalletId) : WalletStateTransformer(userWalletId) {
@ -22,6 +23,10 @@ internal class CloseBottomSheetTransformer(userWalletId: UserWalletId) : WalletS
}
}
override fun transform(walletUM: WalletUM): WalletUM {
return walletUM // todo redesign main
}
private fun updateConfig(prevState: WalletState) = prevState.bottomSheetConfig?.copy(
isShown = false,
)

View file

@ -7,7 +7,6 @@ import com.tangem.feature.wallet.child.wallet.model.intents.WalletClickIntents
import com.tangem.feature.wallet.presentation.wallet.domain.WalletAdditionalInfoFactory
import com.tangem.feature.wallet.presentation.wallet.domain.WalletImageResolver
import com.tangem.feature.wallet.presentation.wallet.state.model.*
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletState.MultiCurrency.WalletType
import com.tangem.feature.wallet.presentation.wallet.state.utils.WalletLoadingStateFactory
import com.tangem.feature.wallet.presentation.wallet.state.utils.createStateByWalletType
import kotlinx.collections.immutable.PersistentList

View file

@ -4,6 +4,7 @@ import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfig
import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfigContent
import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletUM
internal class OpenBottomSheetTransformer(
userWalletId: UserWalletId,
@ -28,6 +29,10 @@ internal class OpenBottomSheetTransformer(
}
}
override fun transform(walletUM: WalletUM): WalletUM {
return walletUM // todo redesign main
}
private fun updateConfig() = TangemBottomSheetConfig(
isShown = true,
onDismissRequest = onDismissBottomSheet,

View file

@ -4,6 +4,7 @@ import com.tangem.domain.models.wallet.UserWallet
import com.tangem.feature.wallet.child.wallet.model.intents.WalletClickIntents
import com.tangem.feature.wallet.presentation.wallet.domain.WalletImageResolver
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletUM
import com.tangem.feature.wallet.presentation.wallet.state.utils.WalletLoadingStateFactory
/**
@ -26,6 +27,10 @@ internal class ReinitializeWalletTransformer(
)
}
override fun transform(walletUM: WalletUM): WalletUM {
return walletUM // todo redesign main
}
override fun transform(prevState: WalletState): WalletState {
return walletLoadingStateFactory.create(
userWallet = userWallet,

View file

@ -3,6 +3,7 @@ package com.tangem.feature.wallet.presentation.wallet.state.transformers
import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletNFTItemUM
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletUM
internal class RemoveNFTCollectionsTransformer(
userWalletId: UserWalletId,
@ -17,4 +18,8 @@ internal class RemoveNFTCollectionsTransformer(
is WalletState.SingleCurrency.Locked,
-> prevState
}
override fun transform(walletUM: WalletUM): WalletUM {
return walletUM // todo redesign main
}
}

View file

@ -8,6 +8,7 @@ import com.tangem.domain.tokens.model.TokenActionsState
import com.tangem.feature.wallet.child.wallet.model.intents.WalletClickIntents
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletManageButton
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletUM
import kotlinx.collections.immutable.PersistentList
import kotlinx.collections.immutable.toPersistentList
import timber.log.Timber
@ -35,6 +36,10 @@ internal class SetCryptoCurrencyActionsTransformer(
}
}
override fun transform(walletUM: WalletUM): WalletUM {
return walletUM // todo redesign main
}
private fun TokenActionsState.toManageButtons(): PersistentList<WalletManageButton> {
return states
.filterIfS2C()

View file

@ -10,6 +10,7 @@ import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.domain.onramp.model.cache.OnrampTransaction
import com.tangem.feature.wallet.child.wallet.model.intents.WalletClickIntents
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletUM
import com.tangem.feature.wallet.presentation.wallet.state.transformers.converter.SingleWalletOnrampTransactionConverter
import kotlinx.collections.immutable.toPersistentList
import timber.log.Timber
@ -56,6 +57,10 @@ internal class SetExpressStatusesTransformer(
}
}
override fun transform(walletUM: WalletUM): WalletUM {
return walletUM // todo redesign main
}
private fun TangemBottomSheetConfig.updateStateWithExpressStatusBottomSheet(
expressState: ExpressTransactionStateUM?,
): TangemBottomSheetConfig {

View file

@ -6,6 +6,7 @@ import com.tangem.domain.nft.models.NFTCollections
import com.tangem.domain.nft.models.allLoadedCollectionsEmpty
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletNFTItemUM
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletUM
import kotlinx.collections.immutable.toPersistentList
internal class SetNFTCollectionsTransformer(
@ -28,6 +29,10 @@ internal class SetNFTCollectionsTransformer(
-> prevState
}
override fun transform(walletUM: WalletUM): WalletUM {
return walletUM // todo redesign main
}
private fun createContentNFTItemUM(onItemClick: () -> Unit): WalletNFTItemUM.Content {
val collectionsContent = nftCollections
.map { it.content }

View file

@ -6,6 +6,7 @@ import com.tangem.domain.models.currency.CryptoCurrencyStatus
import com.tangem.domain.models.wallet.UserWallet
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletCardState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletUM
import com.tangem.feature.wallet.presentation.wallet.state.transformers.converter.SingleWalletCardStateConverter
import com.tangem.feature.wallet.presentation.wallet.state.transformers.converter.SingleWalletMarketPriceConverter
import timber.log.Timber
@ -35,6 +36,10 @@ internal class SetPrimaryCurrencyTransformer(
}
}
override fun transform(walletUM: WalletUM): WalletUM {
return walletUM // todo redesign main
}
private fun WalletCardState.toLoadedSingleCurrencyState(): WalletCardState {
return SingleWalletCardStateConverter(status.value, userWallet, appCurrency).convert(value = this)
}

View file

@ -5,6 +5,7 @@ import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletManageButton
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletTokensListState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletUM
import kotlinx.collections.immutable.PersistentList
import kotlinx.collections.immutable.mutate
@ -33,6 +34,10 @@ internal class SetRefreshStateTransformer(
}
}
override fun transform(walletUM: WalletUM): WalletUM {
return walletUM // todo redesign main
}
private fun PullToRefreshConfig.toUpdatedState(isRefreshing: Boolean): PullToRefreshConfig {
return copy(isRefreshing = isRefreshing)
}

View file

@ -10,6 +10,7 @@ import com.tangem.feature.wallet.presentation.wallet.domain.WalletAdditionalInfo
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletCardState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletTokensListState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletUM
import com.tangem.feature.wallet.presentation.wallet.state.utils.disableButtons
import timber.log.Timber
import java.math.BigDecimal
@ -51,6 +52,10 @@ internal class SetTokenListErrorTransformer(
}
}
override fun transform(walletUM: WalletUM): WalletUM {
return walletUM // todo redesign main
}
private fun WalletCardState.toLoadedState(): WalletCardState {
return WalletCardState.Content(
id = id,

View file

@ -8,6 +8,7 @@ import com.tangem.feature.wallet.child.wallet.model.intents.WalletClickIntents
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletCardState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletTokensListState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletUM
import com.tangem.feature.wallet.presentation.wallet.state.transformers.converter.MultiWalletCardStateConverter
import com.tangem.feature.wallet.presentation.wallet.state.transformers.converter.TokenListStateConverter
import com.tangem.feature.wallet.presentation.wallet.state.utils.enableButtons
@ -45,6 +46,10 @@ internal class SetTokenListTransformer(
}
}
override fun transform(walletUM: WalletUM): WalletUM {
return walletUM // todo redesign main
}
private fun WalletCardState.toLoadedState(): WalletCardState {
val fiatBalance = when (params) {
is TokenConverterParams.Account -> params.accountList.totalFiatBalance

View file

@ -9,6 +9,7 @@ import com.tangem.domain.models.wallet.UserWallet
import com.tangem.domain.txhistory.models.TxHistoryStateError
import com.tangem.feature.wallet.child.wallet.model.intents.WalletClickIntents
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletUM
import com.tangem.feature.wallet.presentation.wallet.state.transformers.converter.TxHistoryItemStateConverter
import kotlinx.collections.immutable.toImmutableList
import timber.log.Timber
@ -35,6 +36,10 @@ internal class SetTxHistoryCountErrorTransformer(
)
}
override fun transform(walletUM: WalletUM): WalletUM {
return walletUM // todo redesign main
}
override fun transform(prevState: WalletState): WalletState {
return when (prevState) {
is WalletState.SingleCurrency.Content -> prevState.copy(txHistoryState = createErrorState())

View file

@ -6,6 +6,7 @@ import com.tangem.core.ui.components.transactions.state.TxHistoryState
import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.feature.wallet.child.wallet.model.intents.WalletClickIntents
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletUM
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.update
import timber.log.Timber
@ -33,6 +34,10 @@ internal class SetTxHistoryCountTransformer(
}
}
override fun transform(walletUM: WalletUM): WalletUM {
return walletUM // todo redesign main
}
private fun TxHistoryState.toLoadingState(): TxHistoryState {
return if (this is TxHistoryState.Content) {
Timber.d("Load transactions history: $transactionsCount")

View file

@ -5,6 +5,7 @@ import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.domain.txhistory.models.TxHistoryListError
import com.tangem.feature.wallet.child.wallet.model.intents.WalletClickIntents
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletUM
import timber.log.Timber
internal class SetTxHistoryItemsErrorTransformer(
@ -27,6 +28,10 @@ internal class SetTxHistoryItemsErrorTransformer(
}
}
override fun transform(walletUM: WalletUM): WalletUM {
return walletUM // todo redesign main
}
private fun createErrorState(): TxHistoryState.Error = when (error) {
is TxHistoryListError.DataError -> {
TxHistoryState.Error(

View file

@ -6,6 +6,7 @@ import com.tangem.core.ui.components.transactions.state.TxHistoryState
import com.tangem.domain.models.wallet.UserWallet
import com.tangem.feature.wallet.child.wallet.model.intents.WalletClickIntents
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletUM
import com.tangem.feature.wallet.presentation.wallet.state.transformers.converter.TxHistoryItemFlowConverter
import kotlinx.coroutines.flow.Flow
import timber.log.Timber
@ -32,6 +33,10 @@ internal class SetTxHistoryItemsTransformer(
}
}
override fun transform(walletUM: WalletUM): WalletUM {
return walletUM // todo redesign main
}
private fun TxHistoryState.toContentState(): TxHistoryState {
val converter = TxHistoryItemFlowConverter(
currentState = this,

View file

@ -3,6 +3,7 @@ package com.tangem.feature.wallet.presentation.wallet.state.transformers
import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletNotification
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletUM
import kotlinx.collections.immutable.ImmutableList
import timber.log.Timber
@ -23,4 +24,8 @@ internal class SetWarningsTransformer(
}
}
}
override fun transform(walletUM: WalletUM): WalletUM {
return walletUM // todo redesign main
}
}

View file

@ -3,6 +3,7 @@ package com.tangem.feature.wallet.presentation.wallet.state.transformers
import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.feature.wallet.presentation.wallet.state.model.TangemPayState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletUM
internal class TangemPayExposedDeviceTransformer(
userWalletId: UserWalletId,
@ -14,4 +15,8 @@ internal class TangemPayExposedDeviceTransformer(
prevState
}
}
override fun transform(walletUM: WalletUM): WalletUM {
return walletUM // todo redesign main
}
}

View file

@ -3,6 +3,7 @@ package com.tangem.feature.wallet.presentation.wallet.state.transformers
import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.feature.wallet.presentation.wallet.state.model.TangemPayState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletUM
internal class TangemPayHiddenStateTransformer(
userWalletId: UserWalletId,
@ -15,4 +16,8 @@ internal class TangemPayHiddenStateTransformer(
prevState
}
}
override fun transform(walletUM: WalletUM): WalletUM {
return walletUM // todo redesign main
}
}

View file

@ -3,6 +3,7 @@ package com.tangem.feature.wallet.presentation.wallet.state.transformers
import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.feature.wallet.presentation.wallet.state.model.TangemPayState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletUM
internal class TangemPayHideOnboardingStateTransformer(
userWalletId: UserWalletId,
@ -15,4 +16,8 @@ internal class TangemPayHideOnboardingStateTransformer(
prevState
}
}
override fun transform(walletUM: WalletUM): WalletUM {
return walletUM // todo redesign main
}
}

View file

@ -3,6 +3,7 @@ package com.tangem.feature.wallet.presentation.wallet.state.transformers
import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.feature.wallet.presentation.wallet.state.model.TangemPayState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletUM
internal class TangemPayLoadingStateTransformer(userWalletId: UserWalletId) : WalletStateTransformer(userWalletId) {
override fun transform(prevState: WalletState): WalletState {
@ -12,4 +13,8 @@ internal class TangemPayLoadingStateTransformer(userWalletId: UserWalletId) : Wa
prevState
}
}
override fun transform(walletUM: WalletUM): WalletUM {
return walletUM // todo redesign main
}
}

View file

@ -3,6 +3,7 @@ package com.tangem.feature.wallet.presentation.wallet.state.transformers
import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.feature.wallet.presentation.wallet.state.model.TangemPayState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletUM
internal class TangemPayOnboardingBannerStateTransformer(
userWalletId: UserWalletId,
@ -22,4 +23,8 @@ internal class TangemPayOnboardingBannerStateTransformer(
prevState
}
}
override fun transform(walletUM: WalletUM): WalletUM {
return walletUM // todo redesign main
}
}

View file

@ -7,6 +7,7 @@ import com.tangem.feature.wallet.impl.R
import com.tangem.feature.wallet.presentation.wallet.state.model.TangemPayState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletNotification.Warning.TangemPayRefreshNeeded
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletUM
internal class TangemPayRefreshNeededStateTransformer(
userWalletId: UserWalletId,
@ -32,4 +33,8 @@ internal class TangemPayRefreshNeededStateTransformer(
prevState
}
}
override fun transform(walletUM: WalletUM): WalletUM {
return walletUM // todo redesign main
}
}

View file

@ -4,6 +4,7 @@ import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.feature.wallet.presentation.wallet.state.model.TangemPayState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletNotification
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletUM
internal class TangemPayRefreshShowProgressTransformer(
userWalletId: UserWalletId,
@ -21,4 +22,8 @@ internal class TangemPayRefreshShowProgressTransformer(
),
)
}
override fun transform(walletUM: WalletUM): WalletUM {
return walletUM // todo redesign main
}
}

View file

@ -4,6 +4,7 @@ import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.feature.wallet.presentation.wallet.state.model.TangemPayState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletNotification
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletUM
internal class TangemPayUnavailableStateTransformer(
userWalletId: UserWalletId,
@ -20,4 +21,8 @@ internal class TangemPayUnavailableStateTransformer(
prevState
}
}
override fun transform(walletUM: WalletUM): WalletUM {
return walletUM // todo redesign main
}
}

View file

@ -18,6 +18,7 @@ import com.tangem.feature.wallet.presentation.wallet.state.model.TangemPayState.
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletState
import com.tangem.domain.pay.model.CustomerInfo.KycStatus.APPROVED
import com.tangem.domain.pay.model.CustomerInfo
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletUM
import java.util.Currency
/**
@ -42,6 +43,10 @@ internal class TangemPayUpdateInfoStateTransformer(
}
}
override fun transform(walletUM: WalletUM): WalletUM {
return walletUM // todo redesign main
}
private fun createInitialState(): TangemPayState {
val cardInfo = value.info.cardInfo
val productInstance = value.info.productInstance

View file

@ -2,6 +2,7 @@ package com.tangem.feature.wallet.presentation.wallet.state.transformers
import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletUM
import com.tangem.feature.wallet.presentation.wallet.state.utils.showSwapBadge
internal class UpdateMultiWalletActionButtonBadgeTransformer(
@ -16,4 +17,8 @@ internal class UpdateMultiWalletActionButtonBadgeTransformer(
else -> prevState
}
}
override fun transform(walletUM: WalletUM): WalletUM {
return walletUM // todo redesign main
}
}

View file

@ -6,6 +6,7 @@ import com.tangem.feature.wallet.presentation.wallet.domain.WalletAdditionalInfo
import com.tangem.feature.wallet.presentation.wallet.domain.WalletImageResolver
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletCardState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletUM
import timber.log.Timber
internal class UpdateWalletCardsCountTransformer(
@ -30,6 +31,10 @@ internal class UpdateWalletCardsCountTransformer(
}
}
override fun transform(walletUM: WalletUM): WalletUM {
return walletUM // todo redesign main
}
private fun WalletCardState.toUpdatedState(): WalletCardState {
return when (this) {
is WalletCardState.Content -> copy(

View file

@ -3,6 +3,7 @@ package com.tangem.feature.wallet.presentation.wallet.state.transformers
import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletScreenState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletUM
import kotlinx.collections.immutable.toImmutableList
internal abstract class WalletStateTransformer(
@ -11,6 +12,8 @@ internal abstract class WalletStateTransformer(
abstract fun transform(prevState: WalletState): WalletState
abstract fun transform(walletUM: WalletUM): WalletUM
final override fun transform(prevState: WalletScreenState): WalletScreenState {
return prevState.copy(
wallets = prevState.wallets
@ -18,6 +21,11 @@ internal abstract class WalletStateTransformer(
if (state.walletCardState.id == userWalletId) transform(state) else state
}
.toImmutableList(),
wallets2 = prevState.wallets2
.map { walletUM ->
if (walletUM.walletsBalanceUM.id == userWalletId) transform(walletUM) else walletUM
}
.toImmutableList(),
)
}
}

View file

@ -52,7 +52,7 @@ internal class WalletLoadingStateFactory(
bottomSheetConfig = null,
tokensListState = WalletTokensListState.ContentState.Loading,
nftState = WalletNFTItemUM.Hidden,
type = WalletState.MultiCurrency.WalletType.Hot,
type = WalletType.Hot,
tangemPayState = TangemPayState.Empty,
)
}
@ -66,7 +66,7 @@ internal class WalletLoadingStateFactory(
bottomSheetConfig = null,
tokensListState = WalletTokensListState.ContentState.Loading,
nftState = WalletNFTItemUM.Hidden,
type = WalletState.MultiCurrency.WalletType.Cold,
type = WalletType.Cold,
tangemPayState = TangemPayState.Empty,
)
}