diff --git a/core/res/src/main/res/values-es/strings.xml b/core/res/src/main/res/values-es/strings.xml index 6a2f5f1caf..98241d95b8 100644 --- a/core/res/src/main/res/values-es/strings.xml +++ b/core/res/src/main/res/values-es/strings.xml @@ -1106,6 +1106,7 @@ Compatible con Web 3.0 Se requiere una transacción entrante de al menos %1$s para proceder Fondos insuficientes + Al aprobar, permites que el contrato inteligente use tus tokens en futuras transacciones. Tasa Fija La red cobrará una tasa de aprobación del token para verificar que usted autoriza el uso de su token para el intercambio. Intercambie más tokens a mejores tasas directamente en su billetera. @@ -1400,6 +1401,7 @@ Tenemos algún tipo de problema Todas las dApps desconectadas Permitir gastar + Al aprobar, permites que la dApp o el contrato inteligente utilicen los tokens en futuras transacciones. Dirección Conectar Cargando diff --git a/core/res/src/main/res/values-fr/strings.xml b/core/res/src/main/res/values-fr/strings.xml index 868ad2f695..4685df09fe 100644 --- a/core/res/src/main/res/values-fr/strings.xml +++ b/core/res/src/main/res/values-fr/strings.xml @@ -1080,6 +1080,7 @@ Compatible avec Web 3.0 Une transaction entrante d\'au moins de %1$s est requise pour continuer Fonds insuffisants + En approuvant, vous autorisez le contrat intelligent à utiliser vos jetons dans de futures transactions. Taux fixe Le réseau facturera des frais d\'approbation de jeton pour vérifier que vous autorisez l\'utilisation de votre jeton pour l\'échange. Échangez plus de jetons à de meilleurs taux directement dans votre portefeuille. @@ -1386,6 +1387,7 @@ Nous avons un problème. Toutes les dApps sont déconnectées Autoriser à dépenser + En approuvant, vous autorisez la dApp ou le contrat intelligent à utiliser les jetons dans de futures transactions. Adresse Connecter Chargement @@ -1453,4 +1455,5 @@ Non, envoyer toute la somme Réduire de %s XTZ Pour ne pas payer un fraid de commissions élevé la prochaine fois que vous rechargez votre portefeuille, veuillez réduire le montant de %s XTZ + Des frais de réseau d\'environ %1$s (%2$s) seront déduits de chaque recharge future, sans dépasser votre limite de %3$s (%4$s). diff --git a/core/res/src/main/res/values-ja/strings.xml b/core/res/src/main/res/values-ja/strings.xml index c1f18f6577..68a1c38379 100644 --- a/core/res/src/main/res/values-ja/strings.xml +++ b/core/res/src/main/res/values-ja/strings.xml @@ -23,6 +23,8 @@ アカウントを復元できません アーカイブ済み アカウントをアーカイブできませんでした。しばらくしてからもう一度お試しください。 + このアカウントは紹介プログラムに参加しています。 + このアカウントはアーカイブできません。 アカウントを作成できませんでした。しばらくしてからもう一度お試しください。 アカウントを作成しました アカウントをアーカイブする @@ -42,6 +44,8 @@ アカウントを編集 %1$s ( %2$s内) メインアカウント + すでにアクティブアカウントの上限%1$s件を超えています。復元するには、1つをアーカイブしてください。 + アカウントを復元できません アカウントが回復しました アカウントを長押しして並べ替える 編集を続ける @@ -546,6 +550,7 @@ その他の方法 秘密鍵をオフラインで安全に保存する物理デバイス。 リカバリーフレーズ + ウォレットをハードウェアにアップグレードするには、まずバックアップしてください。 鍵はアプリに保存されます シードフレーズのバックアップ モバイルウォレットを作成する @@ -1303,6 +1308,8 @@ この手数料は、送金処理にかかるコストをカバーするためのものです。 出金 PINを変更する + カードは支払いの準備が整いました。 + PINコードを作成しました データの読み込みに失敗しました。しばらくしてからもう一度お試しください。 カードの一時停止 非表示 @@ -1733,8 +1740,9 @@ いいえ、すべて送信します %s XTZを減らす 次回ウォレットにチャージするときに手数料の増加を避けるには、金額を%s XTZ減らしてください。 - %sはAaveに預けられています - 受け取った金額%1$s %2$sはAaveに入金されませんでした。 + あなたの資金は現在Aaveプロトコルに供給されていますが、いつでも管理できます。 + %sはAaveに供給されています + Aaveへの%1$s %2$sの供給は保留中です 承認する 前回の承認に問題があったため、新しい承認が必要です。手続き方法を選択してください。 承認が必要 @@ -1748,62 +1756,63 @@ 年利%1$s%% 利用可能 現在のAPY - 貸付のためにチャージする際は、ネットワーク手数料が金額から差し引かれます(手数料は常に%1$s以下です)。 + 貸付のために入金する際は、残高から%1$s以下のネットワーク手数料が差し引かれます。 現在、ネットワーク手数料が高すぎるため貸付を実行できません。手数料が%1$s以下に下がり次第、資金が供給されます。 私の資金 - あなたの%1$sはAaveに預けられ、利息が付きます。あなたは%2$sトークンを保有しており、これは残高を表し、時間の経過とともに増加します。入金すると、資金はAaveに預け入れられ、取引手数料を差し引いた利息が付きます。 + あなたの%1$sはAaveに預けられ、利息が付きます。あなたは%2$sトークンを保有しており、これは残高を表し、時間の経過とともに増加します。入金すると資金はAaveに供給され、取引手数料を差し引いた利息が付きます。 利回りを得る 総収益 Aaveへの送金 Aaveの詳細を見る - これは%sの現在の供給手数料です。実際のコストは受取画面に表示されます。 + これは%sの現在の供給手数料です。実際のコストはアクティベーションタブに表示されます。 現在の手数料 今後の%sの入金はすべて、取引手数料が差し引かれて自動的にAaveに供給されます。 + 今後のチャージごとに、おおよそ%1$s(%2$s)のネットワーク手数料が差し引かれますが、上限の%3$s(%4$s)を超えることはありません。 ネットワーク手数料が上限手数料を超えた場合、手数料が下がるまで取引は成立しません。この制限は後で変更できます。 最大手数料 - 取引手数料は入金額の4%未満である必要があります。残高がこの条件を満たすのに十分な金額になった場合にのみ、TangemはAaveに資金を送ります。 + 最小金額は現在のネットワーク手数料に基づいて計算されており、手数料が4%を超えないように設定されています。その結果、最小金額は%1$s(%2$s)となります。 最低入金額 手数料ポリシー Tangemはまた、得られた利回りに対して3%のサービス手数料を差し引きます。 - ネットワーク手数料が下がるか、残高が必要な最低額に達すると、自動的にAaveへ送金されます。 + ネットワーク手数料が下がるか、残高が最低必要額に達すると、資金は自動的にAaveに供給されます。 過去のリターン ここに説明を入力してください。1〜3行が理想的です。[プレースホルダー] - トークン承認が必要 + トークンの承認が必要 ネットワーク接続を確認してください ネットワーク手数料についての情報にアクセスできません - アカウントへの入金はすべて自動的にAaveに貸し出されます。 - 残高は自動的に計算されます + あなたが行うすべての入金は、自動的にAaveへ供給されます。 + Aaveへの自動送金 いつでも、即座に資金を送信、交換、売却できます。 いつでも資金にアクセス可能 使い方 Aaveは、総額819億ドル以上の資産を管理する分散型プロトコルです。 分散型・自己管理型 - サービスを利用することにより、プロバイダー\n %1$sおよび%2$sに同意したことになります + このサービスを利用することにより、プロバイダー\n%1$sおよび%2$sに同意するものとします。 Aave を接続 Aave %1$s%% • 変動金利 Aave 平均%s 昨年のリターン - 現在の金利は常に変動し、リアルタイムの需要と供給に基づいて、AAVEオンチェーンスマートコントラクトによって自動的に計算されます。 + 現在の金利は常に変動し、リアルタイムの需要と供給に基づいて、Aaveオンチェーンスマートコントラクトによって自動的に計算されます。 提供 金利は変動します - 入金すると、資金は自動的にAaveに送金され、利息が付き始めます。取引手数料として%s相当の少額の手数料が差し引かれます。 + 入金すると、資金は自動的にAaveに送金され、利息が付き始めます。%sが取引手数料として差し引かれます。 資産を供給する - %sはAaveに供給され、すぐに利用可能になります + %sはAaveに供給されますが、管理可能な状態のままになります。 手数料ポリシーを見る - 次回以降の入金は自動的にAaveに供給されます。 + 次回の入金は自動的にAaveに供給されます。 アクティブ 停止中 利回りモードを無効にする - オフにすると、Aaveから資金が引き出され、ウォレットの%sに戻され、報酬の獲得が停止されます。 + これをオフにすると、Aave からウォレットの %s に資金が引き出され、報酬の獲得が停止します。 出金金額からネットワーク手数料が差し引かれます。 供給APY APY - 自分で管理しながら、資金をバックグラウンドで運用しましょう。 + 自分で管理しながら、資金に働かせましょう。 利息は自動的に発生します 利回りモード 入金の処理中 - 残高を活用 + 資産を有効活用しましょう 自動 取引のネットワーク手数料をカバーするために、 %1$s %2$sを入金してください %s手数料を支払えません diff --git a/core/res/src/main/res/values-ru/strings.xml b/core/res/src/main/res/values-ru/strings.xml index 9b73434b2d..9f8d33a4a4 100644 --- a/core/res/src/main/res/values-ru/strings.xml +++ b/core/res/src/main/res/values-ru/strings.xml @@ -1494,6 +1494,7 @@ Похоже, возникла проблема Все dapps отключены Разрешение на использование + Подтверждая, вы разрешаете смарт-контракту использовать ваши токены в будущих транзакциях. Адрес Подключение Загрузка diff --git a/core/res/src/main/res/values-uk-rUA/strings.xml b/core/res/src/main/res/values-uk-rUA/strings.xml index b13f5ecb1d..ef07e28698 100644 --- a/core/res/src/main/res/values-uk-rUA/strings.xml +++ b/core/res/src/main/res/values-uk-rUA/strings.xml @@ -1086,6 +1086,7 @@ Web 3.0 сумісність Для відправки потрібна вхідна транзакція на суму не менше %1$s Недостатньо коштів + Підтверджуючи, ви дозволяєте смартконтракту використовувати ваші токени в майбутніх транзакціях. Мережа стягує комісію за схвалення токену за підтвердження, що саме ви дозволяєте використовувати ваш токен для обміну. Обмінюйте більше токенів за вигіднішим курсом прямо у своєму гаманці. З\'явився новий провайдер обмінів! @@ -1366,6 +1367,7 @@ Обрана не вірна картка або кільце Схоже, виникла проблема Усі dApps відключені + Підтверджуючи, ви дозволяєте dApp або смартконтракту використовувати токени в майбутніх транзакціях. Адреса Підключення Мережа diff --git a/core/res/src/main/res/values/strings.xml b/core/res/src/main/res/values/strings.xml index e77d811c07..5015abed71 100644 --- a/core/res/src/main/res/values/strings.xml +++ b/core/res/src/main/res/values/strings.xml @@ -44,6 +44,8 @@ Edit account %1$s in %2$s Main account + You have already exceeded the limit of %1$s active accounts. Archive one to recover + Can’t recover account Account recovered Long tap on an account to reorder accounts Keep Editing @@ -1837,10 +1839,11 @@ This is the current supply fee on %s. The actual cost will be shown on the activation tab. Current fee All future %s deposits will be supplied to Aave automatically, with the transaction fee deducted. + An approximate network fee of %1$s (%2$s) will be deducted from each future top-up, and it won’t exceed your %3$s (%4$s) limit. If network fees rise above maximum fee, the transaction won’t go through until they decrease. You can change this limit later. Maximum fee - This is the lowest amount that can be supplied to Aave. To keep the yield mode profitable, we won’t supply assets when network fees exceed 4% of the amount. - Minimal deposit + The minimum amount is calculated from the current network fee to ensure it does not exceed 4%%, which makes the minimum %1$s (%2$s). + Minimum top-up Fee policy Tangem also takes a 3% service fee on yield earned. Your funds will be automatically supplied to Aave once network fees are lower or your balance meets the minimum required amount. @@ -1849,7 +1852,7 @@ Token approvals needed Check your network connection Network fee info unreachable - Every deposit you make will be suplied to Aave automatically. + Every deposit you make will be supplied to Aave automatically. Auto-Transfer to Aave Send, swap, or sell your funds instantly, anytime you want. Access your funds anytime diff --git a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/common/entity/YieldSupplyFeeUM.kt b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/common/entity/YieldSupplyFeeUM.kt index ffac0fef60..7b3d8e94ed 100644 --- a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/common/entity/YieldSupplyFeeUM.kt +++ b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/common/entity/YieldSupplyFeeUM.kt @@ -13,10 +13,12 @@ internal sealed class YieldSupplyFeeUM { data object Error : YieldSupplyFeeUM() data class Content( val transactionDataList: ImmutableList, - val feeValue: TextReference, - val currentNetworkFeeValue: TextReference, - val maxNetworkFeeValue: TextReference, - val minAmountFeeValue: TextReference, + val feeFiatValue: TextReference, + val tokenFeeFiatValue: TextReference, + val maxNetworkFeeFiatValue: TextReference, + val minTopUpFiatValue: TextReference, + val feeNoteValue: TextReference = TextReference.EMPTY, + val minFeeNoteValue: TextReference = TextReference.EMPTY, ) : YieldSupplyFeeUM() } diff --git a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/common/ui/YieldSupplyActionContent.kt b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/common/ui/YieldSupplyActionContent.kt index 03437a23fe..abc8b25b63 100644 --- a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/common/ui/YieldSupplyActionContent.kt +++ b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/common/ui/YieldSupplyActionContent.kt @@ -3,11 +3,13 @@ package com.tangem.features.yield.supply.impl.common.ui import android.content.res.Configuration import androidx.compose.foundation.background import androidx.compose.foundation.layout.* +import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.key import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip import androidx.compose.ui.text.LinkAnnotation import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.withLink @@ -85,13 +87,17 @@ internal fun YieldSupplyActionContent( ), ) { val fee = when (val yieldSupplyFeeUM = yieldSupplyActionUM.yieldSupplyFeeUM) { - is YieldSupplyFeeUM.Content -> yieldSupplyFeeUM.feeValue + is YieldSupplyFeeUM.Content -> yieldSupplyFeeUM.feeFiatValue YieldSupplyFeeUM.Error -> stringReference(StringsSigns.DASH_SIGN) YieldSupplyFeeUM.Loading -> null } YieldSupplyFeeRow( title = resourceReference(R.string.common_network_fee_title), value = fee, + modifier = Modifier.fillMaxWidth() + .clip(RoundedCornerShape(14.dp)) + .background(TangemTheme.colors.background.action) + .padding(horizontal = 16.dp, vertical = 12.dp), ) } } @@ -138,10 +144,11 @@ private class YieldSupplyActionContentPreviewProvider : PreviewParameterProvider currencyIconState = CurrencyIconState.Loading, yieldSupplyFeeUM = YieldSupplyFeeUM.Content( transactionDataList = persistentListOf(), - feeValue = stringReference("0.00020 ETH • \$0.99"), - currentNetworkFeeValue = stringReference("1.45 USDT • \$1.45"), - maxNetworkFeeValue = stringReference("8.50 USDT • \$8.50"), - minAmountFeeValue = stringReference("50 USDT • \$50"), + feeFiatValue = stringReference("$0.99"), + tokenFeeFiatValue = stringReference("$1.45"), + maxNetworkFeeFiatValue = stringReference("$8.50"), + minTopUpFiatValue = stringReference("$50"), + feeNoteValue = TextReference.EMPTY, ), isPrimaryButtonEnabled = false, isTransactionSending = false, diff --git a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/common/ui/YieldSupplyFeeRow.kt b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/common/ui/YieldSupplyFeeRow.kt index dc00a547a8..c893885dbb 100644 --- a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/common/ui/YieldSupplyFeeRow.kt +++ b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/common/ui/YieldSupplyFeeRow.kt @@ -1,17 +1,12 @@ package com.tangem.features.yield.supply.impl.common.ui import androidx.compose.animation.AnimatedContent -import androidx.compose.foundation.background import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.draw.clip import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp import com.tangem.core.ui.components.SpacerWMax @@ -23,15 +18,11 @@ import com.tangem.core.ui.res.TangemTheme import com.tangem.features.yield.supply.impl.R @Composable -internal fun YieldSupplyFeeRow(title: TextReference, value: TextReference?) { +internal fun YieldSupplyFeeRow(title: TextReference, value: TextReference?, modifier: Modifier = Modifier) { Row( horizontalArrangement = Arrangement.spacedBy(12.dp), verticalAlignment = Alignment.CenterVertically, - modifier = Modifier - .fillMaxWidth() - .clip(RoundedCornerShape(14.dp)) - .background(TangemTheme.colors.background.action) - .padding(horizontal = 16.dp, vertical = 12.dp), + modifier = modifier, ) { Text( text = title.resolveReference(), diff --git a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/active/entity/YieldSupplyActiveContentUM.kt b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/active/entity/YieldSupplyActiveContentUM.kt index 2e7b5c14dc..eea128679c 100644 --- a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/active/entity/YieldSupplyActiveContentUM.kt +++ b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/active/entity/YieldSupplyActiveContentUM.kt @@ -14,6 +14,7 @@ internal data class YieldSupplyActiveContentUM( val minAmount: TextReference?, val currentFee: TextReference?, val feeDescription: TextReference?, + val minFeeDescription: TextReference?, val apy: TextReference? = null, val isHighFee: Boolean = false, ) \ No newline at end of file diff --git a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/active/model/YieldSupplyActiveModel.kt b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/active/model/YieldSupplyActiveModel.kt index 42617b38f5..8d8bd96071 100644 --- a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/active/model/YieldSupplyActiveModel.kt +++ b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/active/model/YieldSupplyActiveModel.kt @@ -12,7 +12,6 @@ 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.format.bigdecimal.crypto -import com.tangem.core.ui.format.bigdecimal.fiat import com.tangem.core.ui.format.bigdecimal.format import com.tangem.domain.appcurrency.GetSelectedAppCurrencyUseCase import com.tangem.domain.appcurrency.model.AppCurrency @@ -25,11 +24,13 @@ import com.tangem.domain.yield.supply.usecase.YieldSupplyGetCurrentFeeUseCase import com.tangem.domain.yield.supply.usecase.YieldSupplyGetMaxFeeUseCase import com.tangem.features.yield.supply.api.analytics.YieldSupplyAnalytics import com.tangem.features.yield.supply.impl.R -import com.tangem.features.yield.supply.impl.common.formatter.YieldSupplyAmountFormatter import com.tangem.features.yield.supply.impl.subcomponents.active.YieldSupplyActiveComponent import com.tangem.features.yield.supply.impl.subcomponents.active.entity.YieldSupplyActiveContentUM +import com.tangem.features.yield.supply.impl.subcomponents.active.model.transformers.YieldSupplyActiveMinAmountTransformer +import com.tangem.features.yield.supply.impl.subcomponents.active.model.transformers.YieldSupplyActiveFeeContentTransformer import com.tangem.utils.StringsSigns.DASH_SIGN import com.tangem.utils.coroutines.CoroutineDispatcherProvider +import com.tangem.utils.transformer.update import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.persistentListOf import kotlinx.collections.immutable.toPersistentList @@ -75,6 +76,7 @@ internal class YieldSupplyActiveModel @Inject constructor( currentFee = null, feeDescription = null, isHighFee = false, + minFeeDescription = null, ), ) @@ -202,20 +204,19 @@ internal class YieldSupplyActiveModel @Inject constructor( params.userWallet, cryptoCurrencyStatusFlow.value, ).onRight { minAmount -> - val minAmountTextReference = YieldSupplyAmountFormatter( - cryptoCurrencyStatusFlow.value.currency, - appCurrency, - ).invoke( - feeValue = minAmount, - fiatRate = cryptoCurrencyStatusFlow.value.value.fiatRate, - showCrypto = false, + uiState.update( + YieldSupplyActiveMinAmountTransformer( + cryptoCurrencyStatus = cryptoCurrencyStatusFlow.value, + appCurrency = appCurrency, + minAmount = minAmount, + ), ) - uiState.update { - it.copy(minAmount = minAmountTextReference) - } }.onLeft { uiState.update { - it.copy(minAmount = TextReference.Str(DASH_SIGN)) + it.copy( + minAmount = TextReference.Str(DASH_SIGN), + feeDescription = null, + ) } } } @@ -235,33 +236,23 @@ internal class YieldSupplyActiveModel @Inject constructor( cryptoCurrencyStatus = cryptoStatus, ).getOrNull() - val currentFeeText = currentFee?.let { - YieldSupplyAmountFormatter( - cryptoStatus.currency, - appCurrency, - ).invoke( - feeValue = it, - fiatRate = cryptoStatus.value.fiatRate, - showCrypto = false, + if (currentFee != null && maxFee != null) { + uiState.update( + YieldSupplyActiveFeeContentTransformer( + cryptoCurrencyStatus = cryptoStatus, + appCurrency = appCurrency, + feeValue = currentFee, + maxNetworkFee = maxFee, + ), ) - } - - val isHighFee = if (currentFee != null && maxFee != null) currentFee > maxFee else false - - val maxFiatFee = maxFee?.multiply(cryptoStatus.value.fiatRate) - .format { fiat(appCurrency.code, appCurrency.symbol) } - val feeDescription = if (isHighFee) { - resourceReference(R.string.yield_module_earn_sheet_high_fee_description, wrappedList(maxFiatFee)) } else { - resourceReference(R.string.yield_module_earn_sheet_fee_description, wrappedList(maxFiatFee)) - } - - uiState.update { - it.copy( - currentFee = currentFeeText ?: stringReference(DASH_SIGN), - isHighFee = isHighFee, - feeDescription = feeDescription, - ) + uiState.update { + it.copy( + currentFee = stringReference(DASH_SIGN), + feeDescription = null, + isHighFee = false, + ) + } } } } diff --git a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/active/model/transformers/YieldSupplyActiveFeeContentTransformer.kt b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/active/model/transformers/YieldSupplyActiveFeeContentTransformer.kt new file mode 100644 index 0000000000..bcd2e22076 --- /dev/null +++ b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/active/model/transformers/YieldSupplyActiveFeeContentTransformer.kt @@ -0,0 +1,57 @@ +package com.tangem.features.yield.supply.impl.subcomponents.active.model.transformers + +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.format.bigdecimal.crypto +import com.tangem.core.ui.format.bigdecimal.fiat +import com.tangem.core.ui.format.bigdecimal.format +import com.tangem.core.ui.extensions.TextReference +import com.tangem.domain.appcurrency.model.AppCurrency +import com.tangem.domain.models.currency.CryptoCurrencyStatus +import com.tangem.features.yield.supply.impl.R +import com.tangem.features.yield.supply.impl.subcomponents.active.entity.YieldSupplyActiveContentUM +import com.tangem.utils.transformer.Transformer +import java.math.BigDecimal + +/** + * Computes fee description and current fee values for Active screen based on token rates. + */ +internal class YieldSupplyActiveFeeContentTransformer( + private val cryptoCurrencyStatus: CryptoCurrencyStatus, + private val appCurrency: AppCurrency, + private val feeValue: BigDecimal, + private val maxNetworkFee: BigDecimal, +) : Transformer { + + override fun transform(prevState: YieldSupplyActiveContentUM): YieldSupplyActiveContentUM { + val cryptoCurrency = cryptoCurrencyStatus.currency + val tokenFiatRate = cryptoCurrencyStatus.value.fiatRate + + val tokenCryptoFeeValueText = feeValue.format { crypto(cryptoCurrency) } + val tokenFiatFee = tokenFiatRate?.let(feeValue::multiply) + val tokenFiatFeeValueText = tokenFiatFee.format { fiat(appCurrency.code, appCurrency.symbol) } + + val maxFeeCryptoValueText = maxNetworkFee.format { crypto(cryptoCurrency) } + val maxFiatFee = tokenFiatRate?.let { rate -> maxNetworkFee.multiply(rate) } + val maxFiatFeeValueText = maxFiatFee.format { fiat(appCurrency.code, appCurrency.symbol) } + + val feeNoteValue: TextReference = resourceReference( + id = R.string.yield_module_fee_policy_sheet_fee_note, + formatArgs = wrappedList( + stringReference(tokenFiatFeeValueText), + stringReference(tokenCryptoFeeValueText), + stringReference(maxFiatFeeValueText), + stringReference(maxFeeCryptoValueText), + ), + ) + + val isHighFee = feeValue > maxNetworkFee + + return prevState.copy( + currentFee = stringReference(tokenFiatFeeValueText), + feeDescription = feeNoteValue, + isHighFee = isHighFee, + ) + } +} \ No newline at end of file diff --git a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/active/model/transformers/YieldSupplyActiveMinAmountTransformer.kt b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/active/model/transformers/YieldSupplyActiveMinAmountTransformer.kt new file mode 100644 index 0000000000..91fa089b91 --- /dev/null +++ b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/active/model/transformers/YieldSupplyActiveMinAmountTransformer.kt @@ -0,0 +1,46 @@ +package com.tangem.features.yield.supply.impl.subcomponents.active.model.transformers + +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.format.bigdecimal.crypto +import com.tangem.core.ui.format.bigdecimal.fiat +import com.tangem.core.ui.format.bigdecimal.format +import com.tangem.domain.appcurrency.model.AppCurrency +import com.tangem.domain.models.currency.CryptoCurrencyStatus +import com.tangem.features.yield.supply.impl.R +import com.tangem.features.yield.supply.impl.subcomponents.active.entity.YieldSupplyActiveContentUM +import com.tangem.utils.transformer.Transformer +import java.math.BigDecimal + +/** + * Computes and sets minimum amount (fiat) and fee description note + */ +internal class YieldSupplyActiveMinAmountTransformer( + private val cryptoCurrencyStatus: CryptoCurrencyStatus, + private val appCurrency: AppCurrency, + private val minAmount: BigDecimal, +) : Transformer { + + override fun transform(prevState: YieldSupplyActiveContentUM): YieldSupplyActiveContentUM { + val cryptoCurrency = cryptoCurrencyStatus.currency + val tokenFiatRate = cryptoCurrencyStatus.value.fiatRate + + val minAmountCryptoText = minAmount.format { crypto(cryptoCurrency) } + val minAmountFiat = tokenFiatRate?.let(minAmount::multiply) + val minAmountFiatText = minAmountFiat.format { fiat(appCurrency.code, appCurrency.symbol) } + + val minFeeNoteValue = resourceReference( + id = R.string.yield_module_fee_policy_sheet_min_amount_note, + formatArgs = wrappedList( + minAmountFiatText, + minAmountCryptoText, + ), + ) + + return prevState.copy( + minAmount = stringReference(minAmountFiatText), + minFeeDescription = minFeeNoteValue, + ) + } +} \ No newline at end of file diff --git a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/active/ui/YieldSupplyActiveContent.kt b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/active/ui/YieldSupplyActiveContent.kt index 867fdefd59..0654981fee 100644 --- a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/active/ui/YieldSupplyActiveContent.kt +++ b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/active/ui/YieldSupplyActiveContent.kt @@ -91,12 +91,14 @@ internal fun YieldSupplyActiveContent( ) } - Text( - modifier = Modifier.padding(horizontal = 12.dp), - text = stringResourceSafe(R.string.yield_module_fee_policy_sheet_min_amount_note), - style = TangemTheme.typography.caption2, - color = TangemTheme.colors.text.tertiary, - ) + AnimatedVisibility(state.minFeeDescription != null) { + Text( + modifier = Modifier.padding(horizontal = 12.dp), + text = state.minFeeDescription?.resolveReference().orEmpty(), + style = TangemTheme.typography.caption2, + color = TangemTheme.colors.text.tertiary, + ) + } } } @@ -376,6 +378,10 @@ private class YieldSupplyActiveBottomSheetPreviewProvider : PreviewParameterProv ), apy = stringReference("5,14%"), isHighFee = true, + minFeeDescription = stringReference( + "The network fee is currently too high to execute lending." + + "Funds will be supplied once it drops to \$12 or below. ", + ), ), ) } diff --git a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/approve/model/YieldSupplyApproveModel.kt b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/approve/model/YieldSupplyApproveModel.kt index 66f9d0f195..0be362037a 100644 --- a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/approve/model/YieldSupplyApproveModel.kt +++ b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/approve/model/YieldSupplyApproveModel.kt @@ -10,7 +10,6 @@ import com.tangem.core.decompose.model.ParamsContainer import com.tangem.core.navigation.url.UrlOpener import com.tangem.core.ui.components.currency.icon.converter.CryptoCurrencyToIconStateConverter import com.tangem.core.ui.extensions.* -import com.tangem.core.ui.format.bigdecimal.crypto import com.tangem.core.ui.format.bigdecimal.fiat import com.tangem.core.ui.format.bigdecimal.format import com.tangem.domain.appcurrency.GetSelectedAppCurrencyUseCase @@ -33,7 +32,7 @@ import com.tangem.features.yield.supply.impl.subcomponents.approve.YieldSupplyAp import com.tangem.features.yield.supply.impl.subcomponents.notifications.YieldSupplyNotificationsComponent import com.tangem.features.yield.supply.impl.subcomponents.notifications.YieldSupplyNotificationsUpdateTrigger import com.tangem.features.yield.supply.impl.subcomponents.notifications.entity.YieldSupplyNotificationData -import com.tangem.utils.StringsSigns.DOT +import com.tangem.core.ui.extensions.TextReference import com.tangem.utils.TangemBlogUrlBuilder import com.tangem.utils.coroutines.CoroutineDispatcherProvider import com.tangem.utils.transformer.update @@ -220,7 +219,6 @@ internal class YieldSupplyApproveModel @Inject constructor( val feeFiatValue = feeCryptoCurrencyStatus.value.fiatRate?.let { rate -> feeCryptoValue?.multiply(rate) } - val cryptoFee = feeCryptoValue.format { crypto(feeCryptoCurrencyStatus.currency) } val fiatFee = feeFiatValue.format { fiat(appCurrency.code, appCurrency.symbol) } uiState.update { @@ -233,14 +231,11 @@ internal class YieldSupplyApproveModel @Inject constructor( transactionDataList = persistentListOf( approvalTransitionData.copy(fee = transactionFee.normal), ), - feeValue = combinedReference( - stringReference(cryptoFee), - stringReference(" $DOT "), - stringReference(fiatFee), - ), - currentNetworkFeeValue = TextReference.EMPTY, - maxNetworkFeeValue = TextReference.EMPTY, - minAmountFeeValue = TextReference.EMPTY, + feeFiatValue = stringReference(fiatFee), + tokenFeeFiatValue = TextReference.EMPTY, + maxNetworkFeeFiatValue = TextReference.EMPTY, + minTopUpFiatValue = TextReference.EMPTY, + feeNoteValue = TextReference.EMPTY, ), ) } diff --git a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/feepolicy/YieldSupplyFeePolicyComponent.kt b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/feepolicy/YieldSupplyFeePolicyComponent.kt index 2e55b046d0..88976d67ff 100644 --- a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/feepolicy/YieldSupplyFeePolicyComponent.kt +++ b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/feepolicy/YieldSupplyFeePolicyComponent.kt @@ -38,7 +38,6 @@ internal class YieldSupplyFeePolicyComponent( YieldSupplyFeePolicyContent( yieldSupplyFeeUM = uiState.yieldSupplyFeeUM, tokenSymbol = params.cryptoCurrency.symbol, - networkName = params.cryptoCurrency.network.name, modifier = modifier, ) } diff --git a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/feepolicy/ui/YieldSupplyFeePolicyContent.kt b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/feepolicy/ui/YieldSupplyFeePolicyContent.kt index b9fc7b1d23..90c16fc3df 100644 --- a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/feepolicy/ui/YieldSupplyFeePolicyContent.kt +++ b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/feepolicy/ui/YieldSupplyFeePolicyContent.kt @@ -6,10 +6,12 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp @@ -34,7 +36,6 @@ import kotlinx.collections.immutable.persistentListOf internal fun YieldSupplyFeePolicyContent( yieldSupplyFeeUM: YieldSupplyFeeUM, tokenSymbol: String, - networkName: String, modifier: Modifier = Modifier, ) { Column( @@ -62,68 +63,51 @@ internal fun YieldSupplyFeePolicyContent( modifier = Modifier.padding(horizontal = 16.dp), ) SpacerH24() - FooterContainer( - footer = resourceReference( - id = R.string.yield_module_fee_policy_sheet_min_amount_note, - formatArgs = wrappedList(networkName), - ), - paddingValues = PaddingValues( - top = 8.dp, - start = 12.dp, - end = 12.dp, - ), - ) { - val minAmount = when (yieldSupplyFeeUM) { - is YieldSupplyFeeUM.Content -> yieldSupplyFeeUM.minAmountFeeValue - YieldSupplyFeeUM.Error -> stringReference(StringsSigns.DASH_SIGN) - YieldSupplyFeeUM.Loading -> null - } - YieldSupplyFeeRow( - title = resourceReference(R.string.yield_module_fee_policy_sheet_min_amount_title), - value = minAmount, - ) - } + MinFeeNote(yieldSupplyFeeUM) SpacerH16() + val feeNote = when (yieldSupplyFeeUM) { + is YieldSupplyFeeUM.Content -> yieldSupplyFeeUM.feeNoteValue + YieldSupplyFeeUM.Error -> null + YieldSupplyFeeUM.Loading -> null + } FooterContainer( - footer = resourceReference( - id = R.string.yield_module_fee_policy_sheet_current_fee_note, - formatArgs = wrappedList(networkName), - ), + footer = feeNote, paddingValues = PaddingValues( top = 8.dp, start = 12.dp, end = 12.dp, ), ) { - val currentFee = when (yieldSupplyFeeUM) { - is YieldSupplyFeeUM.Content -> yieldSupplyFeeUM.currentNetworkFeeValue - YieldSupplyFeeUM.Error -> stringReference(StringsSigns.DASH_SIGN) - YieldSupplyFeeUM.Loading -> null + Column( + modifier = Modifier + .fillMaxWidth() + .clip(RoundedCornerShape(14.dp)) + .background(TangemTheme.colors.background.action) + .padding(horizontal = 16.dp), + ) { + val currentFee = when (yieldSupplyFeeUM) { + is YieldSupplyFeeUM.Content -> yieldSupplyFeeUM.tokenFeeFiatValue + YieldSupplyFeeUM.Error -> stringReference(StringsSigns.DASH_SIGN) + YieldSupplyFeeUM.Loading -> null + } + YieldSupplyFeeRow( + title = resourceReference(R.string.yield_module_fee_policy_sheet_current_fee_title), + value = currentFee, + modifier = Modifier.padding(vertical = 12.dp), + ) + val maxFee = when (yieldSupplyFeeUM) { + is YieldSupplyFeeUM.Content -> yieldSupplyFeeUM.maxNetworkFeeFiatValue + YieldSupplyFeeUM.Error -> stringReference(StringsSigns.DASH_SIGN) + YieldSupplyFeeUM.Loading -> null + } + YieldSupplyFeeRow( + title = resourceReference(R.string.yield_module_fee_policy_sheet_max_fee_title), + value = maxFee, + modifier = Modifier.padding(vertical = 12.dp), + ) } - YieldSupplyFeeRow( - title = resourceReference(R.string.yield_module_fee_policy_sheet_current_fee_title), - value = currentFee, - ) - } - SpacerH16() - FooterContainer( - footer = resourceReference(R.string.yield_module_fee_policy_sheet_max_fee_note), - paddingValues = PaddingValues( - top = 8.dp, - start = 12.dp, - end = 12.dp, - ), - ) { - val maxFee = when (yieldSupplyFeeUM) { - is YieldSupplyFeeUM.Content -> yieldSupplyFeeUM.maxNetworkFeeValue - YieldSupplyFeeUM.Error -> stringReference(StringsSigns.DASH_SIGN) - YieldSupplyFeeUM.Loading -> null - } - YieldSupplyFeeRow( - title = resourceReference(R.string.yield_module_fee_policy_sheet_max_fee_title), - value = maxFee, - ) } + SpacerH8() Text( text = stringResourceSafe(R.string.yield_module_fee_policy_tangem_service_fee_title), style = TangemTheme.typography.caption2, @@ -139,6 +123,38 @@ internal fun YieldSupplyFeePolicyContent( } } +@Composable +private fun MinFeeNote(yieldSupplyFeeUM: YieldSupplyFeeUM) { + val minFeeNote = when (yieldSupplyFeeUM) { + is YieldSupplyFeeUM.Content -> yieldSupplyFeeUM.feeNoteValue + YieldSupplyFeeUM.Error -> null + YieldSupplyFeeUM.Loading -> null + } + FooterContainer( + footer = minFeeNote, + paddingValues = PaddingValues( + top = 8.dp, + start = 12.dp, + end = 12.dp, + ), + ) { + val minAmount = when (yieldSupplyFeeUM) { + is YieldSupplyFeeUM.Content -> yieldSupplyFeeUM.minTopUpFiatValue + YieldSupplyFeeUM.Error -> stringReference(StringsSigns.DASH_SIGN) + YieldSupplyFeeUM.Loading -> null + } + YieldSupplyFeeRow( + title = resourceReference(R.string.yield_module_fee_policy_sheet_min_amount_title), + value = minAmount, + modifier = Modifier + .fillMaxWidth() + .clip(RoundedCornerShape(14.dp)) + .background(TangemTheme.colors.background.action) + .padding(horizontal = 16.dp, vertical = 12.dp), + ) + } +} + // region Preview @Composable @Preview(showBackground = true, widthDp = 360) @@ -148,13 +164,21 @@ private fun YieldSupplyFeePolicyContent_Preview() { YieldSupplyFeePolicyContent( yieldSupplyFeeUM = YieldSupplyFeeUM.Content( transactionDataList = persistentListOf(), - feeValue = stringReference("0.0001 ETH • \$1.45"), - maxNetworkFeeValue = stringReference("8.50 USDT • \$8.50"), - currentNetworkFeeValue = stringReference("1.45 USDT • \$1.45"), - minAmountFeeValue = stringReference("50 USDT • \$50"), + feeFiatValue = stringReference("$1.45"), + maxNetworkFeeFiatValue = stringReference("$8.50"), + tokenFeeFiatValue = stringReference("$1.45"), + minTopUpFiatValue = stringReference("$50"), + feeNoteValue = resourceReference( + id = R.string.yield_module_fee_policy_sheet_fee_note, + formatArgs = wrappedList( + stringReference("$1.45"), + stringReference("1.46 USDT"), + stringReference("$8.50"), + stringReference("8.50 USDT"), + ), + ), ), tokenSymbol = "USDT", - networkName = "Ethereum", modifier = Modifier.background(TangemTheme.colors.background.primary), ) } diff --git a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/startearning/model/transformers/YieldSupplyStartEarningFeeContentTransformer.kt b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/startearning/model/transformers/YieldSupplyStartEarningFeeContentTransformer.kt index 51e5126eb7..184f0fa198 100644 --- a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/startearning/model/transformers/YieldSupplyStartEarningFeeContentTransformer.kt +++ b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/startearning/model/transformers/YieldSupplyStartEarningFeeContentTransformer.kt @@ -1,17 +1,17 @@ package com.tangem.features.yield.supply.impl.subcomponents.startearning.model.transformers import com.tangem.blockchain.common.TransactionData -import com.tangem.core.ui.extensions.combinedReference +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.format.bigdecimal.crypto import com.tangem.core.ui.format.bigdecimal.fiat import com.tangem.core.ui.format.bigdecimal.format import com.tangem.domain.appcurrency.model.AppCurrency import com.tangem.domain.models.currency.CryptoCurrencyStatus +import com.tangem.features.yield.supply.impl.R import com.tangem.features.yield.supply.impl.common.entity.YieldSupplyActionUM import com.tangem.features.yield.supply.impl.common.entity.YieldSupplyFeeUM -import com.tangem.features.yield.supply.impl.common.formatter.YieldSupplyAmountFormatter -import com.tangem.utils.StringsSigns.DOT import com.tangem.utils.transformer.Transformer import kotlinx.collections.immutable.toPersistentList import java.math.BigDecimal @@ -29,30 +29,46 @@ internal class YieldSupplyStartEarningFeeContentTransformer( ) : Transformer { override fun transform(prevState: YieldSupplyActionUM): YieldSupplyActionUM { val cryptoCurrency = cryptoCurrencyStatus.currency - val fiatRate = cryptoCurrencyStatus.value.fiatRate + val tokenFiatRate = cryptoCurrencyStatus.value.fiatRate val feeFiatRate = feeCryptoCurrencyStatus.value.fiatRate - val crypto = feeValue.format { crypto(feeCryptoCurrencyStatus.currency) } - val fiatFeeValue = feeFiatRate?.let(feeValue::multiply) + val feeFiat = feeFiatRate?.let(feeValue::multiply) + val feeFiatValueText = feeFiat.format { fiat(appCurrency.code, appCurrency.symbol) } - val fiat = fiatFeeValue.format { fiat(appCurrency.code, appCurrency.symbol) } - - val tokenCryptoFeeValue = fiatRate?.let { rate -> - fiatFeeValue?.divide(rate, cryptoCurrency.decimals, RoundingMode.HALF_UP) + val tokenCryptoFee = tokenFiatRate?.let { rate -> + feeFiat?.divide(rate, cryptoCurrency.decimals, RoundingMode.HALF_UP) } + val tokenCryptoFeeValueText = tokenCryptoFee.format { crypto(cryptoCurrency) } + val tokenFiatFee = feeFiat // same fiat amount + val tokenFiatFeeValueText = tokenFiatFee.format { fiat(appCurrency.code, appCurrency.symbol) } - val tokenCryptoFee = tokenCryptoFeeValue.format { crypto(cryptoCurrency) } - - val maxCryptoFee = maxNetworkFee.format { crypto(cryptoCurrency) } - val maxFiatFeeValue = fiatRate?.let { rate -> - maxNetworkFee.divide(rate, cryptoCurrency.decimals, RoundingMode.HALF_UP) + val maxFeeCryptoValueText = maxNetworkFee.format { crypto(cryptoCurrency) } + val maxFiatFee = tokenFiatRate?.let { rate -> + maxNetworkFee.multiply(rate) } - val maxFiatFee = maxFiatFeeValue.format { fiat(appCurrency.code, appCurrency.symbol) } + val maxFiatFeeValueText = maxFiatFee.format { fiat(appCurrency.code, appCurrency.symbol) } - val minAmountTextReference = YieldSupplyAmountFormatter( - cryptoCurrency, - appCurrency, - ).invoke(minAmount, cryptoCurrencyStatus.value.fiatRate) + val minAmountCryptoText = minAmount.format { crypto(cryptoCurrency) } + val minAmountFiat = tokenFiatRate?.let(minAmount::multiply) + val minAmountFiatText = minAmountFiat.format { fiat(appCurrency.code, appCurrency.symbol) } + + val feeNoteValue = resourceReference( + id = R.string.yield_module_fee_policy_sheet_fee_note, + formatArgs = wrappedList( + tokenFiatFeeValueText, + tokenCryptoFeeValueText, + maxFiatFeeValueText, + maxFeeCryptoValueText, + ), + ) + + val minFeeNoteValue = resourceReference( + id = R.string.yield_module_fee_policy_sheet_min_amount_note, + formatArgs = wrappedList( + minAmountFiatText, + minAmountCryptoText, + ), + ) return if (cryptoCurrencyStatus.value is CryptoCurrencyStatus.Loading) { prevState.copy(yieldSupplyFeeUM = YieldSupplyFeeUM.Loading) @@ -60,22 +76,12 @@ internal class YieldSupplyStartEarningFeeContentTransformer( prevState.copy( yieldSupplyFeeUM = YieldSupplyFeeUM.Content( transactionDataList = updatedTransactionList.toPersistentList(), - feeValue = combinedReference( - stringReference(crypto), - stringReference(" $DOT "), - stringReference(fiat), - ), - currentNetworkFeeValue = combinedReference( - stringReference(tokenCryptoFee), - stringReference(" $DOT "), - stringReference(fiat), - ), - maxNetworkFeeValue = combinedReference( - stringReference(maxCryptoFee), - stringReference(" $DOT "), - stringReference(maxFiatFee), - ), - minAmountFeeValue = minAmountTextReference, + feeFiatValue = stringReference(feeFiatValueText), + tokenFeeFiatValue = stringReference(tokenFiatFeeValueText), + maxNetworkFeeFiatValue = stringReference(maxFiatFeeValueText), + minTopUpFiatValue = stringReference(minAmountFiatText), + feeNoteValue = feeNoteValue, + minFeeNoteValue = minFeeNoteValue, ), ) } diff --git a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/stopearning/model/transformer/YieldSupplyStopEarningFeeContentTransformer.kt b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/stopearning/model/transformer/YieldSupplyStopEarningFeeContentTransformer.kt index 4e44bb47e6..0f37c2194d 100644 --- a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/stopearning/model/transformer/YieldSupplyStopEarningFeeContentTransformer.kt +++ b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/stopearning/model/transformer/YieldSupplyStopEarningFeeContentTransformer.kt @@ -2,16 +2,13 @@ package com.tangem.features.yield.supply.impl.subcomponents.stopearning.model.tr import com.tangem.blockchain.common.TransactionData import com.tangem.core.ui.extensions.TextReference -import com.tangem.core.ui.extensions.combinedReference import com.tangem.core.ui.extensions.stringReference -import com.tangem.core.ui.format.bigdecimal.crypto import com.tangem.core.ui.format.bigdecimal.fiat import com.tangem.core.ui.format.bigdecimal.format import com.tangem.domain.appcurrency.model.AppCurrency import com.tangem.domain.models.currency.CryptoCurrencyStatus import com.tangem.features.yield.supply.impl.common.entity.YieldSupplyActionUM import com.tangem.features.yield.supply.impl.common.entity.YieldSupplyFeeUM -import com.tangem.utils.StringsSigns.DOT import com.tangem.utils.transformer.Transformer import kotlinx.collections.immutable.toPersistentList import java.math.BigDecimal @@ -24,11 +21,10 @@ internal class YieldSupplyStopEarningFeeContentTransformer( private val feeValue: BigDecimal, ) : Transformer { override fun transform(prevState: YieldSupplyActionUM): YieldSupplyActionUM { - val feeFiatValue = feeCryptoCurrencyStatus.value.fiatRate?.let { rate -> + val feeFiatValueRaw = feeCryptoCurrencyStatus.value.fiatRate?.let { rate -> feeValue.multiply(rate) } - val cryptoFee = feeValue.format { crypto(feeCryptoCurrencyStatus.currency) } - val fiatFee = feeFiatValue.format { fiat(appCurrency.code, appCurrency.symbol) } + val fiatFeeText = feeFiatValueRaw.format { fiat(appCurrency.code, appCurrency.symbol) } return if (cryptoCurrencyStatus.value is CryptoCurrencyStatus.Loading) { prevState.copy(yieldSupplyFeeUM = YieldSupplyFeeUM.Loading) @@ -37,14 +33,11 @@ internal class YieldSupplyStopEarningFeeContentTransformer( isPrimaryButtonEnabled = true, yieldSupplyFeeUM = YieldSupplyFeeUM.Content( transactionDataList = transactions.toPersistentList(), - feeValue = combinedReference( - stringReference(cryptoFee), - stringReference(" $DOT "), - stringReference(fiatFee), - ), - currentNetworkFeeValue = TextReference.EMPTY, - maxNetworkFeeValue = TextReference.EMPTY, - minAmountFeeValue = TextReference.EMPTY, + feeFiatValue = stringReference(fiatFeeText), + tokenFeeFiatValue = TextReference.EMPTY, + maxNetworkFeeFiatValue = TextReference.EMPTY, + minTopUpFiatValue = TextReference.EMPTY, + feeNoteValue = TextReference.EMPTY, ), ) }