Updated on 2026-08-14

This commit is contained in:
Tangem 2026-02-26 19:50:01 +04:00
parent 4acd7ce3b2
commit 04a21de3b6
13 changed files with 48 additions and 118 deletions

View file

@ -1,12 +1,6 @@
package com.tangem.features.send.v2
import com.tangem.core.configtoggle.feature.FeatureTogglesManager
import com.tangem.features.send.v2.api.SendFeatureToggles
import javax.inject.Inject
internal class DefaultSendFeatureToggles @Inject constructor(
private val featureTogglesManager: FeatureTogglesManager,
) : SendFeatureToggles {
override val isGaslessTransactionsEnabled: Boolean
get() = featureTogglesManager.isFeatureEnabled("GASLESS_TRANSACTIONS_ENABLED")
}
internal class DefaultSendFeatureToggles @Inject constructor() : SendFeatureToggles

View file

@ -14,7 +14,6 @@ import com.tangem.core.decompose.model.getOrCreateModel
import com.tangem.core.ui.extensions.conditional
import com.tangem.features.send.v2.api.FeeSelectorBlockComponent
import com.tangem.features.send.v2.api.FeeSelectorComponent
import com.tangem.features.send.v2.api.SendFeatureToggles
import com.tangem.features.send.v2.api.entity.FeeSelectorUM
import com.tangem.features.send.v2.api.params.FeeSelectorParams
import com.tangem.features.send.v2.feeselector.model.FeeSelectorBlockModel
@ -32,7 +31,6 @@ internal class DefaultFeeSelectorBlockComponent @AssistedInject constructor(
@Assisted private val params: FeeSelectorParams.FeeSelectorBlockParams,
@Assisted onResult: (feeSelectorUM: FeeSelectorUM) -> Unit,
private val feeSelectorComponentFactory: FeeSelectorComponent.Factory,
private val sendFeatureToggles: SendFeatureToggles,
) : FeeSelectorBlockComponent, AppComponentContext by appComponentContext {
private val model: FeeSelectorBlockModel = getOrCreateModel(params = params)
@ -91,7 +89,6 @@ internal class DefaultFeeSelectorBlockComponent @AssistedInject constructor(
FeeSelectorBlockContent(
state = state,
onReadMoreClick = model::onReadMoreClicked,
isGaslessFeatureEnabled = sendFeatureToggles.isGaslessTransactionsEnabled,
modifier = modifier
.conditional(isScreenSource && (isNotSingleFee || isGaslessAvailable)) {
Modifier.clickable {

View file

@ -19,7 +19,6 @@ import com.tangem.domain.transaction.usecase.IsFeeApproximateUseCase
import com.tangem.domain.transaction.usecase.gasless.GetAvailableFeeTokensUseCase
import com.tangem.domain.transaction.usecase.gasless.IsGaslessFeeSupportedForNetwork
import com.tangem.domain.wallets.usecase.GetUserWalletUseCase
import com.tangem.features.send.v2.api.SendFeatureToggles
import com.tangem.features.send.v2.api.analytics.CommonSendAnalyticEvents.NonceInserted
import com.tangem.features.send.v2.api.entity.FeeItem
import com.tangem.features.send.v2.api.entity.FeeNonce
@ -59,7 +58,6 @@ internal class FeeSelectorLogic @AssistedInject constructor(
private val getSingleCryptoCurrencyStatusUseCase: GetSingleCryptoCurrencyStatusUseCase,
private val getUserWalletUseCase: GetUserWalletUseCase,
private val getAvailableFeeTokensUseCase: GetAvailableFeeTokensUseCase,
sendFeatureToggles: SendFeatureToggles,
isGaslessFeeSupportedForNetwork: IsGaslessFeeSupportedForNetwork,
) : FeeSelectorIntents {
@ -67,8 +65,7 @@ internal class FeeSelectorLogic @AssistedInject constructor(
private val loadFeeJobHolder = JobHolder()
val uiState = MutableStateFlow(params.state)
val isGaslessEnabled = sendFeatureToggles.isGaslessTransactionsEnabled &&
params.onLoadFeeExtended != null &&
val isGaslessEnabled = params.onLoadFeeExtended != null &&
isGaslessFeeSupportedForNetwork(params.feeCryptoCurrencyStatus.currency.network) &&
params.cryptoCurrencyStatus.currency is CryptoCurrency.Token
@ -227,7 +224,7 @@ internal class FeeSelectorLogic @AssistedInject constructor(
},
)
},
ifLeft = { feeError ->
ifLeft = { _ ->
feeSelectorCheckReloadTrigger.callbackCheckResult(false)
feeSelectorAlertFactory.getFeeUnreachableErrorState { loadFee(isReload = true) }
},

View file

@ -57,7 +57,6 @@ private const val READ_MORE_TAG = "READ_MORE"
@Composable
internal fun FeeSelectorBlockContent(
state: FeeSelectorUM,
isGaslessFeatureEnabled: Boolean,
onReadMoreClick: () -> Unit,
modifier: Modifier = Modifier,
) {
@ -80,25 +79,16 @@ internal fun FeeSelectorBlockContent(
contentDescription = null,
tint = TangemTheme.colors.icon.accent,
)
FeeSelectorDescription(
state = state,
isGaslessFeatureEnabled = isGaslessFeatureEnabled,
onReadMoreClick = onReadMoreClick,
)
FeeSelectorDescription(state = state, onReadMoreClick = onReadMoreClick)
}
}
@Composable
private fun FeeSelectorDescription(
state: FeeSelectorUM,
isGaslessFeatureEnabled: Boolean,
onReadMoreClick: () -> Unit,
modifier: Modifier = Modifier,
) {
private fun FeeSelectorDescription(state: FeeSelectorUM, onReadMoreClick: () -> Unit, modifier: Modifier = Modifier) {
Row(modifier = modifier, horizontalArrangement = Arrangement.SpaceBetween) {
FeeSelectorStaticPart(modifier = Modifier.weight(1f), onReadMoreClick = onReadMoreClick)
when (state) {
is FeeSelectorUM.Content -> FeeContent(state, isGaslessFeatureEnabled)
is FeeSelectorUM.Content -> FeeContent(state)
is FeeSelectorUM.Loading -> FeeLoading()
is FeeSelectorUM.Error -> FeeError()
}
@ -181,17 +171,15 @@ private fun FeeLoading() {
}
@Composable
private fun FeeContent(state: FeeSelectorUM.Content, isGaslessFeatureEnabled: Boolean, modifier: Modifier = Modifier) {
private fun FeeContent(state: FeeSelectorUM.Content, modifier: Modifier = Modifier) {
val fiatRate = state.feeFiatRateUM
Row(modifier = modifier, verticalAlignment = Alignment.CenterVertically) {
if (isGaslessFeatureEnabled) {
AuditLabel(
state = AuditLabelUM(
text = stringReference(state.selectedFeeItem.fee.amount.currencySymbol),
type = AuditLabelUM.Type.General,
),
)
}
AuditLabel(
state = AuditLabelUM(
text = stringReference(state.selectedFeeItem.fee.amount.currencySymbol),
type = AuditLabelUM.Type.General,
),
)
EllipsisText(
text = if (state.feeExtraInfo.isFeeConvertibleToFiat && fiatRate != null) {
@ -218,7 +206,7 @@ private fun FeeContent(state: FeeSelectorUM.Content, isGaslessFeatureEnabled: Bo
.testTag(FeeSelectorBlockTestTags.FEE_AMOUNT),
)
val isGaslessAvailable = isGaslessFeatureEnabled && state.feeExtraInfo.transactionFeeExtended != null
val isGaslessAvailable = state.feeExtraInfo.transactionFeeExtended != null
if (!state.feeItems.isSingleItem() || isGaslessAvailable) {
Icon(
@ -240,7 +228,6 @@ private fun FeeSelectorBlockContent_Preview(@PreviewParameter(FeeSelectorUMProvi
TangemThemePreview {
FeeSelectorBlockContent(
modifier = Modifier.fillMaxWidth(),
isGaslessFeatureEnabled = true,
state = state,
onReadMoreClick = {},
)