diff --git a/core/res/src/main/res/values-de/strings.xml b/core/res/src/main/res/values-de/strings.xml index 7c327c914d..6960013a5c 100644 --- a/core/res/src/main/res/values-de/strings.xml +++ b/core/res/src/main/res/values-de/strings.xml @@ -1743,11 +1743,9 @@ Die Netzwerkgebühr wird von dem Betrag, den Du abhebst, abgezogen. Effektiver Jahreszins für Versorgung Effektiver Jahreszins - Lass Dein Geld arbeiten – verdiene Zinsen auf Dein Guthaben. Zinsen fallen automatisch an Ertragsmodus Bearbeitung Deiner Einzahlung - Lass dein Guthaben arbeiten Automatisch Einzahlung von %1$s %2$s zur Deckung der Netzwerkgebühr für Transaktionen Die Gebühr %s kann nicht gedeckt werden diff --git a/core/res/src/main/res/values-es/strings.xml b/core/res/src/main/res/values-es/strings.xml index 543707a0b6..1a93e0147b 100644 --- a/core/res/src/main/res/values-es/strings.xml +++ b/core/res/src/main/res/values-es/strings.xml @@ -1544,11 +1544,9 @@ La comisión de red se deducirá del importe que retire. Suministro APY APY - Deje que sus fondos hagan el trabajo mientras usted mantiene el control. Los intereses se devengan automáticamente Modo de rendimiento Procesando su depósito - Haga que sus activos trabajen para usted Automático Deposite algo de %1$s %2$s para cubrir la tarifa de red para las transacciones No se puede cubrir la tarifa %s diff --git a/core/res/src/main/res/values-fr/strings.xml b/core/res/src/main/res/values-fr/strings.xml index 0a4d433a00..8c6ab60718 100644 --- a/core/res/src/main/res/values-fr/strings.xml +++ b/core/res/src/main/res/values-fr/strings.xml @@ -1464,6 +1464,7 @@ Les frais seront prélevés et vos actifs seront à nouveau prêtés. Pour continuer à percevoir des revenus, une autorisation est nécessaire. Confirmer l\'approbation + Vos fonds sont actuellement affectés au protocole Aave, mais vous pouvez les gérer à tout moment. Vos %s sont déposés dans Aave. Impossible de charger le graphique... Le montant reçu, %1$s %2$s, n\'a pas été fourni à Aave. @@ -1490,6 +1491,7 @@ Tangem prélève également des frais de service de 15% sur les revenus générés. Vos fonds seront automatiquement transférés vers Aave dès que les frais de réseau seront moins élevés ou que votre solde atteindra le montant minimum requis. Rendements historiques + L\'autorisation pour votre token en mode Yield a été révoquée. Ouvrez le token pour accorder à nouveau l\'autorisation. Approbations de tokens nécessaires Vérifiez votre connexion réseau. Informations sur les frais de réseau inaccessibles @@ -1521,11 +1523,9 @@ Les frais de réseau seront déduits du montant que vous retirez. Rendement annuel brut (APY) APY - Laissez vos fonds travailler pour vous tout en gardant le contrôle. Les intérêts sont cumulés automatiquement. Mode de rendement Traitement de votre dépôt - Faites fructifier vos actifs Automatique Déposez %1$s %2$s pour couvrir les frais de réseau liés aux transactions. Impossible de couvrir les frais %s diff --git a/core/res/src/main/res/values-ja/strings.xml b/core/res/src/main/res/values-ja/strings.xml index dce2316a93..2d8b7ca984 100644 --- a/core/res/src/main/res/values-ja/strings.xml +++ b/core/res/src/main/res/values-ja/strings.xml @@ -1811,11 +1811,11 @@ 供給 供給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 ce557b4570..481e539277 100644 --- a/core/res/src/main/res/values-ru/strings.xml +++ b/core/res/src/main/res/values-ru/strings.xml @@ -1636,11 +1636,9 @@ Комиссия сети будет вычтена из суммы вашего вывода. Годовая доходность (APY) APY - Пусть ваши деньги работают — зарабатывайте проценты на свой баланс. Проценты начисляются автоматически. Режим доходности Отправка ваших средств - Пусть ваш баланс работает на вас! Автоматически Внесите немного %1$s %2$s, чтобы покрыть комиссию сети за транзакции. Невозможно покрыть комиссию в %s 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 fc85d8d240..6812790144 100644 --- a/core/res/src/main/res/values-uk-rUA/strings.xml +++ b/core/res/src/main/res/values-uk-rUA/strings.xml @@ -1500,11 +1500,9 @@ Комісія мережі буде вирахувана з суми, яку ви знімаєте. Річна прибутковість (APY) APY - Нехай ваші гроші працюють — заробляйте відсотки на свій рахунок. Відсотки нараховуються автоматично Режим дохідності Відправка ваших коштів - Нехай ваш баланс працює на вас! Автоматично Внесіть трохи %1$s %2$s, щоб покрити комісію мережі за транзакції. Неможливо покрити комісію в %s diff --git a/core/res/src/main/res/values/strings.xml b/core/res/src/main/res/values/strings.xml index ce40321393..51c96443a0 100644 --- a/core/res/src/main/res/values/strings.xml +++ b/core/res/src/main/res/values/strings.xml @@ -1883,11 +1883,11 @@ Supply Supply APY APY - Let your funds do the work while you stay in control. + Interest accrues automatically Interest accrues automatically Yield mode Processing your deposit - Interest accrues automatically + Yield Mode Automatic Deposit some %1$s %2$s to cover the network fee for transactions Unable to cover %s fee diff --git a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/main/model/YieldSupplyModel.kt b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/main/model/YieldSupplyModel.kt index fa03433676..bf4ac35878 100644 --- a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/main/model/YieldSupplyModel.kt +++ b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/main/model/YieldSupplyModel.kt @@ -13,6 +13,7 @@ import com.tangem.core.ui.extensions.combinedReference import com.tangem.core.ui.extensions.resourceReference import com.tangem.core.ui.extensions.stringReference import com.tangem.domain.balancehiding.GetBalanceHidingSettingsUseCase +import com.tangem.domain.models.StatusSource import com.tangem.domain.models.currency.CryptoCurrency import com.tangem.domain.models.currency.CryptoCurrencyStatus import com.tangem.domain.models.currency.yieldSupplyNotAllAmountSupplied @@ -35,6 +36,8 @@ import com.tangem.features.yield.supply.impl.main.model.transformers.YieldSupply import com.tangem.utils.coroutines.CoroutineDispatcherProvider import com.tangem.utils.coroutines.DelayedWork import com.tangem.utils.transformer.update +import com.tangem.utils.coroutines.JobHolder +import com.tangem.utils.coroutines.saveIn import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.delay import kotlinx.coroutines.flow.* @@ -84,6 +87,7 @@ internal class YieldSupplyModel @Inject constructor( field = MutableStateFlow(false) private var lastYieldSupplyStatus: YieldSupplyStatus? = null + private val fetchCurrencyJobHolder = JobHolder() init { checkIfYieldSupplyIsAvailable() @@ -183,6 +187,19 @@ internal class YieldSupplyModel @Inject constructor( val yieldSupplyStatus = cryptoCurrencyStatus.value.yieldSupplyStatus val tokenProtocolStatus = yieldSupplyRepository.getTokenProtocolStatus(cryptoCurrency) val isActive = yieldSupplyStatus?.isActive == true + val isCryptoCurrencyStatusFromCache = cryptoCurrencyStatus.value.sources.networkSource != StatusSource.ACTUAL + val processing = uiState.value is YieldSupplyUM.Processing + Timber.d( + "currentUiState ${uiState.value.javaClass} \n" + + "yieldSupplyStatus $yieldSupplyStatus" + + "tokenProtocolStatus $tokenProtocolStatus " + + "isActive $isActive " + + "processing $processing " + + "isCryptoCurrencyStatusFromCache $isCryptoCurrencyStatusFromCache", + ) + if (isCryptoCurrencyStatusFromCache && processing) { + return + } when { !isActive && tokenProtocolStatus == YieldSupplyEnterStatus.Enter -> { @@ -215,8 +232,10 @@ internal class YieldSupplyModel @Inject constructor( userWalletId = userWallet.walletId, network = cryptoCurrency.network, ), - ) - } + ).onLeft { + fetchCurrencyWithDelay() + } + }.saveIn(fetchCurrencyJobHolder) } private fun loadActiveState(cryptoCurrencyStatus: CryptoCurrencyStatus, yieldSupplyStatus: YieldSupplyStatus) { diff --git a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/main/model/transformers/YieldSupplyTokenStatusSuccessTransformer.kt b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/main/model/transformers/YieldSupplyTokenStatusSuccessTransformer.kt index 6fe83f309a..ef9f8b8a99 100644 --- a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/main/model/transformers/YieldSupplyTokenStatusSuccessTransformer.kt +++ b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/main/model/transformers/YieldSupplyTokenStatusSuccessTransformer.kt @@ -17,7 +17,9 @@ internal class YieldSupplyTokenStatusSuccessTransformer( if (!tokenStatus.isActive) return YieldSupplyUM.Unavailable return YieldSupplyUM.Available( - title = resourceReference(R.string.yield_module_token_details_earn_notification_title), + title = resourceReference( + R.string.yield_module_token_details_earn_notification_earning_on_your_balance_title, + ), onClick = onStartEarningClick, apy = tokenStatus.apy.toString(), apyText = combinedReference( diff --git a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/main/ui/YieldSupplyBlockContent.kt b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/main/ui/YieldSupplyBlockContent.kt index 2066b6ea26..af19fd4a55 100644 --- a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/main/ui/YieldSupplyBlockContent.kt +++ b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/main/ui/YieldSupplyBlockContent.kt @@ -63,7 +63,7 @@ internal fun YieldSupplyBlockContent(yieldSupplyUM: YieldSupplyUM, modifier: Mod private fun SupplyAvailable(supplyUM: YieldSupplyUM.Available, modifier: Modifier = Modifier) { SupplyInfo( title = resourceReference(R.string.yield_module_token_details_earn_notification_earning_on_your_balance_title), - subtitle = supplyUM.title, + subtitle = resourceReference(R.string.yield_module_token_details_earn_notification_description), rewardsApy = supplyUM.apyText, iconTint = TangemTheme.colors.icon.accent, modifier = modifier, @@ -292,12 +292,12 @@ private fun SupplyInfo( if (rewardsApy != null) { Text( text = StringsSigns.DOT, - style = TangemTheme.typography.subtitle1, + style = TangemTheme.typography.subtitle2, color = TangemTheme.colors.text.tertiary, ) Text( text = rewardsApy.resolveReference(), - style = TangemTheme.typography.subtitle1, + style = TangemTheme.typography.subtitle2, maxLines = 1, color = TangemTheme.colors.text.accent, )