Updated on 2026-08-14

This commit is contained in:
Tangem 2025-05-15 18:35:01 +04:00
parent 177bdfad5a
commit edfaa5320d
13 changed files with 347 additions and 32 deletions

View file

@ -195,6 +195,7 @@
<string name="common_server_unavailable">Der Server ist nicht verfügbar. Bitte versuche es später erneut.</string>
<string name="common_share">Teilen</string>
<string name="common_share_link">Link teilen</string>
<string name="common_show_more">Mehr anzeigen</string>
<string name="common_sign">Signieren</string>
<string name="common_sign_and_send">Signieren und senden</string>
<string name="common_stake">Staken</string>
@ -450,7 +451,6 @@
<string name="markets_sort_by_top_losers_title">Top-Verlierer</string>
<string name="markets_sort_by_trending_title">Beliebt</string>
<string name="markets_staking_banner_description_placeholder">Staking ist der einfachste Weg, um Belohnungen für Deine Kryptowährung zu erhalten. %s</string>
<string name="markets_staking_banner_description_show_more">Mehr anzeigen</string>
<string name="markets_staking_banner_title">Verdiene bis zu %s APY</string>
<string name="markets_token_details_about_token_title">Über %s</string>
<plurals name="markets_token_details_amount_exchanges">

View file

@ -192,6 +192,8 @@
<string name="common_server_unavailable">サーバーが利用できません。しばらくしてからもう一度お試しください。</string>
<string name="common_share">共有</string>
<string name="common_share_link">リンクを共有</string>
<string name="common_show_less">詳細を非表示</string>
<string name="common_show_more">もっと見る</string>
<string name="common_sign">署名</string>
<string name="common_sign_and_send">署名して送信</string>
<string name="common_stake">ステーキング</string>
@ -447,7 +449,6 @@
<string name="markets_sort_by_top_losers_title">下落率上位</string>
<string name="markets_sort_by_trending_title">トレンド</string>
<string name="markets_staking_banner_description_placeholder">ステーキングは暗号資産で報酬を受け取る最も簡単な方法です。 %s</string>
<string name="markets_staking_banner_description_show_more">もっと見る</string>
<string name="markets_staking_banner_title">最大%s APYを獲得</string>
<string name="markets_token_details_about_token_title">%sについて</string>
<plurals name="markets_token_details_amount_exchanges">
@ -552,6 +553,7 @@
<string name="nft_receive_unavailable_section_title">未追加</string>
<string name="nft_send">NFTを送信する</string>
<string name="nft_traits_title">特徴</string>
<string name="nft_untitled_collection">無題のコレクション</string>
<string name="nft_wallet_count">%1$dコレクションの%2$dNFT</string>
<string name="nft_wallet_receive_nft">ここをタップして最初のNFTを受け取ります</string>
<string name="nft_wallet_title">NFTコレクション</string>
@ -1265,6 +1267,8 @@
<string name="wc_disconnect_all">すべての接続を解除する</string>
<string name="wc_disconnect_all_alert_desc">すべてのdAppsの接続解除に関するテキスト</string>
<string name="wc_disconnect_all_alert_title">すべてのdAppを接続解除する</string>
<string name="wc_estimated_wallet_changes">ウォレットの変更の予測</string>
<string name="wc_malicious_transaction">悪意のある取引</string>
<string name="wc_missing_required_network_description">このウォレットのプロフィールに%sネットワークを追加する</string>
<string name="wc_missing_required_network_title">ウォレットに必要なネットワークはありません</string>
<string name="wc_new_connection">新しい接続</string>

View file

@ -199,6 +199,7 @@
<string name="common_server_unavailable">Сервер недоступен, повторите попытку позднее</string>
<string name="common_share">Поделиться</string>
<string name="common_share_link">Поделиться ссылкой</string>
<string name="common_show_more">Показать больше</string>
<string name="common_sign">Подписать</string>
<string name="common_sign_and_send">Подписать и отправить</string>
<string name="common_stake">Застейкать</string>
@ -454,7 +455,6 @@
<string name="markets_sort_by_top_losers_title">Лидеры падения</string>
<string name="markets_sort_by_trending_title">В тренде</string>
<string name="markets_staking_banner_description_placeholder">Стейкинг — простой способ получать доход с вашей криптовалюты. %s</string>
<string name="markets_staking_banner_description_show_more">Показать больше</string>
<string name="markets_staking_banner_title">Получайте до %s APY</string>
<string name="markets_token_details_about_token_title">О %s</string>
<plurals name="markets_token_details_amount_exchanges">

View file

@ -195,6 +195,8 @@
<string name="common_server_unavailable">The server is not available, please try again later</string>
<string name="common_share">Share</string>
<string name="common_share_link">Share Link</string>
<string name="common_show_less">Show less</string>
<string name="common_show_more">Show more</string>
<string name="common_sign">Sign</string>
<string name="common_sign_and_send">Sign and send</string>
<string name="common_stake">Stake</string>
@ -452,7 +454,6 @@
<string name="markets_sort_by_top_losers_title">Top Losers</string>
<string name="markets_sort_by_trending_title">Trending</string>
<string name="markets_staking_banner_description_placeholder">Staking is the easiest way to receive rewards on your crypto. %s</string>
<string name="markets_staking_banner_description_show_more">Show more</string>
<string name="markets_staking_banner_title">Earn up to %s APY</string>
<string name="markets_token_details_about_token_title">About %s</string>
<plurals name="markets_token_details_amount_exchanges">
@ -560,6 +561,7 @@
<string name="nft_receive_unavailable_section_title">Not Added</string>
<string name="nft_send">Send NFT</string>
<string name="nft_traits_title">Traits</string>
<string name="nft_untitled_collection">Untitled collection</string>
<string name="nft_wallet_count">%1$d NFTs in %2$d collection</string>
<string name="nft_wallet_receive_nft">Tap here to receive first NFT</string>
<string name="nft_wallet_title">NFT collections</string>
@ -1204,6 +1206,8 @@
<string name="wallet_promo_banner_button_title">Get now with 10% off</string>
<string name="wallet_promo_banner_description">Access 13,000+ cryptocurrencies. Buy, sell, swap, and stake with a single tap.\nLink up to three cards for a backup.</string>
<string name="wallet_promo_banner_title">Discover Tangem Wallet</string>
<string name="wallet_settings_push_notifications_description">Stay notified on wallet incoming transactions and Tangem updates.</string>
<string name="wallet_settings_push_notifications_title">Push Notifications</string>
<string name="wallet_settings_title">Wallet settings</string>
<string name="wallet_title">Tangem</string>
<string name="warning_access_denied_message">Use %s or scan a card/ring to unlock access to your wallet</string>
@ -1326,6 +1330,8 @@
<string name="wc_disconnect_all">Disconnect all</string>
<string name="wc_disconnect_all_alert_desc">Text about discnected all dApps</string>
<string name="wc_disconnect_all_alert_title">Disconect All dApps</string>
<string name="wc_estimated_wallet_changes">Estimated wallet changes</string>
<string name="wc_malicious_transaction">Malicious transaction</string>
<string name="wc_missing_required_network_description">Add the %s network to your profile for this wallet</string>
<string name="wc_missing_required_network_title">The wallet has no required networks</string>
<string name="wc_new_connection">New connection</string>

View file

@ -0,0 +1,23 @@
package com.tangem.core.ui.components.divider
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.HorizontalDivider
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import com.tangem.core.ui.res.TangemTheme
@Composable
fun DividerWithPadding(start: Dp = 0.dp, end: Dp = 0.dp, top: Dp = 0.dp, bottom: Dp = 0.dp) {
HorizontalDivider(
modifier = Modifier.padding(
start = start,
end = end,
top = top,
bottom = bottom,
),
thickness = TangemTheme.dimens.size1,
color = TangemTheme.colors.stroke.primary,
)
}

View file

@ -0,0 +1,19 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="20dp"
android:height="20dp"
android:viewportWidth="20"
android:viewportHeight="20">
<group>
<clip-path
android:pathData="M4,0L16,0A4,4 0,0 1,20 4L20,16A4,4 0,0 1,16 20L4,20A4,4 0,0 1,0 16L0,4A4,4 0,0 1,4 0z"/>
<path
android:pathData="M4,0L16,0A4,4 0,0 1,20 4L20,16A4,4 0,0 1,16 20L4,20A4,4 0,0 1,0 16L0,4A4,4 0,0 1,4 0z"
android:fillColor="#EBEBEB"
android:fillAlpha="0.7"/>
<path
android:pathData="M9.253,4.076C9.717,3.808 10.289,3.808 10.753,4.076L14.76,6.389C15.224,6.657 15.51,7.153 15.51,7.688V12.314C15.51,12.85 15.224,13.346 14.76,13.614L10.753,15.927C10.289,16.194 9.717,16.194 9.253,15.927L5.246,13.614C4.782,13.346 4.496,12.85 4.496,12.314V7.688C4.496,7.152 4.782,6.657 5.246,6.389L9.253,4.076Z"
android:strokeAlpha="0.1"
android:fillColor="#1E1E1E"
android:fillAlpha="0.1"/>
</group>
</vector>

View file

@ -0,0 +1,15 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M12,12m-12,0a12,12 0,1 1,24 0a12,12 0,1 1,-24 0"
android:strokeAlpha="0.1"
android:fillColor="#0099FF"
android:fillAlpha="0.1"/>
<path
android:pathData="M12.077,6.016C12.519,6.016 12.877,6.374 12.877,6.816V15.253L16.042,12.088C16.355,11.775 16.861,11.775 17.174,12.088C17.486,12.4 17.486,12.907 17.174,13.219L12.643,17.75C12.33,18.062 11.824,18.062 11.511,17.75L6.98,13.219C6.668,12.907 6.668,12.4 6.98,12.088C7.293,11.775 7.799,11.775 8.112,12.088L11.277,15.253V6.816C11.277,6.374 11.635,6.016 12.077,6.016Z"
android:fillColor="#0099FF"
android:fillType="evenOdd"/>
</vector>

View file

@ -0,0 +1,15 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M12,12m-12,0a12,12 0,1 1,24 0a12,12 0,1 1,-24 0"
android:strokeAlpha="0.1"
android:fillColor="#FF3333"
android:fillAlpha="0.1"/>
<path
android:pathData="M11.511,6.25C11.824,5.938 12.33,5.938 12.643,6.25L17.174,10.781C17.486,11.093 17.486,11.6 17.174,11.912C16.861,12.225 16.355,12.225 16.042,11.912L12.877,8.747V17.184C12.877,17.626 12.519,17.984 12.077,17.984C11.635,17.984 11.277,17.626 11.277,17.184V8.747L8.112,11.912C7.799,12.225 7.293,12.225 6.98,11.912C6.668,11.6 6.668,11.093 6.98,10.781L11.511,6.25Z"
android:fillColor="#FF3333"
android:fillType="evenOdd"/>
</vector>

View file

@ -0,0 +1,16 @@
package com.tangem.features.walletconnect.transaction.entity.blockaid
import androidx.annotation.DrawableRes
import com.tangem.core.ui.extensions.TextReference
import kotlinx.collections.immutable.ImmutableList
internal data class WcEstimatedWalletChangesUM(
val items: ImmutableList<WcEstimatedWalletChangeUM>,
)
internal data class WcEstimatedWalletChangeUM(
@DrawableRes val iconRes: Int,
val title: TextReference,
val description: String,
val tokenIconUrl: String,
)

View file

@ -6,7 +6,6 @@ import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.HorizontalDivider
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
@ -14,11 +13,11 @@ 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 androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
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.components.divider.DividerWithPadding
import com.tangem.core.ui.extensions.resourceReference
import com.tangem.core.ui.res.TangemTheme
import com.tangem.core.ui.res.TangemThemePreview
@ -112,18 +111,6 @@ private fun WcApproveTransactionItems(state: WcApproveTransactionItemUM) {
}
}
@Composable
internal fun DividerWithPadding(start: Dp, end: Dp) {
HorizontalDivider(
modifier = Modifier.padding(
start = start,
end = end,
),
thickness = TangemTheme.dimens.size1,
color = TangemTheme.colors.stroke.primary,
)
}
@Composable
@Preview(showBackground = true, device = Devices.PIXEL_7_PRO)
@Preview(showBackground = true, device = Devices.PIXEL_7_PRO, uiMode = Configuration.UI_MODE_NIGHT_YES)

View file

@ -0,0 +1,78 @@
package com.tangem.features.walletconnect.transaction.ui.blockaid
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Text
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import coil.compose.AsyncImage
import com.tangem.core.ui.extensions.resolveReference
import com.tangem.core.ui.res.TangemTheme
import com.tangem.features.walletconnect.impl.R
import com.tangem.features.walletconnect.transaction.entity.blockaid.WcEstimatedWalletChangeUM
@Composable
internal fun WcEstimatedWalletChangeRow(item: WcEstimatedWalletChangeUM, modifier: Modifier = Modifier) {
Row(
verticalAlignment = Alignment.CenterVertically,
modifier = modifier
.fillMaxWidth(),
) {
Image(
painter = painterResource(id = item.iconRes),
contentDescription = null,
modifier = Modifier.size(24.dp),
)
Spacer(modifier = Modifier.width(12.dp))
Box(
modifier = Modifier.weight(1f),
contentAlignment = Alignment.CenterStart,
) {
Row(
modifier = Modifier.fillMaxWidth(),
verticalAlignment = Alignment.CenterVertically,
) {
Text(
text = item.title.resolveReference(),
style = TangemTheme.typography.body1,
color = TangemTheme.colors.text.primary1,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
)
Spacer(modifier = Modifier.width(8.dp))
Text(
text = item.description,
style = TangemTheme.typography.body1,
color = TangemTheme.colors.text.tertiary,
textAlign = TextAlign.End,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
modifier = Modifier.weight(1f),
)
}
}
Spacer(modifier = Modifier.width(12.dp))
AsyncImage(
model = item.tokenIconUrl,
contentDescription = null,
modifier = Modifier
.size(24.dp)
.clip(RoundedCornerShape(4.dp)),
placeholder = painterResource(R.drawable.ic_nft_placeholder_20),
error = painterResource(R.drawable.ic_nft_placeholder_20),
)
}
}

View file

@ -0,0 +1,165 @@
package com.tangem.features.walletconnect.transaction.ui.blockaid
import android.content.res.Configuration
import androidx.compose.animation.animateContentSize
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Icon
import androidx.compose.material3.Text
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.res.stringResource
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.PreviewParameterProvider
import androidx.compose.ui.unit.dp
import com.tangem.core.ui.extensions.resourceReference
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.rememberVectorPainter
import androidx.compose.ui.res.vectorResource
import com.tangem.core.ui.components.divider.DividerWithPadding
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.blockaid.WcEstimatedWalletChangeUM
import com.tangem.features.walletconnect.transaction.entity.blockaid.WcEstimatedWalletChangesUM
import com.tangem.features.walletconnect.transaction.ui.common.WcSmallTitleItem
import kotlinx.collections.immutable.persistentListOf
import kotlinx.collections.immutable.toPersistentList
private const val MAX_CHANGES_SIZE = 4
@Composable
internal fun WcEstimatedWalletChangesItem(item: WcEstimatedWalletChangesUM, modifier: Modifier = Modifier) {
var isExpanded by remember { mutableStateOf(false) }
Column(
modifier = modifier
.clip(RoundedCornerShape(14.dp))
.background(color = TangemTheme.colors.background.action)
.fillMaxWidth()
.animateContentSize(),
) {
WcSmallTitleItem(
textRex = R.string.wc_estimated_wallet_changes,
modifier = Modifier
.padding(bottom = 16.dp),
)
val itemsToDisplay = if (isExpanded) item.items else item.items.take(MAX_CHANGES_SIZE)
itemsToDisplay.forEachIndexed { idx, row ->
key(row.hashCode()) {
WcEstimatedWalletChangeRow(
item = row,
modifier = Modifier.padding(horizontal = 12.dp),
)
if (idx == item.items.lastIndex) {
Spacer(modifier = Modifier.height(12.dp))
} else {
DividerWithPadding(start = 48.dp, end = 12.dp, top = 8.dp, bottom = 8.dp)
}
}
}
if (item.items.size > MAX_CHANGES_SIZE) {
Row(
modifier = Modifier
.clickable { isExpanded = !isExpanded }
.padding(bottom = 12.dp, start = 12.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Text(
text = stringResource(if (isExpanded) R.string.common_show_less else R.string.common_show_more),
style = TangemTheme.typography.body1,
color = TangemTheme.colors.text.tertiary,
)
Icon(
painter = rememberVectorPainter(
image = ImageVector.vectorResource(id = R.drawable.ic_chevron_24),
),
tint = TangemTheme.colors.icon.informative,
modifier = Modifier
.size(20.dp)
.padding(start = 2.dp),
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)
private fun EstimatedWalletChangesPreviewTwoItems(
@PreviewParameter(EstimatedWalletChangesPreviewProviderTwoItems::class) item: WcEstimatedWalletChangesUM,
) {
TangemThemePreview {
Box(
modifier = Modifier
.background(TangemTheme.colors.background.tertiary),
) {
WcEstimatedWalletChangesItem(item = item)
}
}
}
@Composable
@Preview(showBackground = true, device = Devices.PIXEL_7_PRO)
@Preview(showBackground = true, device = Devices.PIXEL_7_PRO, uiMode = Configuration.UI_MODE_NIGHT_YES)
private fun EstimatedWalletChangesPreviewMoreThanFour(
@PreviewParameter(EstimatedWalletChangesPreviewProviderManyItems::class) item: WcEstimatedWalletChangesUM,
) {
TangemThemePreview {
Box(
modifier = Modifier
.background(TangemTheme.colors.background.tertiary),
) {
WcEstimatedWalletChangesItem(item = item)
}
}
}
private class EstimatedWalletChangesPreviewProviderTwoItems :
PreviewParameterProvider<WcEstimatedWalletChangesUM> {
override val values = sequenceOf(
WcEstimatedWalletChangesUM(
items = persistentListOf(
WcEstimatedWalletChangeUM(
iconRes = R.drawable.ic_send_new_24,
title = resourceReference(R.string.common_send),
description = "- 42 USDT",
tokenIconUrl = "https://tangem.com",
),
WcEstimatedWalletChangeUM(
iconRes = R.drawable.ic_recieve_new_24,
title = resourceReference(R.string.common_receive),
description = "+ 1,131.46 MATIC",
tokenIconUrl = "https://tangem.com",
),
),
),
)
}
private class EstimatedWalletChangesPreviewProviderManyItems :
PreviewParameterProvider<WcEstimatedWalletChangesUM> {
override val values = sequenceOf(
WcEstimatedWalletChangesUM(
items = (1..6).map {
WcEstimatedWalletChangeUM(
iconRes = R.drawable.ic_send_new_24,
title = resourceReference(R.string.common_send),
description = "Nethers #1111",
tokenIconUrl = "https://tangem.com",
)
}.toPersistentList(),
),
)
}

View file

@ -8,7 +8,6 @@ import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.HorizontalDivider
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
@ -16,11 +15,11 @@ 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 androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
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.components.divider.DividerWithPadding
import com.tangem.core.ui.extensions.resourceReference
import com.tangem.core.ui.res.TangemTheme
import com.tangem.core.ui.res.TangemThemePreview
@ -109,18 +108,6 @@ private fun WcSignTransactionItems(state: WcSignTransactionItemUM) {
}
}
@Composable
internal fun DividerWithPadding(start: Dp, end: Dp) {
HorizontalDivider(
modifier = Modifier.padding(
start = start,
end = end,
),
thickness = 1.dp,
color = TangemTheme.colors.stroke.primary,
)
}
@Composable
@Preview(showBackground = true, device = Devices.PIXEL_7_PRO)
@Preview(showBackground = true, device = Devices.PIXEL_7_PRO, uiMode = Configuration.UI_MODE_NIGHT_YES)