From 1d47d83d70a7a69eabfc58b78fa3e47fee56d2da Mon Sep 17 00:00:00 2001 From: Tangem Date: Thu, 7 Aug 2025 16:39:48 +0500 Subject: [PATCH] Updated on 2026-08-14 --- core/res/src/main/res/values-es/strings.xml | 4 +-- core/res/src/main/res/values/strings.xml | 1 + .../src/main/res/drawable/ic_warning_16.xml | 14 +++++++++ .../v2/impl/amount/entity/SwapAmountUM.kt | 1 + .../v2/impl/amount/model/SwapAmountModel.kt | 3 ++ .../SwapAmountPrimaryReadyStateTransformer.kt | 1 + ...wapAmountSecondaryReadyStateTransformer.kt | 1 + .../SwapAmountSelectQuoteTransformer.kt | 3 ++ .../SwapAmountSetQuotesTransformer.kt | 4 +++ .../impl/amount/ui/SwapAmountBlockContent.kt | 1 + .../ui/preview/SwapAmountContentPreview.kt | 2 ++ .../ui/SwapChooseProviderContent.kt | 31 +++++++++++++++++++ 12 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 core/ui/src/main/res/drawable/ic_warning_16.xml diff --git a/core/res/src/main/res/values-es/strings.xml b/core/res/src/main/res/values-es/strings.xml index 6f67b2c033..d075e7cd0c 100644 --- a/core/res/src/main/res/values-es/strings.xml +++ b/core/res/src/main/res/values-es/strings.xml @@ -1268,8 +1268,8 @@ Actualmente, MATIC está migrando a POL. Sin embargo, no se ha fijado ninguna fecha límite y MATIC aún no está obsoleto. Puede seguir usando el token MATIC de forma segura o utilizar intercambios para cambiarlo por POL. Migración de MATIC a POL - Use su tarjeta o anillo para obtener una dirección para la red - Use su tarjeta o anillo para obtener direcciónes para la red + Use su tarjeta o anillo para obtener una dirección para la red %d + Use su tarjeta o anillo para obtener direcciónes para las redes %d Faltan algunas direcciones La red no está disponible actualmente. Por favor, inténtalo de nuevo más tarde. diff --git a/core/res/src/main/res/values/strings.xml b/core/res/src/main/res/values/strings.xml index 039b9d2cdb..37c1670198 100644 --- a/core/res/src/main/res/values/strings.xml +++ b/core/res/src/main/res/values/strings.xml @@ -400,6 +400,7 @@ Provider Best rate FCA Warning List + Provider in FCA warning list Available up to %s Available from %s Unavailable for this pair diff --git a/core/ui/src/main/res/drawable/ic_warning_16.xml b/core/ui/src/main/res/drawable/ic_warning_16.xml new file mode 100644 index 0000000000..ff30f1ba7e --- /dev/null +++ b/core/ui/src/main/res/drawable/ic_warning_16.xml @@ -0,0 +1,14 @@ + + + + diff --git a/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/amount/entity/SwapAmountUM.kt b/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/amount/entity/SwapAmountUM.kt index 4c077efd90..147e318a85 100644 --- a/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/amount/entity/SwapAmountUM.kt +++ b/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/amount/entity/SwapAmountUM.kt @@ -48,6 +48,7 @@ internal sealed class SwapAmountUM { val swapCurrencies: SwapCurrencies, val swapQuotes: ImmutableList, val selectedQuote: SwapQuoteUM, + val showFCAWarning: Boolean, // extra data val appCurrency: AppCurrency?, diff --git a/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/amount/model/SwapAmountModel.kt b/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/amount/model/SwapAmountModel.kt index efc0561da2..62e938cd22 100644 --- a/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/amount/model/SwapAmountModel.kt +++ b/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/amount/model/SwapAmountModel.kt @@ -24,6 +24,7 @@ import com.tangem.domain.settings.usercountry.GetUserCountryUseCase import com.tangem.domain.settings.usercountry.models.UserCountry import com.tangem.domain.swap.models.SwapCurrencies import com.tangem.domain.notifications.ShouldShowNotificationUseCase +import com.tangem.domain.settings.usercountry.models.needApplyFCARestrictions import com.tangem.domain.swap.models.SwapDirection import com.tangem.domain.swap.models.SwapDirection.Companion.withSwapDirection import com.tangem.domain.swap.models.SwapQuoteModel @@ -150,6 +151,7 @@ internal class SwapAmountModel @Inject constructor( quoteUM = quoteUM, secondaryMaximumAmountBoundary = secondaryMaximumAmountBoundary, secondaryMinimumAmountBoundary = secondaryMinimumAmountBoundary, + needApplyFCARestrictions = userCountry.needApplyFCARestrictions(), ), ) } @@ -533,6 +535,7 @@ internal class SwapAmountModel @Inject constructor( secondaryMaximumAmountBoundary = secondaryMaximumAmountBoundary, secondaryMinimumAmountBoundary = secondaryMinimumAmountBoundary, isSilentReload = isSilentReload, + needApplyFcaRestrictions = userCountry.needApplyFCARestrictions(), ), ) diff --git a/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/amount/model/transformers/SwapAmountPrimaryReadyStateTransformer.kt b/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/amount/model/transformers/SwapAmountPrimaryReadyStateTransformer.kt index f6c07b51ce..3279e896ab 100644 --- a/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/amount/model/transformers/SwapAmountPrimaryReadyStateTransformer.kt +++ b/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/amount/model/transformers/SwapAmountPrimaryReadyStateTransformer.kt @@ -54,6 +54,7 @@ internal class SwapAmountPrimaryReadyStateTransformer( selectedQuote = SwapQuoteUM.Empty, appCurrency = appCurrency, showBestRateAnimation = showBestRateAnimation, + showFCAWarning = false, ) } } \ No newline at end of file diff --git a/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/amount/model/transformers/SwapAmountSecondaryReadyStateTransformer.kt b/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/amount/model/transformers/SwapAmountSecondaryReadyStateTransformer.kt index 729519512d..7a0a94e535 100644 --- a/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/amount/model/transformers/SwapAmountSecondaryReadyStateTransformer.kt +++ b/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/amount/model/transformers/SwapAmountSecondaryReadyStateTransformer.kt @@ -53,6 +53,7 @@ internal class SwapAmountSecondaryReadyStateTransformer( selectedQuote = SwapQuoteUM.Empty, appCurrency = appCurrency, showBestRateAnimation = showBestRateAnimation, + showFCAWarning = false, ) } } \ No newline at end of file diff --git a/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/amount/model/transformers/SwapAmountSelectQuoteTransformer.kt b/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/amount/model/transformers/SwapAmountSelectQuoteTransformer.kt index 7213bcb3c5..cd0df36880 100644 --- a/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/amount/model/transformers/SwapAmountSelectQuoteTransformer.kt +++ b/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/amount/model/transformers/SwapAmountSelectQuoteTransformer.kt @@ -11,6 +11,7 @@ import com.tangem.features.swap.v2.impl.amount.entity.SwapAmountUM import com.tangem.features.swap.v2.impl.amount.model.SwapAmountQuoteUtils.calculatePriceImpact import com.tangem.features.swap.v2.impl.amount.model.converter.SwapAmountErrorConverter import com.tangem.features.swap.v2.impl.common.entity.SwapQuoteUM +import com.tangem.features.swap.v2.impl.common.isRestrictedByFCA import com.tangem.utils.extensions.orZero import com.tangem.utils.transformer.Transformer @@ -18,6 +19,7 @@ internal class SwapAmountSelectQuoteTransformer( private val quoteUM: SwapQuoteUM, private val secondaryMaximumAmountBoundary: EnterAmountBoundary?, private val secondaryMinimumAmountBoundary: EnterAmountBoundary?, + private val needApplyFCARestrictions: Boolean, ) : Transformer { override fun transform(prevState: SwapAmountUM): SwapAmountUM { if (prevState !is SwapAmountUM.Content) return prevState @@ -29,6 +31,7 @@ internal class SwapAmountSelectQuoteTransformer( return prevState.copy( isPrimaryButtonEnabled = quoteUM is SwapQuoteUM.Content, selectedQuote = quoteUM, + showFCAWarning = needApplyFCARestrictions && quoteUM.provider?.isRestrictedByFCA() == true, primaryAmount = if (prevState.selectedAmountType == SwapAmountType.From) { val swapAmountField = prevState.primaryAmount as? SwapAmountFieldUM.Content val amountField = swapAmountField?.amountField as? AmountState.Data diff --git a/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/amount/model/transformers/SwapAmountSetQuotesTransformer.kt b/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/amount/model/transformers/SwapAmountSetQuotesTransformer.kt index a3f6263d18..b9d220ba0b 100644 --- a/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/amount/model/transformers/SwapAmountSetQuotesTransformer.kt +++ b/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/amount/model/transformers/SwapAmountSetQuotesTransformer.kt @@ -8,6 +8,7 @@ import com.tangem.domain.express.models.ExpressError import com.tangem.features.swap.v2.impl.amount.entity.SwapAmountUM import com.tangem.features.swap.v2.impl.common.entity.SwapQuoteUM import com.tangem.features.swap.v2.impl.common.entity.SwapQuoteUM.Content.DifferencePercent +import com.tangem.features.swap.v2.impl.common.isRestrictedByFCA import com.tangem.utils.StringsSigns import com.tangem.utils.extensions.isPositive import com.tangem.utils.transformer.Transformer @@ -20,6 +21,7 @@ internal class SwapAmountSetQuotesTransformer( private val secondaryMaximumAmountBoundary: EnterAmountBoundary?, private val secondaryMinimumAmountBoundary: EnterAmountBoundary?, private val isSilentReload: Boolean, + private val needApplyFcaRestrictions: Boolean, ) : Transformer { override fun transform(prevState: SwapAmountUM): SwapAmountUM { if (prevState !is SwapAmountUM.Content) return prevState @@ -36,6 +38,8 @@ internal class SwapAmountSetQuotesTransformer( quoteUM = selectedQuote, secondaryMaximumAmountBoundary = secondaryMaximumAmountBoundary, secondaryMinimumAmountBoundary = secondaryMinimumAmountBoundary, + needApplyFCARestrictions = needApplyFcaRestrictions && + selectedQuote.provider?.isRestrictedByFCA() == true, ) val updatedState = selectQuoteTransformer.transform(prevState = prevState) diff --git a/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/amount/ui/SwapAmountBlockContent.kt b/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/amount/ui/SwapAmountBlockContent.kt index e2a6522a74..f68cfcadc4 100644 --- a/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/amount/ui/SwapAmountBlockContent.kt +++ b/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/amount/ui/SwapAmountBlockContent.kt @@ -114,6 +114,7 @@ internal fun SwapAmountBlockContent( start.linkTo(parent.start) end.linkTo(parent.end) }, + showFCAWarning = amountUM.showFCAWarning, ) } } diff --git a/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/amount/ui/preview/SwapAmountContentPreview.kt b/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/amount/ui/preview/SwapAmountContentPreview.kt index df8d9da742..627af48d84 100644 --- a/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/amount/ui/preview/SwapAmountContentPreview.kt +++ b/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/amount/ui/preview/SwapAmountContentPreview.kt @@ -89,6 +89,7 @@ internal data object SwapAmountContentPreview { swapRateType = ExpressRateType.Float, appCurrency = AppCurrency.Default, showBestRateAnimation = false, + showFCAWarning = false, ) val defaultState = SwapAmountUM.Content( @@ -126,5 +127,6 @@ internal data object SwapAmountContentPreview { swapRateType = ExpressRateType.Float, isPrimaryButtonEnabled = true, showBestRateAnimation = false, + showFCAWarning = true, ) } \ No newline at end of file diff --git a/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/chooseprovider/ui/SwapChooseProviderContent.kt b/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/chooseprovider/ui/SwapChooseProviderContent.kt index 2ef78b6506..0e00951292 100644 --- a/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/chooseprovider/ui/SwapChooseProviderContent.kt +++ b/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/chooseprovider/ui/SwapChooseProviderContent.kt @@ -23,6 +23,7 @@ import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.graphics.vector.rememberVectorPainter import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.vectorResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp @@ -33,6 +34,7 @@ import androidx.constraintlayout.compose.Visibility import coil.compose.SubcomposeAsyncImage import coil.request.ImageRequest import com.tangem.core.ui.components.RectangleShimmer +import com.tangem.core.ui.components.SpacerW8 import com.tangem.core.ui.components.SpacerWMax import com.tangem.core.ui.extensions.stringResourceSafe import com.tangem.core.ui.res.TangemColorPalette @@ -44,6 +46,7 @@ import com.tangem.domain.express.models.ExpressRateType import com.tangem.features.swap.v2.impl.R import kotlinx.coroutines.delay +@Suppress("LongParameterList") @Composable fun SwapChooseProviderContent( expressProvider: ExpressProvider?, @@ -51,6 +54,7 @@ fun SwapChooseProviderContent( showBestRateAnimation: Boolean, onClick: () -> Unit, onFinishAnimation: () -> Unit, + showFCAWarning: Boolean, modifier: Modifier = Modifier, ) { Column( @@ -83,6 +87,32 @@ fun SwapChooseProviderContent( SpacerWMax() ProviderInfo(expressProvider, isBestRate, showBestRateAnimation, onFinishAnimation) } + if (showFCAWarning) { + FcaProviderWarning( + modifier = Modifier.padding(start = 12.dp, end = 12.dp, top = 4.dp, bottom = 12.dp), + ) + } + } +} + +@Composable +private fun FcaProviderWarning(modifier: Modifier = Modifier) { + Row( + modifier = modifier, + verticalAlignment = Alignment.CenterVertically, + ) { + Icon( + modifier = Modifier.size(TangemTheme.dimens.size16), + painter = painterResource(id = R.drawable.ic_warning_16), + tint = TangemTheme.colors.icon.informative, + contentDescription = null, + ) + SpacerW8() + Text( + text = stringResourceSafe(R.string.express_provider_in_fca_warning_list), + style = TangemTheme.typography.caption2, + color = TangemTheme.colors.text.tertiary, + ) } } @@ -281,6 +311,7 @@ private fun SwapChooseProviderContent_Preview() { slippage = null, ), onClick = {}, + showFCAWarning = true, onFinishAnimation = {}, ) }