From 022c4bcfcdeb01379688453626952c5b304218b1 Mon Sep 17 00:00:00 2001 From: Tangem Date: Wed, 4 Dec 2024 14:13:00 +0300 Subject: [PATCH] Updated on 2026-08-14 --- .../common/ui/notifications/NotificationUM.kt | 8 +++---- .../ui/notifications/NotificationsFactory.kt | 5 ++++ core/res/src/main/res/values-de/strings.xml | 7 +++--- core/res/src/main/res/values-es/strings.xml | 5 ++++ core/res/src/main/res/values-fr/strings.xml | 5 ++++ core/res/src/main/res/values-ja/strings.xml | 18 +++++++++++--- core/res/src/main/res/values-ru/strings.xml | 10 ++++++-- core/res/src/main/res/values/strings.xml | 9 +++++-- .../state/confirm/SendNotificationFactory.kt | 7 +----- .../AddStakingNotificationsTransformer.kt | 5 ++++ .../viewmodel/StakingViewModel.kt | 24 ++++++++++++++++++- 11 files changed, 82 insertions(+), 21 deletions(-) diff --git a/common/ui/src/main/java/com/tangem/common/ui/notifications/NotificationUM.kt b/common/ui/src/main/java/com/tangem/common/ui/notifications/NotificationUM.kt index 83636c2a98..4db6780142 100644 --- a/common/ui/src/main/java/com/tangem/common/ui/notifications/NotificationUM.kt +++ b/common/ui/src/main/java/com/tangem/common/ui/notifications/NotificationUM.kt @@ -313,11 +313,11 @@ sealed class NotificationUM(val config: NotificationConfig) { data class RentInfo( private val rentInfo: CryptoCurrencyWarning.Rent, - ) : Info( - title = TextReference.Res(R.string.warning_rent_fee_title), + ) : Error( + title = TextReference.Res(R.string.send_notification_invalid_amount_title), subtitle = TextReference.Res( - id = R.string.warning_solana_rent_fee_message, - formatArgs = wrappedList(rentInfo.rent, rentInfo.exemptionAmount), + id = R.string.send_notification_invalid_amount_rent_fee, + formatArgs = wrappedList(rentInfo.exemptionAmount), ), ) } diff --git a/common/ui/src/main/java/com/tangem/common/ui/notifications/NotificationsFactory.kt b/common/ui/src/main/java/com/tangem/common/ui/notifications/NotificationsFactory.kt index 13b0c42b88..9841d58e02 100644 --- a/common/ui/src/main/java/com/tangem/common/ui/notifications/NotificationsFactory.kt +++ b/common/ui/src/main/java/com/tangem/common/ui/notifications/NotificationsFactory.kt @@ -345,6 +345,11 @@ object NotificationsFactory { } } + fun MutableList.addRentExemptionNotification(rentWarning: CryptoCurrencyWarning.Rent?) { + if (rentWarning == null) return + add(NotificationUM.Solana.RentInfo(rentWarning)) + } + private fun checkDustLimits( feeAmount: BigDecimal, receivedAmount: BigDecimal, diff --git a/core/res/src/main/res/values-de/strings.xml b/core/res/src/main/res/values-de/strings.xml index 1dd56ca271..7f2d6cb4e4 100644 --- a/core/res/src/main/res/values-de/strings.xml +++ b/core/res/src/main/res/values-de/strings.xml @@ -568,7 +568,7 @@ Identische Karten oder Ring Zugangscode Verfügbar mit %s - Anbieter erleichtern Transaktionen und sorgen für einen reibungslosen und effizienten Token-Austausch + Der Kauf von Kryptowährungen bei Tangem wird von Drittanbietern zu deren Bedingungen durchgeführt. Suche nach Land Nicht verfügbar Suche nach Währung @@ -585,7 +585,8 @@ Residenz Bitte wähle das richtige Land aus, um korrekte Zahlungsoptionen und Dienstleistungen zu gewährleisten. Einstellungen - Du kannst den Transaktionsstatus auf der Token-Seite überprüfen. + Du kannst den Transaktionsstatus auf der Token-Seite überprüfen. + Du kannst diesen Bildschirm schließen und den Transaktionsstatus auf dem Bildschirm mit den Token-Details überprüfen. Über Gruppe erstellen Nach Guthaben @@ -599,7 +600,6 @@ %1$s ( %2$s ) im %3$s Netzwerk Das Senden einer anderen Währung führt zu deren irreversiblem Verlust. Sende nur %s an diese Adresse. Der Versand einer anderen Währung führt zu ihrem unwiderruflichen Verlust. - Sende nur %s an diese Adresse. Überweise Geld von einem anderen Wallet oder einer anderen Börse Teilnehmen Die Informationen zum Empfehlungsprogramm konnten nicht geladen werden. Bitte versuche es später noch einmal. @@ -695,6 +695,7 @@ Die individuelle Gebühr ist hoch Aufgrund der Besonderheiten des Netzes %1$s ist die Gebühr für die Überweisung des gesamten Guthabens höher. Um die Kommission zu reduzieren, Kannst du %2$s verlassen. Die Gebühr ist höher + Dein Kontostand darf nicht niedriger sein als die Miete. Bitte halte mindestens %1$s auf Deinem Konto oder ziehe den gesamten Betrag ab. Die enthaltene Kommission übersteigt den Überweisungsbetrag, was zu einem negativen Wert führt Ungültige Menge Der Mindestbetrag für den Versand beträgt %1$s. Bitte stell sicher, dass der Restbetrag nach dem Versand nicht unter %2$s liegt. diff --git a/core/res/src/main/res/values-es/strings.xml b/core/res/src/main/res/values-es/strings.xml index ec232c3607..78fee270ad 100644 --- a/core/res/src/main/res/values-es/strings.xml +++ b/core/res/src/main/res/values-es/strings.xml @@ -252,6 +252,7 @@ Tangem ofrece swaps de tokens a través de proveedores externos según los términos de cada proveedor Elige un proveedor Ha ocurrido un error. Código: %s + Error %1$s. El proveedor seleccionado no puede procesar la transacción especificada. Por favor, redondee el valor a %2$s o cámbielo El proveedor seleccionado no está disponible actualmente. Inténtelo de nuevo más tarde. (Código: %s) Los cambios no están disponibles en este momento. Inténtelo de nuevo más tarde. (Código: %s) Cantidad estimada @@ -566,6 +567,7 @@ Restaurar código de acceso Tarjetas idénticas Código de acceso + Disponible con %s Buscar por país Indisponible Buscar por moneda @@ -582,6 +584,7 @@ Residencia Seleccione el país correcto para garantizar opciones de pago y servicios precisos. Ajustes + Puede comprobar el estado de la transacción desde la página del token. Puede comprobar el estado de la transacción desde la página del token Vía Agrupar @@ -592,7 +595,9 @@ Ajustes No ha dado acceso a su cámara Acceso a la cámara denegado + No se requiere nota %1$s (%2$s) en la red %3$s + El envío de cualquier otra moneda supondrá una pérdida irreversible. Envíe solo %s a esta dirección. Enviar cualquier otra moneda resultará en su pérdida irreversible. Transfiera fondos desde otra billetera o intercambio Participar diff --git a/core/res/src/main/res/values-fr/strings.xml b/core/res/src/main/res/values-fr/strings.xml index f57331a0f4..f1a4e1d5a3 100644 --- a/core/res/src/main/res/values-fr/strings.xml +++ b/core/res/src/main/res/values-fr/strings.xml @@ -252,6 +252,7 @@ Tangem propose des échanges de jetons via des fournisseurs tiers selon les conditions de chaque fournisseur Choisissez un fournisseur Une erreur s\'est produite. Code : %s + Erreur %1$s. Le fournisseur sélectionné ne peut pas traiter la transaction spécifiée. Veuillez arrondir la valeur à %2$s ou la modifier Le fournisseur sélectionné n\'est pas disponible pour le moment. Veuillez réessayer plus tard. (Code : %s) Les échanges ne sont pas disponibles pour le moment. Veuillez réessayer plus tard. (Code : %s) Montant estimé @@ -566,6 +567,7 @@ Restauration du code d\'accès Cartes identiques Code d\'accès + Disponible avec %s Recherche par pays Indisponible Recherche par devise @@ -582,6 +584,7 @@ Résidence Veuillez sélectionner le bon pays pour garantir des options de paiement et des services précis. Paramètres + Vous pouvez vérifier l\'état de la transaction à partir de la page du jeton. Vous pouvez vérifier l\'état de la transaction à partir de la page du jeton Via Grouper @@ -592,7 +595,9 @@ Paramètres Vous n\'avez pas donné accès à votre caméra Accès à la caméra refusé + Aucun mémo requis %1$s (%2$s) sur le réseau %3$s + L’envoi de toute autre devise entraînera sa perte irréversible. Envoyez uniquement %s à cette adresse. L\'envoi de toute autre devise entraînera sa perte irréversible. Transférez des fonds depuis un autre portefeuille ou une autre bourse Participer diff --git a/core/res/src/main/res/values-ja/strings.xml b/core/res/src/main/res/values-ja/strings.xml index 871580ab2e..571e1333e8 100644 --- a/core/res/src/main/res/values-ja/strings.xml +++ b/core/res/src/main/res/values-ja/strings.xml @@ -3,10 +3,17 @@ トークンが見つかりませんか?メインページのマーケットセクションに移動し、ポートフォリオに追加して買付できるようにします。 トークンが見つかりませんか?メインページのマーケットセクションに移動し、ポートフォリオに追加して売却できるようにします。 売却 + 接続には数秒かかる場合があります。しばらくお待ちください。 + 接続 + この操作は現在利用できません。しばらくしてからもう一度お試しいただくか、画面を下にスワイプしてデータを更新してください。 トークンを選択 トークンが見つかりませんか?メインページのマーケットセクションに移動し、ポートフォリオに追加してスワップできるようにします。 選択したトークンと交換できるトークンがありません。別のトークンを選択してください。 利用可能なペアがありません + 交換機能を使用するには、ポートフォリオに少なくとも2つのトークンが含まれている必要があります。 + トークンの追加 + ポートフォリオに追加されているトークンは1つだけです。交換機能を使用するには、少なくとも2つのトークンを追加する必要があります。 + トークンの追加 受け取りたいトークンを選択します スワップしたいトークンを選択します ネットワークを選択 @@ -260,6 +267,9 @@ 金額は %1$s(%2$sネットワーク)で返金されました 確認するには、プロバイダーのウェブサイトにアクセスしてください。 プロバイダーによる本人確認手続きが必要です。 + 買付完了 + 買付中 + 買付中... キャンセルされました 確認済み 確認中 @@ -560,7 +570,7 @@ 同一のカード アクセスコード %sで利用可能 - プロバイダーは取引を促進し、スムーズで効率的なトークン交換を保証します + Tangemでの暗号通貨の買付は、サードパーティプロバイダーの条件に基づいて行われます。 国で検索 利用不可 通貨で検索 @@ -577,7 +587,8 @@ 住居 正確なお支払い方法とサービスを確保するため、正しい国を選択してください。 設定 - トークンページから取引状況を確認できます + トークンページから取引状況を確認できます。 + この画面を閉じて、トークンの詳細画面で取引状況を確認できます。 経由 グループ 残高順 @@ -591,7 +602,7 @@ %3$sネットワーク上の%1$s ( %2$s ) 他の暗号資産を送信すると、取り返しのつかない損失が発生します。 このアドレスには%sのみを送金してください。他のトークンを送信すると、取り返しのつかない損失が発生します。 - このアドレスには%sのみを送信してください。 + %2$sネットワークの%1$sのみを送信してください ウォレットや取引所から資金を送金する 参加する 紹介プログラムに関する情報を読み込めませんでした。しばらくしてからもう一度お試しください。 @@ -685,6 +696,7 @@ カスタム手数料が高くなっています %1$sネットワークの特殊性により、残高全体を転送する場合の手数料は高くなります。手数料を削減するには、 %2$sを残します。 手数料が高くなっています + 口座残高はレンタル料金より低くすることはできません。残高を少なくとも%1$sに維持するか、すべての資金を引き出してください。 手数料が送金金額を超えており、マイナスの値になってしまいます。 無効な金額 最低送金金額は%1$sです。送金後の残高が%2$s未満にならないようにしてください。 diff --git a/core/res/src/main/res/values-ru/strings.xml b/core/res/src/main/res/values-ru/strings.xml index 4a4acfb3b9..0576b37e83 100644 --- a/core/res/src/main/res/values-ru/strings.xml +++ b/core/res/src/main/res/values-ru/strings.xml @@ -13,6 +13,8 @@ Нет доступных пар Для использования функции обмена ваш портфель должен содержать минимум 2 токена. Добавьте токены + У вас добавлен всего 1 токен. Для использования функции обмена необходимо добавить минимум 2 токена. + Добавьте токены Выберите токен для получения Выберите токен для обмена Выберите сеть @@ -188,7 +190,7 @@ Отправить Успешно Поддержка - Обмен + Обменять условия участия Условиями использования Сегодня @@ -275,6 +277,9 @@ Сумма была возвращена в %1$s (%2$s сети) Посетите сайт провайдера для проверки Провайдер запрашивает прохождение верификации + Куплено + Покупка + Покупка... Отменен Подтверждено Подтверждение @@ -605,6 +610,7 @@ Страна проживания Пожалуйста, укажите правильную страну, чтобы обеспечить точность доступных способов оплаты и услуг. Настройки + You can close this screen and check the transaction status on the token details screen. Вы можете закрыть этот экран и проверить статус транзакции на экране информации о токене. Через Группы @@ -619,7 +625,7 @@ %1$s (%2$s) в сети %3$s Использование другой сети может привести к утрате средств. Отправляйте только %s на этот адрес. Использование другой сети может привести к утрате средств. - Отправляйте только %s на этот адрес + Отправляйте только %1$s в сети %2$s Переводите средства с любого кошелька или биржи Участвовать Не удалось загрузить информацию по реферальной программе. Пожалуйста, попробуйте позже. diff --git a/core/res/src/main/res/values/strings.xml b/core/res/src/main/res/values/strings.xml index 5410db20c5..7d5f44aa6f 100644 --- a/core/res/src/main/res/values/strings.xml +++ b/core/res/src/main/res/values/strings.xml @@ -13,6 +13,8 @@ No available pair To use the exchange feature, your portfolio must contain at least 2 tokens. Add tokens + You only have 1 token added to your portfolio. To use the exchange feature, you need to add at least 2 tokens. + Add tokens Choose the token you want to receive Choose the token you want to swap Choose network @@ -269,6 +271,9 @@ The amount was refunded in %1$s (%2$s network) Visit provider’s website for verification KYC verification required by provider + Bought + Buying + Buying... Canceled Confirmed Confirming @@ -591,7 +596,7 @@ Residence Please select the correct country to ensure accurate payment options and services. Settings - You can check the transaction status from the token page. + You can close this screen and check the transaction status on the token details screen. You can close this screen and check the transaction status on the token details screen. Via Group @@ -606,7 +611,7 @@ %1$s (%2$s) on %3$s network Sending any other currency will result in its irreversible loss. Send only %s to this address. Sending any other currency will result in its irreversible loss. - Send only %s to this address. + Send only %1$s on the %2$s network Transfer funds from any wallet or exchange Participate Failed to load the information about the referral program. Please try again later. diff --git a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/confirm/SendNotificationFactory.kt b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/confirm/SendNotificationFactory.kt index 21604ac0b0..15e64cde68 100644 --- a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/confirm/SendNotificationFactory.kt +++ b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/confirm/SendNotificationFactory.kt @@ -12,6 +12,7 @@ import com.tangem.common.ui.notifications.NotificationsFactory.addExistentialWar import com.tangem.common.ui.notifications.NotificationsFactory.addFeeCoverageNotification import com.tangem.common.ui.notifications.NotificationsFactory.addFeeUnreachableNotification import com.tangem.common.ui.notifications.NotificationsFactory.addMinimumAmountErrorNotification +import com.tangem.common.ui.notifications.NotificationsFactory.addRentExemptionNotification import com.tangem.common.ui.notifications.NotificationsFactory.addReserveAmountErrorNotification import com.tangem.common.ui.notifications.NotificationsFactory.addTransactionLimitErrorNotification import com.tangem.common.ui.notifications.NotificationsFactory.addValidateTransactionNotifications @@ -22,7 +23,6 @@ import com.tangem.domain.tokens.GetBalanceNotEnoughForFeeWarningUseCase import com.tangem.domain.tokens.GetCurrencyCheckUseCase import com.tangem.domain.tokens.model.CryptoCurrencyStatus import com.tangem.domain.tokens.model.warnings.CryptoCurrencyCheck -import com.tangem.domain.tokens.model.warnings.CryptoCurrencyWarning import com.tangem.domain.transaction.error.GetFeeError import com.tangem.domain.transaction.usecase.ValidateTransactionUseCase import com.tangem.domain.utils.convertToSdkAmount @@ -312,9 +312,4 @@ internal class SendNotificationFactory( add(NotificationUM.Warning.TooHigh(diff)) } } - - private fun MutableList.addRentExemptionNotification(rentWarning: CryptoCurrencyWarning.Rent?) { - if (rentWarning == null) return - add(NotificationUM.Solana.RentInfo(rentWarning)) - } } \ No newline at end of file diff --git a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/notifications/AddStakingNotificationsTransformer.kt b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/notifications/AddStakingNotificationsTransformer.kt index 530e3cc24b..d96cda409d 100644 --- a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/notifications/AddStakingNotificationsTransformer.kt +++ b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/notifications/AddStakingNotificationsTransformer.kt @@ -7,6 +7,7 @@ import com.tangem.common.ui.notifications.NotificationsFactory.addExceedsBalance import com.tangem.common.ui.notifications.NotificationsFactory.addExistentialWarningNotification import com.tangem.common.ui.notifications.NotificationsFactory.addFeeCoverageNotification import com.tangem.common.ui.notifications.NotificationsFactory.addFeeUnreachableNotification +import com.tangem.common.ui.notifications.NotificationsFactory.addRentExemptionNotification import com.tangem.common.ui.notifications.NotificationsFactory.addReserveAmountErrorNotification import com.tangem.common.ui.notifications.NotificationsFactory.addTransactionLimitErrorNotification import com.tangem.common.ui.notifications.NotificationsFactory.addValidateTransactionNotifications @@ -189,6 +190,10 @@ internal class AddStakingNotificationsTransformer( val appCurrency = appCurrencyProvider() val cryptoCurrency = cryptoCurrencyStatus.currency + addRentExemptionNotification( + rentWarning = currencyCheck.rentWarning, + ) + addExistentialWarningNotification( existentialDeposit = currencyCheck.existentialDeposit, feeAmount = feeState?.fee?.amount?.value.orZero(), diff --git a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/viewmodel/StakingViewModel.kt b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/viewmodel/StakingViewModel.kt index b28cfd94ad..cc9c77201e 100644 --- a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/viewmodel/StakingViewModel.kt +++ b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/viewmodel/StakingViewModel.kt @@ -69,6 +69,7 @@ import com.tangem.features.staking.impl.presentation.state.transformers.confirma import com.tangem.features.staking.impl.presentation.state.transformers.notifications.AddStakingNotificationsTransformer import com.tangem.features.staking.impl.presentation.state.transformers.notifications.DismissStakingNotificationsStateTransformer import com.tangem.features.staking.impl.presentation.state.transformers.validator.ValidatorSelectChangeTransformer +import com.tangem.features.staking.impl.presentation.state.utils.checkAndCalculateSubtractedAmount import com.tangem.features.staking.impl.presentation.state.utils.isSingleAction import com.tangem.features.staking.impl.presentation.state.utils.withStubUnstakeAction import com.tangem.utils.Provider @@ -633,12 +634,17 @@ internal class StakingViewModel @Inject constructor( ).leftOrNull() } + val balanceAfterTransaction = calculateBalanceAfterTransaction( + amount = amount.orZero(), + fee = fee.orZero(), + reduceAmountBy = confirmationState?.reduceAmountBy.orZero(), + ) val currencyStatus = getCurrencyCheckUseCase( userWalletId = userWalletId, currencyStatus = cryptoCurrencyStatus, amount = amount, fee = fee, - balanceAfterTransaction = null, // ignore this in staking + balanceAfterTransaction = balanceAfterTransaction, ) stateController.update( AddStakingNotificationsTransformer( @@ -687,6 +693,22 @@ internal class StakingViewModel @Inject constructor( stateController.update(DismissStakingNotificationsStateTransformer(notification)) } + private fun calculateBalanceAfterTransaction( + amount: BigDecimal, + fee: BigDecimal, + reduceAmountBy: BigDecimal, + ): BigDecimal? { + val subtractedBalanceAmount = checkAndCalculateSubtractedAmount( + isAmountSubtractAvailable = isAmountSubtractAvailable, + cryptoCurrencyStatus = cryptoCurrencyStatus, + amountValue = amount.orZero(), + feeValue = fee.orZero(), + reduceAmountBy = reduceAmountBy, + ) + val statusValue = cryptoCurrencyStatus.value as? CryptoCurrencyStatus.Loaded + return statusValue?.let { it.amount - subtractedBalanceAmount - fee.orZero() } + } + private fun awaitForAllowance() { val approval = stakingApproval as? StakingApproval.Needed ?: return allowanceTaskScheduler.scheduleTask(