Updated on 2026-08-14
This commit is contained in:
parent
042df9828f
commit
7efaa64460
10 changed files with 20 additions and 10 deletions
|
|
@ -18,6 +18,7 @@ sealed class DestinationUM {
|
|||
val isValidating: Boolean = false,
|
||||
val isInitialized: Boolean = false,
|
||||
val isRedesignEnabled: Boolean = false,
|
||||
val isRecentHidden: Boolean,
|
||||
) : DestinationUM()
|
||||
|
||||
data class Empty(
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ internal class SendDestinationInitialStateTransformer(
|
|||
networkName = cryptoCurrency.network.name,
|
||||
isValidating = false,
|
||||
isRedesignEnabled = isRedesignEnabled,
|
||||
isRecentHidden = false,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -2,9 +2,9 @@ package com.tangem.features.send.v2.subcomponents.destination.model.transformers
|
|||
|
||||
import com.tangem.domain.models.currency.CryptoCurrency
|
||||
import com.tangem.domain.models.network.TxInfo
|
||||
import com.tangem.features.send.v2.api.subcomponents.destination.entity.DestinationUM
|
||||
import com.tangem.features.send.v2.subcomponents.destination.model.converters.SendRecipientHistoryListConverter
|
||||
import com.tangem.features.send.v2.subcomponents.destination.model.converters.SendRecipientWalletListConverter
|
||||
import com.tangem.features.send.v2.api.subcomponents.destination.entity.DestinationUM
|
||||
import com.tangem.features.send.v2.subcomponents.destination.ui.state.DestinationWalletUM
|
||||
import com.tangem.utils.transformer.Transformer
|
||||
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ internal class SendDestinationValidationResultTransformer(
|
|||
wallets = state.wallets.map { wallet ->
|
||||
wallet.copy(isVisible = !isValidAddress && (wallet.isLoading || wallet.title != TextReference.EMPTY))
|
||||
}.toPersistentList(),
|
||||
isRecentHidden = isValidAddress,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -211,6 +211,7 @@ private class DestinationBlockPreviewProvider : PreviewParameterProvider<Destina
|
|||
isValidating = false,
|
||||
isInitialized = true,
|
||||
isRedesignEnabled = false,
|
||||
isRecentHidden = false,
|
||||
)
|
||||
|
||||
override val values: Sequence<DestinationUM.Content>
|
||||
|
|
|
|||
|
|
@ -25,12 +25,12 @@ import com.tangem.core.ui.components.containers.FooterContainer
|
|||
import com.tangem.core.ui.components.inputrow.InputRowRecipient
|
||||
import com.tangem.core.ui.extensions.*
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.features.send.v2.impl.R
|
||||
import com.tangem.features.send.v2.subcomponents.destination.analytics.EnterAddressSource
|
||||
import com.tangem.features.send.v2.subcomponents.destination.model.SendDestinationClickIntents
|
||||
import com.tangem.features.send.v2.api.subcomponents.destination.entity.DestinationRecipientListUM
|
||||
import com.tangem.features.send.v2.api.subcomponents.destination.entity.DestinationTextFieldUM
|
||||
import com.tangem.features.send.v2.api.subcomponents.destination.entity.DestinationUM
|
||||
import com.tangem.features.send.v2.impl.R
|
||||
import com.tangem.features.send.v2.subcomponents.destination.analytics.EnterAddressSource
|
||||
import com.tangem.features.send.v2.subcomponents.destination.model.SendDestinationClickIntents
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
|
||||
private const val ADDRESS_FIELD_KEY = "ADDRESS_FIELD_KEY"
|
||||
|
|
@ -74,13 +74,14 @@ internal fun SendDestinationContent(
|
|||
)
|
||||
listHeaderItem(
|
||||
titleRes = R.string.send_recipient_wallets_title,
|
||||
isVisible = wallets.isNotEmpty() && wallets.first().isVisible,
|
||||
isVisible = wallets.isNotEmpty() && wallets.first().isVisible && !state.isRecentHidden,
|
||||
isFirst = true,
|
||||
)
|
||||
listItem(
|
||||
list = wallets,
|
||||
isLast = recipients.any { !it.isVisible },
|
||||
isBalanceHidden = isBalanceHidden,
|
||||
isRecentHidden = state.isRecentHidden,
|
||||
onClick = { title ->
|
||||
clickIntents.onRecipientAddressValueChange(
|
||||
title,
|
||||
|
|
@ -90,13 +91,14 @@ internal fun SendDestinationContent(
|
|||
)
|
||||
listHeaderItem(
|
||||
titleRes = R.string.send_recent_transactions,
|
||||
isVisible = recipients.isNotEmpty() && recipients.first().isVisible,
|
||||
isVisible = recipients.isNotEmpty() && recipients.first().isVisible && !state.isRecentHidden,
|
||||
isFirst = wallets.any { !it.isVisible },
|
||||
)
|
||||
listItem(
|
||||
list = recipients,
|
||||
isLast = true,
|
||||
isBalanceHidden = isBalanceHidden,
|
||||
isRecentHidden = state.isRecentHidden,
|
||||
onClick = { title ->
|
||||
clickIntents.onRecipientAddressValueChange(
|
||||
title,
|
||||
|
|
@ -257,6 +259,7 @@ private fun LazyListScope.listItem(
|
|||
list: ImmutableList<DestinationRecipientListUM>,
|
||||
isLast: Boolean,
|
||||
isBalanceHidden: Boolean,
|
||||
isRecentHidden: Boolean,
|
||||
onClick: (String) -> Unit,
|
||||
) {
|
||||
items(
|
||||
|
|
@ -267,7 +270,7 @@ private fun LazyListScope.listItem(
|
|||
val item = list[index]
|
||||
val title = item.title.resolveReference()
|
||||
|
||||
if (item.isVisible) {
|
||||
if (item.isVisible && !isRecentHidden) {
|
||||
ListItemWithIcon(
|
||||
title = title,
|
||||
subtitle = item.subtitle.orMaskWithStars(isBalanceHidden).resolveReference(),
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import com.tangem.domain.models.currency.CryptoCurrencyStatus
|
|||
import com.tangem.domain.models.wallet.UserWallet
|
||||
import com.tangem.domain.swap.models.SwapDirection
|
||||
import com.tangem.features.swap.v2.impl.amount.entity.SwapAmountUM
|
||||
import com.tangem.features.swap.v2.impl.sendviaswap.SendWithSwapRoute
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
|
||||
|
|
@ -32,7 +33,7 @@ internal sealed class SwapAmountComponentParams {
|
|||
override val filterProviderTypes: List<ExpressProviderType> = emptyList(),
|
||||
val title: TextReference,
|
||||
val callback: SwapAmountComponent.ModelCallback,
|
||||
val currentRoute: Flow<SwapAmountRoute>,
|
||||
val currentRoute: Flow<SendWithSwapRoute>,
|
||||
) : SwapAmountComponentParams()
|
||||
|
||||
data class AmountBlockParams(
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ import com.tangem.features.swap.v2.impl.amount.model.transformers.*
|
|||
import com.tangem.features.swap.v2.impl.chooseprovider.SwapChooseProviderComponent
|
||||
import com.tangem.features.swap.v2.impl.common.SwapAlertFactory
|
||||
import com.tangem.features.swap.v2.impl.common.entity.SwapQuoteUM
|
||||
import com.tangem.features.swap.v2.impl.sendviaswap.SendWithSwapRoute
|
||||
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
|
||||
import com.tangem.utils.coroutines.Debouncer
|
||||
import com.tangem.utils.coroutines.PeriodicTask
|
||||
|
|
@ -689,7 +690,7 @@ internal class SwapAmountModel @Inject constructor(
|
|||
flow = uiState,
|
||||
flow2 = params.currentRoute,
|
||||
transform = { state, route -> state to route },
|
||||
).onEach { (state, route) ->
|
||||
).filter { (_, route) -> route is SendWithSwapRoute.Amount }.onEach { (state, route) ->
|
||||
params.callback.onNavigationResult(
|
||||
NavigationUM.Content(
|
||||
title = resourceReference(R.string.common_amount),
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ internal class DefaultSendWithSwapComponent @AssistedInject constructor(
|
|||
params = SwapAmountComponentParams.AmountParams(
|
||||
amountUM = model.uiState.value.amountUM,
|
||||
title = resourceReference(R.string.common_send),
|
||||
currentRoute = model.currentRoute.filterIsInstance<SendWithSwapRoute.Amount>(),
|
||||
currentRoute = model.currentRoute,
|
||||
isBalanceHidingFlow = model.isBalanceHiddenFlow,
|
||||
analyticsCategoryName = model.analyticCategoryName,
|
||||
primaryCryptoCurrencyStatusFlow = model.primaryCryptoCurrencyStatusFlow,
|
||||
|
|
|
|||
|
|
@ -301,6 +301,7 @@ private fun SendWithSwapSuccessContent_Preview() {
|
|||
isValidating = false,
|
||||
isInitialized = false,
|
||||
isRedesignEnabled = false,
|
||||
isRecentHidden = false,
|
||||
),
|
||||
feeSelectorUM = FeeSelectorUM.Content(
|
||||
fees = TransactionFee.Single(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue