Updated on 2026-08-14
This commit is contained in:
parent
ef2cb2ce43
commit
8a840fe5f0
7 changed files with 44 additions and 5 deletions
|
|
@ -194,6 +194,7 @@
|
|||
<string name="exchange_tokens_available_tokens_header">Мои токены</string>
|
||||
<string name="exchange_tokens_empty_tokens">У вас нет добавленных токенов. Добавьте токены для обмена</string>
|
||||
<string name="exchange_tokens_unavailable_tokens_header">Недоступен для обмена с %s</string>
|
||||
<string name="express_cex_fee_explanation">Кроме того, в курс обмена включена комиссия сети за отправку обмененных средств на ваш адрес</string>
|
||||
<string name="express_cex_status_button_title">Статус</string>
|
||||
<string name="express_choose_providers_subtitle">Провайдеры проводят транзакции, обеспечивая плавный и эффективный обмен токенами</string>
|
||||
<string name="express_choose_providers_title">Выберите провайдера</string>
|
||||
|
|
|
|||
|
|
@ -193,6 +193,7 @@
|
|||
<string name="exchange_tokens_available_tokens_header">My tokens</string>
|
||||
<string name="exchange_tokens_empty_tokens">You haven\'t added any tokens yet. Add tokens via Market to swap</string>
|
||||
<string name="exchange_tokens_unavailable_tokens_header">Cannot be swapped for %s</string>
|
||||
<string name="express_cex_fee_explanation">Additionally, the network fee for sending the exchanged funds back to your address is included in the rate</string>
|
||||
<string name="express_cex_status_button_title">Status</string>
|
||||
<string name="express_choose_providers_subtitle">Providers facilitate transactions, ensuring smooth and efficient token swaps</string>
|
||||
<string name="express_choose_providers_title">Choose provider</string>
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ sealed class FeeItemState {
|
|||
val amountCrypto: String,
|
||||
val symbolCrypto: String,
|
||||
val amountFiatFormatted: String,
|
||||
val explanation: TextReference?,
|
||||
val isClickable: Boolean,
|
||||
val onClick: () -> Unit,
|
||||
) : FeeItemState()
|
||||
|
|
|
|||
|
|
@ -109,6 +109,7 @@ private fun ChooseFeeBottomSheetContent_Preview() {
|
|||
amountCrypto = "1000",
|
||||
symbolCrypto = "MATIC",
|
||||
amountFiatFormatted = "(10$)",
|
||||
explanation = null,
|
||||
isClickable = false,
|
||||
onClick = {},
|
||||
),
|
||||
|
|
@ -118,6 +119,7 @@ private fun ChooseFeeBottomSheetContent_Preview() {
|
|||
amountCrypto = "2000",
|
||||
symbolCrypto = "MATIC",
|
||||
amountFiatFormatted = "(10$)",
|
||||
explanation = null,
|
||||
isClickable = false,
|
||||
onClick = {},
|
||||
),
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ package com.tangem.feature.swap.ui
|
|||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material3.Divider
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
|
|
@ -24,12 +26,13 @@ fun FeeItemBlock(state: FeeItemState) {
|
|||
|
||||
@Composable
|
||||
fun FeeItem(state: FeeItemState.Content) {
|
||||
Box(
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.background(
|
||||
color = TangemTheme.colors.background.action,
|
||||
shape = TangemTheme.shapes.roundedCornersXMedium,
|
||||
)
|
||||
.padding(start = TangemTheme.dimens.spacing12)
|
||||
.clip(shape = TangemTheme.shapes.roundedCornersXMedium)
|
||||
.clickable(
|
||||
onClick = state.onClick,
|
||||
|
|
@ -40,13 +43,32 @@ fun FeeItem(state: FeeItemState.Content) {
|
|||
val description = "${state.amountCrypto} ${state.symbolCrypto} (${state.amountFiatFormatted})"
|
||||
SimpleActionRow(
|
||||
modifier = Modifier.padding(
|
||||
start = TangemTheme.dimens.spacing12,
|
||||
top = TangemTheme.dimens.spacing12,
|
||||
),
|
||||
title = state.title.resolveReference(),
|
||||
description = description,
|
||||
isClickable = state.isClickable,
|
||||
)
|
||||
state.explanation?.let {
|
||||
Divider(
|
||||
color = TangemTheme.colors.stroke.primary,
|
||||
thickness = TangemTheme.dimens.size0_5,
|
||||
modifier = Modifier.padding(
|
||||
top = TangemTheme.dimens.spacing10,
|
||||
bottom = TangemTheme.dimens.spacing10,
|
||||
end = TangemTheme.dimens.spacing2,
|
||||
),
|
||||
)
|
||||
Text(
|
||||
text = it.resolveReference(),
|
||||
style = TangemTheme.typography.caption2,
|
||||
color = TangemTheme.colors.text.tertiary,
|
||||
modifier = Modifier.padding(
|
||||
bottom = TangemTheme.dimens.spacing10,
|
||||
end = TangemTheme.dimens.spacing16,
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -59,6 +81,10 @@ private fun FeeItemPreview() {
|
|||
amountCrypto = "1000",
|
||||
symbolCrypto = "MATIC",
|
||||
amountFiatFormatted = "(1000$)",
|
||||
explanation = stringReference(
|
||||
"Additionally, the network fee for sending the exchanged funds back to your address is " +
|
||||
"included in the rate",
|
||||
),
|
||||
isClickable = false,
|
||||
onClick = {},
|
||||
)
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ internal class StateBuilder(
|
|||
if (uiStateHolder.sendCardData !is SwapCardState.SwapCardData) return uiStateHolder
|
||||
if (uiStateHolder.receiveCardData !is SwapCardState.SwapCardData) return uiStateHolder
|
||||
val warnings = getWarningsForSuccessState(quoteModel, fromToken)
|
||||
val feeState = createFeeState(quoteModel.txFee, selectedFeeType)
|
||||
val feeState = createFeeState(quoteModel.txFee, selectedFeeType, swapProvider)
|
||||
val fromCurrencyStatus = quoteModel.fromTokenInfo.cryptoCurrencyStatus
|
||||
val toCurrencyStatus = quoteModel.toTokenInfo.cryptoCurrencyStatus
|
||||
return uiStateHolder.copy(
|
||||
|
|
@ -666,7 +666,7 @@ internal class StateBuilder(
|
|||
)
|
||||
}
|
||||
|
||||
private fun createFeeState(txFeeState: TxFeeState, feeType: FeeType): FeeItemState {
|
||||
private fun createFeeState(txFeeState: TxFeeState, feeType: FeeType, swapProvider: SwapProvider): FeeItemState {
|
||||
val isClickable: Boolean
|
||||
val fee = when (txFeeState) {
|
||||
TxFeeState.Empty -> return FeeItemState.Empty
|
||||
|
|
@ -692,6 +692,11 @@ internal class StateBuilder(
|
|||
title = resourceReference(R.string.common_fee_label),
|
||||
amountCrypto = fee.feeCryptoFormatted,
|
||||
symbolCrypto = fee.cryptoSymbol,
|
||||
explanation = if (swapProvider.type == ExchangeProviderType.CEX) {
|
||||
resourceReference(R.string.express_cex_fee_explanation)
|
||||
} else {
|
||||
null
|
||||
},
|
||||
amountFiatFormatted = fee.feeFiatFormatted,
|
||||
isClickable = isClickable,
|
||||
onClick = actions.onClickFee,
|
||||
|
|
@ -1002,6 +1007,7 @@ internal class StateBuilder(
|
|||
amountCrypto = this.normalFee.feeCryptoFormatted,
|
||||
symbolCrypto = this.normalFee.cryptoSymbol,
|
||||
amountFiatFormatted = this.normalFee.feeFiatFormatted,
|
||||
explanation = null,
|
||||
isClickable = true,
|
||||
onClick = {},
|
||||
),
|
||||
|
|
@ -1011,6 +1017,7 @@ internal class StateBuilder(
|
|||
amountCrypto = this.priorityFee.feeCryptoFormatted,
|
||||
symbolCrypto = this.priorityFee.cryptoSymbol,
|
||||
amountFiatFormatted = this.priorityFee.feeFiatFormatted,
|
||||
explanation = null,
|
||||
isClickable = true,
|
||||
onClick = {},
|
||||
),
|
||||
|
|
|
|||
|
|
@ -467,13 +467,14 @@ private val state = SwapStateHolder(
|
|||
amountCrypto = "100",
|
||||
symbolCrypto = "1000",
|
||||
amountFiatFormatted = "(100)",
|
||||
explanation = null,
|
||||
isClickable = true,
|
||||
onClick = {},
|
||||
),
|
||||
warnings = listOf(
|
||||
SwapWarning.PermissionNeeded(
|
||||
notificationConfig = NotificationConfig(
|
||||
title = stringReference("Give Premission"),
|
||||
title = stringReference("Give Permission"),
|
||||
subtitle = stringReference("To continue swapping you need to give permission to Tangem"),
|
||||
iconResId = R.drawable.ic_locked_24,
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue