From e5d588030b3914f538a399d9f3b91a0a3cfd6196 Mon Sep 17 00:00:00 2001 From: Tangem Date: Tue, 13 May 2025 19:34:01 +0400 Subject: [PATCH] Updated on 2026-08-14 --- core/res/src/main/res/values-ja/strings.xml | 32 +-- core/res/src/main/res/values-ru/strings.xml | 30 +-- core/res/src/main/res/values/strings.xml | 36 +-- .../entity/approve/WcApproveTransactionUM.kt | 2 +- .../ui/approve/WcCustomAllowanceContent.kt | 218 ++++++++++++++++++ 5 files changed, 271 insertions(+), 47 deletions(-) create mode 100644 features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/ui/approve/WcCustomAllowanceContent.kt diff --git a/core/res/src/main/res/values-ja/strings.xml b/core/res/src/main/res/values-ja/strings.xml index 3dde89a4c9..7979f3a2f3 100644 --- a/core/res/src/main/res/values-ja/strings.xml +++ b/core/res/src/main/res/values-ja/strings.xml @@ -292,25 +292,25 @@ 確認するには、プロバイダーのウェブサイトにアクセスしてください。 プロバイダーによる本人確認手続きが必要です。 買付完了 - 買付中 + 買付待ち 買付中... - キャンセルされました - 確認済み - 確認中 - 確認中... - 交換済み - 交換中 - 交換中... - 失敗しました - 停止中 + 取引はキャンセルされました + 入金確認済み + 確認待ち + 確認待ち... + 交換完了 + 交換待ち + スワップ待ち... + 交換に失敗しました + 交換は一時停止されました 入金済み 入金待ち 入金待ち... - 返金済み - 処理中 + 払い戻し完了 + 払い戻し待ち あなたへ送金しています - 送金中... - 送金済み + 資金の送金中... + 送金済み資金 プロバイダー提供のデータ。推定額は市場動向により変更される場合があります。 交換ステータス 確認が必要です @@ -334,6 +334,7 @@ この取引を非表示にする 一度非表示にすると、取引状況を再度表示することはできません。代わりに、スワイプして閉じることができます。 取引状況を非表示にしますか? + スワップする トークンが見つかりません。別のリクエストをお試しください。 ID: %s 取引IDをコピーしました @@ -1244,6 +1245,7 @@ 検証済みドメイン アプリで間違ったカードまたはリングが選択されました 問題が起きています + 使用を許可する アドレス 接続する ネットワーク @@ -1259,6 +1261,7 @@ 接続 内容 データをコピー + 使用可能量の設定 すべての接続を解除する すべてのdAppsの接続解除に関するテキスト すべてのdAppを接続解除する @@ -1274,6 +1277,7 @@ 宛先 取引リクエスト 取引リクエスト + 無制限 ウォレットコネクト 破棄 バックアップが中断されました。再開しますか? diff --git a/core/res/src/main/res/values-ru/strings.xml b/core/res/src/main/res/values-ru/strings.xml index 930c417497..8689c2d7ff 100644 --- a/core/res/src/main/res/values-ru/strings.xml +++ b/core/res/src/main/res/values-ru/strings.xml @@ -297,26 +297,26 @@ Сумма была возвращена в %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 869cf9bf8b..aefa4e7626 100644 --- a/core/res/src/main/res/values/strings.xml +++ b/core/res/src/main/res/values/strings.xml @@ -295,26 +295,26 @@ 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 - Confirming... - Exchanged - Exchanging - Exchanging... - Failed - Paused + Purchase completed + Awaiting Purchase + Awaiting Purchase... + Transaction canceled + Deposit confirmed + Waiting for confirmation + Waiting for confirmation... + Exchange completed + Waiting for exchange + Waiting for exchange... + Exchange failed + Exchange paused Deposit received - Awaiting deposit + Waiting for deposit Awaiting deposit... - Refunded - Refunding + Refund completed + Waiting for refund Sending to you - Sending to you... - Sent + Sending funds... + Funds sent Provider-sourced data. Estimated amount subject to change due to market conditions. Exchange status Verification required @@ -338,6 +338,7 @@ Hide this transaction Once hidden, the transaction status cannot be viewed again. You can simply swipe to dismiss instead. Hide Transaction Status? + Swap with No tokens found. Please try another request ID: %s Transaction ID copied @@ -1337,6 +1338,7 @@ To Transaction request Transaction request + Unlimited Amount Wallet connect Discard You have an interrupted backup. Do you want to resume? diff --git a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/entity/approve/WcApproveTransactionUM.kt b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/entity/approve/WcApproveTransactionUM.kt index 42c283e2e1..b8107b23c1 100644 --- a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/entity/approve/WcApproveTransactionUM.kt +++ b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/entity/approve/WcApproveTransactionUM.kt @@ -28,4 +28,4 @@ internal data class WcCustomAllowanceUM( val tokenIconUrl: String, val amountText: String, val isUnlimited: Boolean, -) \ No newline at end of file +) : TangemBottomSheetConfigContent \ No newline at end of file diff --git a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/ui/approve/WcCustomAllowanceContent.kt b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/ui/approve/WcCustomAllowanceContent.kt new file mode 100644 index 0000000000..08f144454d --- /dev/null +++ b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/ui/approve/WcCustomAllowanceContent.kt @@ -0,0 +1,218 @@ +package com.tangem.features.walletconnect.transaction.ui.approve + +import android.content.res.Configuration +import androidx.annotation.DrawableRes +import androidx.compose.foundation.Image +import androidx.compose.foundation.background +import androidx.compose.foundation.border +import androidx.compose.foundation.layout.* +import androidx.compose.foundation.shape.CircleShape +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.foundation.text.KeyboardOptions +import androidx.compose.material3.Text +import androidx.compose.material3.TextField +import androidx.compose.material3.TextFieldDefaults +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.graphics.Color +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.text.input.KeyboardType +import androidx.compose.ui.tooling.preview.Devices +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.tooling.preview.PreviewParameter +import androidx.compose.ui.tooling.preview.datasource.CollectionPreviewParameterProvider +import coil.compose.AsyncImage +import com.tangem.core.ui.components.PrimaryButton +import com.tangem.core.ui.components.TangemSwitch +import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfig +import com.tangem.core.ui.components.bottomsheets.modal.TangemModalBottomSheet +import com.tangem.core.ui.components.bottomsheets.modal.TangemModalBottomSheetTitle +import com.tangem.core.ui.extensions.resourceReference +import com.tangem.core.ui.extensions.stringResourceSafe +import com.tangem.core.ui.res.TangemTheme +import com.tangem.core.ui.res.TangemThemePreview +import com.tangem.features.walletconnect.impl.R +import com.tangem.features.walletconnect.transaction.entity.approve.WcCustomAllowanceUM + +@Composable +internal fun WcCustomAllowanceContent( + allowance: WcCustomAllowanceUM, + onAmountChange: (String) -> Unit, + onToggleChange: (Boolean) -> Unit, + onClickDone: () -> Unit, + modifier: Modifier = Modifier, +) { + Column( + modifier = modifier + .background(TangemTheme.colors.background.tertiary) + .fillMaxWidth() + .padding(TangemTheme.dimens.size16), + ) { + AmountTextField( + allowance = allowance, + onAmountChange = onAmountChange, + ) + + Spacer(modifier = Modifier.height(TangemTheme.dimens.spacing16)) + + Row( + verticalAlignment = Alignment.CenterVertically, + modifier = Modifier + .clip(RoundedCornerShape(TangemTheme.dimens.radius14)) + .background(color = TangemTheme.colors.background.action) + .padding(TangemTheme.dimens.spacing16) + .fillMaxWidth(), + ) { + Text( + text = stringResourceSafe(R.string.wc_unlimited_amount), + style = TangemTheme.typography.body1, + color = TangemTheme.colors.text.primary1, + modifier = Modifier.weight(1f), + ) + TangemSwitch( + checked = allowance.isUnlimited, + onCheckedChange = onToggleChange, + ) + } + + Spacer(modifier = Modifier.height(TangemTheme.dimens.spacing60)) + + PrimaryButton( + modifier = Modifier.fillMaxWidth(), + text = stringResourceSafe(R.string.common_done), + onClick = onClickDone, + ) + } +} + +@Composable +private fun AmountTextField( + allowance: WcCustomAllowanceUM, + onAmountChange: (String) -> Unit, + modifier: Modifier = Modifier, +) { + Row( + verticalAlignment = Alignment.CenterVertically, + modifier = modifier + .clip(RoundedCornerShape(TangemTheme.dimens.radius14)) + .background(color = TangemTheme.colors.background.action) + .padding( + end = TangemTheme.dimens.size8, + top = TangemTheme.dimens.size4, + bottom = TangemTheme.dimens.size4, + ) + .fillMaxWidth(), + ) { + TextField( + value = allowance.amountText, + onValueChange = onAmountChange, + label = { + Text( + text = stringResourceSafe(R.string.send_amount_label), + style = TangemTheme.typography.subtitle2, + color = TangemTheme.colors.text.tertiary, + ) + }, + textStyle = TangemTheme.typography.body1, + modifier = Modifier.weight(1f), + keyboardOptions = KeyboardOptions.Default.copy( + keyboardType = KeyboardType.Number, + ), + colors = TextFieldDefaults.colors( + unfocusedContainerColor = Color.Transparent, + focusedContainerColor = Color.Transparent, + focusedTextColor = TangemTheme.colors.text.primary1, + unfocusedTextColor = TangemTheme.colors.text.primary1, + focusedPlaceholderColor = TangemTheme.colors.text.disabled, + unfocusedPlaceholderColor = TangemTheme.colors.text.disabled, + focusedIndicatorColor = Color.Transparent, + unfocusedIndicatorColor = Color.Transparent, + cursorColor = TangemTheme.colors.icon.primary1, + ), + ) + + TokenWithNetworkIcon( + tokenIconUrl = allowance.tokenIconUrl, + networkIconRes = allowance.networkIconRes, + ) + } +} + +@Composable +private fun TokenWithNetworkIcon( + tokenIconUrl: String, + @DrawableRes networkIconRes: Int, + modifier: Modifier = Modifier, +) { + Box( + modifier = modifier + .size(TangemTheme.dimens.size48), + ) { + AsyncImage( + modifier = Modifier + .aspectRatio(1f) + .clip(CircleShape) + .align(Alignment.Center) + .padding(TangemTheme.dimens.spacing8), + model = tokenIconUrl, + contentDescription = null, + ) + Image( + modifier = Modifier + .align(Alignment.TopEnd) + .size(TangemTheme.dimens.size18) + .border(TangemTheme.dimens.size2, TangemTheme.colors.background.action, CircleShape) + .padding(TangemTheme.dimens.spacing2), + painter = painterResource(id = networkIconRes), + contentDescription = null, + ) + } +} + +@Composable +@Preview(showBackground = true, device = Devices.PIXEL_7_PRO) +@Preview(showBackground = true, device = Devices.PIXEL_7_PRO, uiMode = Configuration.UI_MODE_NIGHT_YES) +internal fun PreviewWcCustomAllowanceContent( + @PreviewParameter(WcCustomAllowanceStateProvider::class) state: WcCustomAllowanceUM, +) { + TangemThemePreview { + TangemModalBottomSheet( + config = TangemBottomSheetConfig( + isShown = true, + onDismissRequest = {}, + content = state, + ), + containerColor = TangemTheme.colors.background.tertiary, + title = { + TangemModalBottomSheetTitle( + title = resourceReference(R.string.wc_custom_allowance_title), + endIconRes = null, + onEndClick = {}, + startIconRes = R.drawable.ic_back_24, + onStartClick = {}, + ) + }, + content = { + WcCustomAllowanceContent( + allowance = state, + onAmountChange = {}, + onToggleChange = {}, + onClickDone = {}, + ) + }, + ) + } +} + +private class WcCustomAllowanceStateProvider : CollectionPreviewParameterProvider( + listOf( + WcCustomAllowanceUM( + networkIconRes = R.drawable.img_eth_22, + tokenIconUrl = "https://tangem.com", + amountText = "100", + isUnlimited = false, + ), + ), +) \ No newline at end of file