diff --git a/common/ui/src/main/java/com/tangem/common/ui/amountScreen/converters/AmountStateConverter.kt b/common/ui/src/main/java/com/tangem/common/ui/amountScreen/converters/AmountStateConverter.kt index 937f94852b..ac0ebecf2f 100644 --- a/common/ui/src/main/java/com/tangem/common/ui/amountScreen/converters/AmountStateConverter.kt +++ b/common/ui/src/main/java/com/tangem/common/ui/amountScreen/converters/AmountStateConverter.kt @@ -9,6 +9,7 @@ import com.tangem.common.ui.amountScreen.models.AmountSegmentedButtonsConfig import com.tangem.common.ui.amountScreen.models.AmountState import com.tangem.common.ui.amountScreen.models.EnterAmountBoundary import com.tangem.core.ui.components.currency.icon.converter.CryptoCurrencyToIconStateConverter +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 @@ -18,6 +19,7 @@ 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.utils.Provider +import com.tangem.utils.StringsSigns.DOT import com.tangem.utils.converter.Converter import com.tangem.utils.isNullOrZero import kotlinx.collections.immutable.persistentListOf @@ -120,7 +122,11 @@ class AmountStateConverterV2( return AmountState.Data( title = value.title, availableBalance = if (isRedesignEnabled) { - resourceReference(R.string.common_balance, wrappedList(crypto)) + combinedReference( + stringReference(crypto), + stringReference(" $DOT "), + stringReference(fiat), + ) } else { resourceReference(R.string.common_crypto_fiat_format, wrappedList(crypto, fiat)) }, diff --git a/common/ui/src/main/java/com/tangem/common/ui/amountScreen/converters/field/AmountBoundaryUpdateTransformer.kt b/common/ui/src/main/java/com/tangem/common/ui/amountScreen/converters/field/AmountBoundaryUpdateTransformer.kt index 8761c5abb0..89c1074a49 100644 --- a/common/ui/src/main/java/com/tangem/common/ui/amountScreen/converters/field/AmountBoundaryUpdateTransformer.kt +++ b/common/ui/src/main/java/com/tangem/common/ui/amountScreen/converters/field/AmountBoundaryUpdateTransformer.kt @@ -3,13 +3,16 @@ package com.tangem.common.ui.amountScreen.converters.field import com.tangem.common.ui.R import com.tangem.common.ui.amountScreen.models.AmountState import com.tangem.common.ui.amountScreen.models.EnterAmountBoundary +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.utils.StringsSigns.DOT import com.tangem.utils.transformer.Transformer /** @@ -34,7 +37,11 @@ class AmountBoundaryUpdateTransformer( val crypto = maxEnterAmount.amount.format { crypto(cryptoCurrencyStatus.currency) } val availableBalance = if (isRedesignEnabled) { - resourceReference(R.string.common_balance, wrappedList(crypto)) + combinedReference( + stringReference(crypto), + stringReference(" $DOT "), + stringReference(fiat), + ) } else { resourceReference(R.string.common_crypto_fiat_format, wrappedList(crypto, fiat)) } diff --git a/common/ui/src/main/java/com/tangem/common/ui/amountScreen/ui/AmountFieldContainer.kt b/common/ui/src/main/java/com/tangem/common/ui/amountScreen/ui/AmountFieldContainer.kt index a1ba4366f4..9c31705709 100644 --- a/common/ui/src/main/java/com/tangem/common/ui/amountScreen/ui/AmountFieldContainer.kt +++ b/common/ui/src/main/java/com/tangem/common/ui/amountScreen/ui/AmountFieldContainer.kt @@ -113,7 +113,7 @@ internal fun LazyListScope.amountFieldV2( } else { Text( text = amountState.title.resolveReference(), - style = TangemTheme.typography.caption2, + style = TangemTheme.typography.subtitle2, color = TangemTheme.colors.text.tertiary, ) } @@ -164,7 +164,7 @@ private fun AmountInfo(amountUM: AmountState, onMaxAmountClick: () -> Unit, modi modifier = Modifier .padding(end = 16.dp) .clip(RoundedCornerShape(16.dp)) - .background(TangemTheme.colors.background.secondary) + .background(TangemTheme.colors.button.secondary) .clickable( interactionSource = remember { MutableInteractionSource() }, indication = ripple(), diff --git a/common/ui/src/main/java/com/tangem/common/ui/amountScreen/ui/AmountFieldV2.kt b/common/ui/src/main/java/com/tangem/common/ui/amountScreen/ui/AmountFieldV2.kt index 184f7ed46e..96635bbc45 100644 --- a/common/ui/src/main/java/com/tangem/common/ui/amountScreen/ui/AmountFieldV2.kt +++ b/common/ui/src/main/java/com/tangem/common/ui/amountScreen/ui/AmountFieldV2.kt @@ -127,7 +127,7 @@ private fun AmountSecondary(amountUM: AmountState, onCurrencyChange: (Boolean) - modifier = Modifier .fillMaxWidth() .animateContentSize() - .padding(top = 8.dp), + .padding(top = 4.dp), ) { if (amountUM is AmountState.Empty) { TextShimmer( @@ -141,6 +141,7 @@ private fun AmountSecondary(amountUM: AmountState, onCurrencyChange: (Boolean) - AmountFieldCurrencyInfo( amountUM = amountUM, onCurrencyChange = onCurrencyChange, + ) AmountFieldError( isError = amountUM.amountTextField.isError, @@ -148,7 +149,7 @@ private fun AmountSecondary(amountUM: AmountState, onCurrencyChange: (Boolean) - error = amountUM.amountTextField.error, modifier = Modifier .align(BottomCenter) - .padding(top = 20.dp), + .padding(top = 24.dp), ) } } @@ -161,12 +162,13 @@ private fun BoxScope.AmountFieldCurrencyInfo(amountUM: AmountState.Data, onCurre horizontalArrangement = Arrangement.spacedBy(4.dp), modifier = Modifier .align(TopCenter) - .padding(bottom = 20.dp) + .padding(bottom = 16.dp) .clickable( interactionSource = remember { MutableInteractionSource() }, indication = null, onClick = { onCurrencyChange(!amountUM.amountTextField.isFiatValue) }, - ), + ) + .padding(4.dp), ) { val iconRotateState by animateFloatAsState( targetValue = if (amountUM.amountTextField.isFiatValue) ROTATED_DEGREE else INITIAL_DEGREE, @@ -324,6 +326,7 @@ private class AmountFieldV2PreviewProvider : PreviewParameterProviderDetails Überprüfe deine Internetverbindung oder wechseln zu einem anderen Netzwerk Nutzungsbedingungen + Hallo Support-Team, ich habe einen Fehler mit dem Code %s festgestellt. + WalletConnect-Fehler Du hast eine Karte oder Ring aus einer anderen Wallet verwendet. Tippe auf die Karte oder Ring, die dieser Wallet zugeordnet ist. Nicht genug Geld für die Transaktion. Bitte lade dein Konto auf. Meine Token @@ -1431,6 +1433,12 @@ Alle trennen Text über die Trennung aller dApps Alle dApps trennen + Versuchen Sie erneut, mit einer neuen URI zu koppeln + Ungültige dApp-Domain + %s gibt keine Blockchains an — weder erforderlich noch optional.\nBitte stellen Sie sicher, dass Sie die richtige URI verwendet haben + Keine Netzwerke + Bitte generieren Sie eine neue URI und versuchen Sie erneut, eine Verbindung herzustellen + Verbindungsvorschlag abgelaufen Geschätzte Wallet-Änderungen Die Transaktion konnte nicht simuliert werden. Bitte sei vorsichtig. Böswillige/ gefährliche Transaktion diff --git a/core/res/src/main/res/values-es/strings.xml b/core/res/src/main/res/values-es/strings.xml index f134baf614..8d38231daf 100644 --- a/core/res/src/main/res/values-es/strings.xml +++ b/core/res/src/main/res/values-es/strings.xml @@ -318,7 +318,8 @@ Compruebe su conexión a internet o cambia a una red diferente Condiciones de uso Recibir activos - Error de Wallet Connect + Hola equipo de soporte, he encontrado un error con el código: %s + Error de WalletConnect Ha usado una tarjeta de otra billetera. Toque la tarjeta asociada con esta billetera No hay fondos suficientes para la transacción. Por favor, recargue su cuenta. Mis tokens diff --git a/core/res/src/main/res/values-fr/strings.xml b/core/res/src/main/res/values-fr/strings.xml index 2ea53e27ab..00b0250a97 100644 --- a/core/res/src/main/res/values-fr/strings.xml +++ b/core/res/src/main/res/values-fr/strings.xml @@ -293,6 +293,8 @@ Détails Vérifiez votre connexion Internet ou passez à un réseau différent Conditions d\'utilisation + Bonjour équipe de support, j’ai rencontré une erreur avec le code : %s + Erreur WalletConnect Vous avez utilisé une carte d\'un autre portefeuille. Appuyez sur la carte associée à ce portefeuille Pas assez de fonds pour la transaction. Veuillez recharger votre compte. Mes jetons @@ -1332,6 +1334,12 @@ Déconnecter tout Texte sur la déconnexion de toutes les dApps Déconnecter toutes les dApps + Essayez de jumeler à nouveau avec un nouvel URI + Domaine dApp invalide + %s ne spécifie aucune blockchain — ni requise ni optionnelle.\nVeuillez vous assurer que vous avez utilisé l’URI correct + Aucun réseau + Veuillez générer un nouvel URI et essayer de vous connecter à nouveau + La proposition de connexion a expiré Modifications estimées du portefeuille La transaction n\'a pas pu être simulée. Veuillez procéder avec prudence. Transaction malveillante diff --git a/core/res/src/main/res/values-it/strings.xml b/core/res/src/main/res/values-it/strings.xml index 82010eacf1..a585f2e30a 100644 --- a/core/res/src/main/res/values-it/strings.xml +++ b/core/res/src/main/res/values-it/strings.xml @@ -10,6 +10,7 @@ Impossibile creare la transazione Non hai fornito l\'accesso alla tua videocamera, modifica le tue impostazioni sulla privacy Annulla + Scegli portafoglio Connessione in corso Rimuovere Fatto @@ -39,6 +40,8 @@ Firmato Requisiti Termini del servizio + Ciao team di supporto, ho riscontrato un errore con il codice: %s + Errore WalletConnect Not enough funds for the transaction. Please top up your account. An error occurred Notifica richiesta @@ -71,6 +74,12 @@ Nessuna connessione a Internet Tangem Ok, ho capito! + Prova a eseguire nuovamente l’associazione con un nuovo URI + Dominio dApp non valido + %s non specifica alcuna blockchain — né obbligatoria né opzionale.\nAssicurati di aver utilizzato l’URI corretto + Nessuna rete + Genera un nuovo URI e prova a connetterti di nuovo + La proposta di connessione è scaduta No, invia l\'intero importo Riduci di %s XTZ Per evitare di pagare una commissione maggiore la prossima volta che ricarichi il tuo portafoglio, riduci l\'importo di %s XTZ diff --git a/core/res/src/main/res/values-ja/strings.xml b/core/res/src/main/res/values-ja/strings.xml index 6c32d0ad19..ff32b8bf8b 100644 --- a/core/res/src/main/res/values-ja/strings.xml +++ b/core/res/src/main/res/values-ja/strings.xml @@ -352,6 +352,8 @@ 他のネットワークで資産を送金すると、永久に失われます。 %sネットワーク 下記のみを使用して資金を送金する + サポートチームの皆様、コード %s のエラーが発生しました。 + WalletConnect エラー 別のウォレットのカードまたはリングを使用しました。このウォレットにリンクしているカードまたはリングをタップしてください。 取引に必要な資金が不足しています。アカウントに入金してください。 マイトークン @@ -457,6 +459,7 @@ Tangemをスキャン %sへ %sネットワーク + アクセスコードの作成プロセスを終了してもよろしいですか? 今すぐバックアップ セットアップを完了するには、ウォレットをバックアップし、アクセスコードを使用してアプリへのアクセスを保護します。 今すぐ実施 @@ -975,17 +978,17 @@ 無効な金額 手数料が残高を超えています 合計金額が残高を超えています - トークンを変更してもよろしいですか? 変更後、以前のデータはリセットされます。 + 受信トークンを変更してもよろしいですか? 変更すると、以前入力したデータがリセットされます。 トークンの変更 スワップして送信 - 変換を続行しますか? 以前のデータはリセットされます。 + 変換を続行しますか? これにより以前のデータは消去されます。 変換を確定 トークンを送信すれば、送信中に変換されます。受信者は必要なものをシームレスに受け取ります。 受信者は受け取ります - 受信者に送信されます + 受取人へ 受取金額 - 変換をキャンセルしてもよろしいですか? 変更後、以前のデータはリセットされます。 - キャンセルを確定 + 変換をキャンセルしてもよろしいですか?以前のデータは消去されます。 + 変換を削除 スワップして送信 取引が送信されました 設定したいカードまたはリングをスキャンするために準備してください。 diff --git a/core/res/src/main/res/values-ru/strings.xml b/core/res/src/main/res/values-ru/strings.xml index 3807708210..5b238275be 100644 --- a/core/res/src/main/res/values-ru/strings.xml +++ b/core/res/src/main/res/values-ru/strings.xml @@ -116,7 +116,7 @@ Выберите действие Выберите сеть Выберите токен - Выберите кошелек + Выберите кошелёк Получить Вывести награду Закрыть @@ -291,6 +291,8 @@ Подробности Проверьте подключение с интернетом или переключитесь на другую сеть Условия использования + Привет, команда поддержки, у меня возникла ошибка с кодом: %s + Ошибка WalletConnect Вы использовали карту или кольцо от другого кошелька. Приложите карту или кольцо, связанную с этим кошельком. Недостаточно средств для совершения транзакции. Пожалуйста, пополните свой аккаунт. Мои токены @@ -1304,7 +1306,7 @@ Требуется трастлайн Вредоносный домен Неизвестный домен - Подключиться всё равно + Всё равно подключиться Ошибка тайм-аута. Пожалуйста, попробуйте позже. Не удалось подключиться через Wallet Connect Этот домен не может быть верифицирован. Внимательно проверьте запрос перед одобрением. @@ -1348,6 +1350,12 @@ dApp отключен Отключить все Отключить все dApp + Попробуйте соединиться снова, используя новый URI + Недействительный домен dApp + %s не указывает никаких блокчейнов — ни обязательных, ни опциональных.\nПожалуйста, убедитесь, что вы использовали правильный URI + Нет сетей + Пожалуйста, сгенерируйте новый URI и попробуйте подключиться снова + Предложение подключения истекло Предварительные изменения Не удалось выполнить симуляцию транзакции. Пожалуйста, действуйте с осторожностью. Оценка не поддерживается для %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 5f7bacb6cf..79d1d3c092 100644 --- a/core/res/src/main/res/values-uk-rUA/strings.xml +++ b/core/res/src/main/res/values-uk-rUA/strings.xml @@ -192,6 +192,7 @@ Відхилити Оновити Перейменувати + Обов\'язково Зберегти Зберегти зміни Пошук @@ -289,6 +290,8 @@ Деталі Перевірте підключення до інтернету або змініть мережу Умови використання + Привіт, команда підтримки, я зіткнувся з помилкою з кодом: %s + Помилка WalletConnect Ви використали картку або кільце від іншого гаманця. Прикладіть картку або кільце, пов\'язану з цим гаманцем. Недостатньо коштів для здійснення транзакції. Будь ласка, поповніть свій акаунт. Мої токени @@ -1289,18 +1292,64 @@ Відкрити Trustline Щоб отримати цей токен, потрібно увімкнути Trustline. Мережа вимагає резерв %1$s %2$s. Відкрийте Trustline + Невідомий домен + Все одно підключитися + Помилка тайм-ауту. Будь ласка, спробуйте пізніше. + Не вдалося зʼєднатися через Wallet Connect + Цей домен не може бути підтверджений. Уважно перевірте запит перед схваленням. Будь ласка, поверніться до браузеру і повторно підключіться через WalletConnect. + Сеанс Wallet Connect було завершено + Код помилки: %s. Якщо проблема зберігається, зверніться до нашої служби підтримки. + Ми зіткнулися з невідомою помилкою + Tangem наразі не підтримує необхідну мережу для %s. + Непідтримувані мережі + Tangem підтримує мережу, необхідну для %s + Верифікований домен Обрана не вірна картка або кільце + Схоже, виникла проблема + Усі dApps відключені Адреса Підключення + Мережа + Мережі + Гаманець + Підключений додаток Підключені мережі + Підключений до %1$s Переглянути баланс гаманця та активність + Підписати транзакцію без вашої участі + Запит схвалення на транзакцію + Не має можливості + Хотіли б Запит на підключення + З\'єднання Вміст Копіювати дані + dApp відключено + Розʼєднати все + Відключити всі dApps + Відключити всі dApps + Спробуйте ще раз з новим URI + Недійсний домен dApp + %s не вказує жодних блокчейнів — ні обов\'язкових, ні необов\'язкових. \n Переконайтеся, що ви використали правильний URI + Немає мереж + Будь ласка, згенеруйте новий URI та спробуйте ще раз + Термін для з’єднання минув + Поповніть баланс, щоб покрити комісію мережі + Недостатньо %1$s + Додайте %s мережі до вашого портфелю для цього гаманця + В гаманці не додані необхідні мережі + Нове з\'єднання + Підключайте свій гаманець до різних dApps + Немає підключень Виявлено потенційні ризики або шкідливу активність. Підключення чи підпис транзакцій можуть призвести до втрати коштів. + Відомий ризик безпеки + Відкрийте програму Web3 та виберіть опцію WalletConnect Запит від Тип підпису + Для підключення dApp потрібна принаймні одна мережа + Вкажіть вибрані мережі + Успішно підписано До Запит транзакції Запит транзакції diff --git a/core/res/src/main/res/values-zh-rTW/strings.xml b/core/res/src/main/res/values-zh-rTW/strings.xml index 256268c8fb..713520796a 100644 --- a/core/res/src/main/res/values-zh-rTW/strings.xml +++ b/core/res/src/main/res/values-zh-rTW/strings.xml @@ -52,6 +52,7 @@ 您尚未授予相機訪問權限,請更改您的隱私設置 删除 選擇代幣 + 選擇錢包 關閉 連線中 繼續 @@ -133,6 +134,7 @@ 更多 檢查您的網路連接或切換到其他網絡 服務條款 + 您好,支援團隊,我遇到了一個錯誤,代碼為:%s WalletConnect 錯誤 您使用了另一個錢包中的卡。點按與此錢包關聯的卡片 沒有足夠的資金進行交易。請先入金 @@ -377,6 +379,12 @@ 認證檢查失敗 網路無法使用 Solana 網絡每 2 天收取 %1$s 的費用。無法付此費用的帳戶將從網絡中清除。向您的帳戶存入超過 %2$s 即可免費使用 + 請使用新的 URI 再次嘗試配對 + 無效的 dApp 網域 + %s 未指定任何區塊鏈——無論是必須的還是可選的。\n請確保您使用了正確的 URI + 沒有網路 + 請生成新的 URI,然後再次嘗試連線 + 連線提案已過期 捨棄 您有一個備份中斷了,您想繼續嗎? 是的,恢復 diff --git a/core/res/src/main/res/values/strings.xml b/core/res/src/main/res/values/strings.xml index 0b4277eab7..4089de8ca8 100644 --- a/core/res/src/main/res/values/strings.xml +++ b/core/res/src/main/res/values/strings.xml @@ -12,6 +12,8 @@ Set a %s-digit Access Code to unlock your wallet. Create Access Code Access code + Recover + Archived Archive account Archive You are archiving this account, but you can always get it back. @@ -359,7 +361,8 @@ Sending assets in other networks will result in permanent loss. %s network Send funds using only - Wallet Connect error + Hi support team, I\'ve encountered an error with code: %s + WalletConnect error You have used a card or ring from another wallet. Tap the card or ring associated with this wallet Not enough funds for the transaction. Please top up your account. My tokens @@ -1002,6 +1005,7 @@ Recipient will receive To recipient Amount to receive + Recipient get %s Are you sure you want to cancel the conversion? Your previous data will be cleared. Remove Conversion Send with swap @@ -1569,7 +1573,7 @@ At least one network is required for dApp connection Specify selected networks Successfully signed - Wallet connect + WalletConnect To Transaction request Transaction request diff --git a/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/subcomponents/destination/ui/DestinationBlock.kt b/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/subcomponents/destination/ui/DestinationBlock.kt index cea354ba6e..f8cf59bdb0 100644 --- a/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/subcomponents/destination/ui/DestinationBlock.kt +++ b/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/subcomponents/destination/ui/DestinationBlock.kt @@ -134,7 +134,7 @@ private fun AddressWithMemoBlock( Column(modifier = Modifier.weight(1f)) { Text( text = address.value, - style = TangemTheme.typography.body2, + style = TangemTheme.typography.body1, color = TangemTheme.colors.text.primary1, ) val blockchainAddress = address.briefBlockchainAddress diff --git a/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/amount/model/converter/SwapAmountFieldConverter.kt b/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/amount/model/converter/SwapAmountFieldConverter.kt index f29f727166..fd83068f8f 100644 --- a/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/amount/model/converter/SwapAmountFieldConverter.kt +++ b/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/amount/model/converter/SwapAmountFieldConverter.kt @@ -8,6 +8,7 @@ import com.tangem.core.ui.components.atoms.text.TextEllipsis 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.model.AppCurrency import com.tangem.domain.models.currency.CryptoCurrencyStatus @@ -16,6 +17,7 @@ import com.tangem.domain.swap.models.SwapDirection import com.tangem.features.swap.v2.impl.R import com.tangem.features.swap.v2.impl.amount.entity.SwapAmountFieldUM import com.tangem.features.swap.v2.impl.amount.entity.SwapAmountType +import com.tangem.utils.StringsSigns.DOT internal class SwapAmountFieldConverter( private val swapDirection: SwapDirection, @@ -60,15 +62,26 @@ internal class SwapAmountFieldConverter( } private fun getSubtitle(selectedType: SwapAmountType, cryptoCurrencyStatus: CryptoCurrencyStatus) = when { - selectedType.isEnteringField() -> resourceReference( - R.string.common_balance, - wrappedList( + selectedType.isEnteringField() -> combinedReference( + stringReference( cryptoCurrencyStatus.value.amount.format { crypto(cryptoCurrency = cryptoCurrencyStatus.currency) }, ), + stringReference(value = " $DOT "), + stringReference( + cryptoCurrencyStatus.value.fiatAmount.format { + fiat( + fiatCurrencyCode = appCurrency.code, + fiatCurrencySymbol = appCurrency.symbol, + ) + }, + ), ).orMaskWithStars(isBalanceHidden) - selectedType.isViewingField() -> resourceReference(R.string.send_with_swap_recipient_amount_text) + selectedType.isViewingField() -> resourceReference( + R.string.send_with_swap_recipient_get_amount, + + ) else -> TextReference.Companion.EMPTY } 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 f68cfcadc4..b788f33190 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 @@ -154,10 +154,7 @@ private fun SwapAmountDivider(modifier: Modifier = Modifier) { style = TangemTheme.typography.caption1, color = TangemTheme.colors.text.tertiary, modifier = Modifier - .background(TangemTheme.colors.stroke.primary, RoundedCornerShape(32.dp)) - .padding(1.dp) - .background(TangemTheme.colors.text.primary2, RoundedCornerShape(32.dp)) // workaround - .background(TangemTheme.colors.icon.informative.copy(alpha = 0.1f), RoundedCornerShape(32.dp)) + .background(TangemTheme.colors.button.secondary, RoundedCornerShape(32.dp)) .padding(horizontal = 11.dp, vertical = 5.dp) .align(Alignment.Center), ) diff --git a/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/amount/ui/SwapAmountContent.kt b/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/amount/ui/SwapAmountContent.kt index 199921a753..41957bf386 100644 --- a/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/amount/ui/SwapAmountContent.kt +++ b/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/amount/ui/SwapAmountContent.kt @@ -3,8 +3,6 @@ package com.tangem.features.swap.v2.impl.amount.ui import android.content.res.Configuration import androidx.compose.animation.AnimatedContent import androidx.compose.animation.AnimatedVisibility -import androidx.compose.animation.fadeIn -import androidx.compose.animation.fadeOut import androidx.compose.foundation.background import androidx.compose.foundation.clickable import androidx.compose.foundation.interaction.MutableInteractionSource @@ -26,7 +24,7 @@ import androidx.compose.ui.unit.dp import androidx.constraintlayout.compose.ConstraintLayout import com.tangem.common.ui.amountScreen.models.AmountState import com.tangem.common.ui.amountScreen.ui.AmountFieldV2 -import com.tangem.core.ui.components.RectangleShimmer +import com.tangem.core.ui.components.SpacerH2 import com.tangem.core.ui.components.SpacerWMax import com.tangem.core.ui.components.TextShimmer import com.tangem.core.ui.components.atoms.text.EllipsisText @@ -38,7 +36,6 @@ import com.tangem.core.ui.extensions.stringResourceSafe import com.tangem.core.ui.res.TangemTheme import com.tangem.core.ui.res.TangemThemePreview import com.tangem.domain.express.models.ExpressRateType -import com.tangem.domain.swap.models.SwapDirection import com.tangem.features.swap.v2.impl.R import com.tangem.features.swap.v2.impl.amount.entity.SwapAmountFieldUM import com.tangem.features.swap.v2.impl.amount.entity.SwapAmountType @@ -54,13 +51,17 @@ internal fun SwapAmountContent( clickIntents: SwapAmountClickIntents, modifier: Modifier = Modifier, ) { + val swapAmountContent = amountUM as? SwapAmountUM.Content + val isFixedRate = swapAmountContent?.swapRateType == ExpressRateType.Fixed ConstraintLayout( modifier = modifier, ) { val (amountFromRef, amountToRef, middleButtonRef) = createRefs() SwapAmountBlock( - amountUM = amountUM, amountFieldUM = amountUM.primaryAmount, + selectedAmountType = amountUM.selectedAmountType, + selectedQuote = swapAmountContent?.selectedQuote, + isFixedRate = isFixedRate, clickIntents = clickIntents, modifier = Modifier.constrainAs(amountFromRef) { top.linkTo(parent.top) @@ -69,8 +70,10 @@ internal fun SwapAmountContent( }, ) SwapAmountBlock( - amountUM = amountUM, amountFieldUM = amountUM.secondaryAmount, + selectedAmountType = amountUM.selectedAmountType, + selectedQuote = swapAmountContent?.selectedQuote, + isFixedRate = isFixedRate, clickIntents = clickIntents, modifier = Modifier.constrainAs(amountToRef) { top.linkTo(amountFromRef.bottom, 8.dp) @@ -100,7 +103,7 @@ private fun SwapAmountBlockSeparator(onClick: () -> Unit, modifier: Modifier = M modifier = modifier .heightIn(max = 28.dp) .clip(RoundedCornerShape(32.dp)) - .background(TangemTheme.colors.background.secondary) + .background(TangemTheme.colors.button.secondary) .clickable(onClick = onClick) .padding(vertical = 6.dp, horizontal = 12.dp), ) { @@ -109,10 +112,6 @@ private fun SwapAmountBlockSeparator(onClick: () -> Unit, modifier: Modifier = M style = TangemTheme.typography.caption1, color = TangemTheme.colors.text.tertiary, ) - VerticalDivider( - thickness = 1.dp, - color = TangemTheme.colors.icon.inactive, - ) Icon( painter = rememberVectorPainter( ImageVector.vectorResource(R.drawable.ic_close_24), @@ -126,11 +125,14 @@ private fun SwapAmountBlockSeparator(onClick: () -> Unit, modifier: Modifier = M @Composable private fun SwapAmountBlock( - amountUM: SwapAmountUM, amountFieldUM: SwapAmountFieldUM, + selectedQuote: SwapQuoteUM?, + selectedAmountType: SwapAmountType, + isFixedRate: Boolean, clickIntents: SwapAmountClickIntents, modifier: Modifier = Modifier, ) { + val isSelectedAmountType = selectedAmountType == amountFieldUM.amountType Column( modifier = modifier .padding(horizontal = 16.dp) @@ -138,7 +140,7 @@ private fun SwapAmountBlock( .fillMaxWidth() .background(TangemTheme.colors.background.action), ) { - AnimatedVisibility(amountUM.selectedAmountType == amountFieldUM.amountType) { + AnimatedVisibility(isSelectedAmountType) { Box { SwapAmountEditBlock( amountFieldUM = amountFieldUM, @@ -157,8 +159,10 @@ private fun SwapAmountBlock( } } SwapAmountInfo( - amountUM = amountUM, amountFieldUM = amountFieldUM, + selectedQuote = selectedQuote, + isSelectedAmountType = isSelectedAmountType, + isFixedRate = isFixedRate, onExpandEditField = clickIntents::onExpandEditField, onSelectTokenClick = clickIntents::onSelectTokenClick, onMaxAmountClick = clickIntents::onMaxValueClick, @@ -187,7 +191,7 @@ private fun SwapAmountEditBlock( } else { Text( text = (amountFieldUM.amountField as AmountState.Data).title.resolveReference(), - style = TangemTheme.typography.caption2, + style = TangemTheme.typography.subtitle2, color = TangemTheme.colors.text.tertiary, ) } @@ -201,10 +205,13 @@ private fun SwapAmountEditBlock( } } +@Suppress("LongParameterList") @Composable private fun SwapAmountInfo( - amountUM: SwapAmountUM, amountFieldUM: SwapAmountFieldUM, + selectedQuote: SwapQuoteUM?, + isSelectedAmountType: Boolean, + isFixedRate: Boolean, onExpandEditField: (SwapAmountType) -> Unit, onMaxAmountClick: () -> Unit, onSelectTokenClick: () -> Unit, @@ -220,7 +227,7 @@ private fun SwapAmountInfo( indication = ripple(), enabled = (amountFieldUM as? SwapAmountFieldUM.Content)?.isClickEnabled == true, onClick = { - if ((amountUM as? SwapAmountUM.Content)?.swapRateType == ExpressRateType.Fixed) { + if (isFixedRate) { onExpandEditField(amountFieldUM.amountType) } else { onSelectTokenClick() @@ -237,107 +244,85 @@ private fun SwapAmountInfo( bottom = 16.dp, ), ) - SwapAmountInfoMain(amountFieldUM = amountFieldUM) + SwapAmountInfoMain( + amountFieldUM = amountFieldUM, + selectedQuote = selectedQuote, + isSelectedAmountType = isSelectedAmountType, + ) SpacerWMax() AnimatedContent( - amountFieldUM, - ) { wrappedFieldAmountUM -> - if (amountUM is SwapAmountUM.Content) { - SwapAmountInfoExtra( - amountUM = amountUM, - amountFieldUM = wrappedFieldAmountUM, - onMaxAmountClick = onMaxAmountClick, + targetState = isSelectedAmountType, + ) { isSelected -> + if (isSelected) { + AmountMaxButton(onMaxAmountClick) + } else { + SwapAmountInfoQuote( + quoteUM = selectedQuote, + isFixedRate = isFixedRate, onSelectTokenClick = onSelectTokenClick, ) - } else { - RectangleShimmer() } } } } @Composable -private fun SwapAmountInfoMain(amountFieldUM: SwapAmountFieldUM, modifier: Modifier = Modifier) { - AnimatedContent( - targetState = amountFieldUM is SwapAmountFieldUM.Content, +private fun SwapAmountInfoMain( + amountFieldUM: SwapAmountFieldUM, + selectedQuote: SwapQuoteUM?, + isSelectedAmountType: Boolean, + modifier: Modifier = Modifier, +) { + Column( modifier = modifier, - ) { isContent -> - if (isContent && amountFieldUM is SwapAmountFieldUM.Content) { - Column( - verticalArrangement = Arrangement.spacedBy(2.dp), - ) { + ) { + AnimatedContent(amountFieldUM is SwapAmountFieldUM.Content) { isContent -> + if (isContent && amountFieldUM is SwapAmountFieldUM.Content) { Text( text = amountFieldUM.title.resolveReference(), style = TangemTheme.typography.subtitle2, color = TangemTheme.colors.text.primary1, maxLines = 1, ) + } else { + TextShimmer( + style = TangemTheme.typography.subtitle2, + modifier = Modifier.width(56.dp), + ) + } + } + AnimatedContent(isSelectedAmountType) { isSelected -> + if (isSelected && amountFieldUM is SwapAmountFieldUM.Content) { + SpacerH2() EllipsisText( text = amountFieldUM.subtitle.resolveReference(), style = TangemTheme.typography.caption2, color = TangemTheme.colors.text.tertiary, ellipsis = amountFieldUM.subtitleEllipsis, ) - } - } else { - Column( - verticalArrangement = Arrangement.spacedBy(2.dp), - ) { - TextShimmer( - style = TangemTheme.typography.subtitle2, - modifier = Modifier.width(56.dp), - ) - TextShimmer( - style = TangemTheme.typography.caption2, - modifier = Modifier.width(72.dp), - ) - } - } - } -} - -@Composable -private fun SwapAmountInfoExtra( - amountUM: SwapAmountUM.Content, - amountFieldUM: SwapAmountFieldUM, - onMaxAmountClick: () -> Unit, - onSelectTokenClick: () -> Unit, -) { - when (amountFieldUM.amountType) { - SwapAmountType.From -> when (amountUM.swapDirection) { - SwapDirection.Direct -> { - AnimatedVisibility( - visible = amountUM.selectedAmountType == amountFieldUM.amountType, - enter = fadeIn(), - exit = fadeOut(), - ) { - AmountMaxButton(onMaxAmountClick) - } - } - SwapDirection.Reverse -> { - SwapAmountInfoQuote( - quoteUM = amountUM.selectedQuote, - swapRateType = amountUM.swapRateType, - onSelectTokenClick = onSelectTokenClick, - ) - } - } - - SwapAmountType.To -> when (amountUM.swapDirection) { - SwapDirection.Direct -> { - SwapAmountInfoQuote( - quoteUM = amountUM.selectedQuote, - swapRateType = amountUM.swapRateType, - onSelectTokenClick = onSelectTokenClick, - ) - } - SwapDirection.Reverse -> { - AnimatedVisibility( - visible = amountUM.selectedAmountType == amountFieldUM.amountType, - enter = fadeIn(), - exit = fadeOut(), - ) { - AmountMaxButton(onMaxAmountClick) + } else { + AnimatedContent(selectedQuote) { quote -> + when (quote) { + is SwapQuoteUM.Content -> { + SpacerH2() + EllipsisText( + text = stringResourceSafe( + R.string.send_with_swap_recipient_get_amount, + quote.quoteAmountValue.resolveReference(), + ), + style = TangemTheme.typography.caption2, + color = TangemTheme.colors.text.tertiary, + ) + } + SwapQuoteUM.Loading -> { + SpacerH2() + TextShimmer( + style = TangemTheme.typography.caption2, + modifier = Modifier.width(72.dp), + ) + } + else -> Unit + } } } } @@ -353,7 +338,7 @@ private fun AmountMaxButton(onMaxAmountClick: () -> Unit) { modifier = Modifier .padding(end = 16.dp) .clip(RoundedCornerShape(16.dp)) - .background(TangemTheme.colors.background.secondary) + .background(TangemTheme.colors.button.secondary) .clickable( interactionSource = remember { MutableInteractionSource() }, indication = ripple(), @@ -364,11 +349,11 @@ private fun AmountMaxButton(onMaxAmountClick: () -> Unit) { } @Composable -private fun SwapAmountInfoQuote(quoteUM: SwapQuoteUM, swapRateType: ExpressRateType, onSelectTokenClick: () -> Unit) { +private fun SwapAmountInfoQuote(quoteUM: SwapQuoteUM?, isFixedRate: Boolean, onSelectTokenClick: () -> Unit) { Row( verticalAlignment = Alignment.CenterVertically, modifier = Modifier.conditionalCompose( - condition = swapRateType == ExpressRateType.Fixed, + condition = isFixedRate, modifier = { clickable( interactionSource = remember { MutableInteractionSource() }, @@ -378,29 +363,20 @@ private fun SwapAmountInfoQuote(quoteUM: SwapQuoteUM, swapRateType: ExpressRateT }, ), ) { - when (quoteUM) { - is SwapQuoteUM.Content -> EllipsisText( - text = quoteUM.quoteAmountValue.resolveReference(), - style = TangemTheme.typography.body2, - color = TangemTheme.colors.text.tertiary, - modifier = Modifier.padding(end = 2.dp), - ) - - is SwapQuoteUM.Error, - is SwapQuoteUM.Empty, - -> Box(modifier = Modifier.padding(start = 16.dp)) - - is SwapQuoteUM.Loading -> CircularProgressIndicator( - color = TangemTheme.colors.icon.inactive, - modifier = Modifier - .padding(end = 4.dp) - .size(20.dp), - ) - - is SwapQuoteUM.Allowance -> Text( - text = "ALLOWANCE NOT IMPLEMENTED", - ) + AnimatedContent( + quoteUM, + ) { quote -> + when (quote) { + is SwapQuoteUM.Loading -> CircularProgressIndicator( + color = TangemTheme.colors.icon.inactive, + modifier = Modifier + .padding(end = 4.dp) + .size(20.dp), + ) + else -> Box(modifier = Modifier.padding(start = 16.dp)) + } } + Icon( painter = rememberVectorPainter( ImageVector.vectorResource(R.drawable.ic_chevron_24),