Updated on 2026-08-14

This commit is contained in:
Tangem 2025-12-01 13:27:07 +03:00
parent 7fb32453ca
commit c1517d09fe
22 changed files with 246 additions and 66 deletions

View file

@ -830,6 +830,8 @@
<string name="no_account_polkadot">Das Zielkonto ist nicht aktiv. Sende %s oder mehr, um das Konto zu aktivieren.</string>
<string name="no_account_send_to_create">Senden Sie Geld an diese Andresse um ein Konto zu erstellen</string>
<string name="no_trustline_xlm_asset">Das Zielkonto verfügt nicht über eine Vertrauensstellung für das gesendete Asset.</string>
<string name="notification_black_friday_text">Sicher Dir 10 $ in BTC mit jeder Wallet greif schnell zu!</string>
<string name="notification_black_friday_title">Black Friday: bis zu 30% Nachlass</string>
<string name="notification_referral_promo_button">Jetzt beitreten</string>
<string name="notification_referral_promo_text">Teile Deinen Code verdiene 5 USDT pro Verkauf. Deine Freunde erhalten 10 % Rabatt.</string>
<string name="notification_referral_promo_title">Erhalte BELOHNUNGEN für jeden Freund!</string>

View file

@ -32,6 +32,7 @@
<string name="account_details_archive_description">このアカウントをアーカイブしますが、いつでも復元できます。</string>
<string name="account_details_archiving">アーカイブ中・・・</string>
<string name="account_details_title">アカウント</string>
<string name="account_edit_failure_dialog_title">アカウントを編集できません</string>
<string name="account_edit_success_message">アカウントが保存されました</string>
<string name="account_for_rewards">報酬用のアカウント</string>
<string name="account_form_account_index">アカウント番号%s — アドレス導出に使用されます。</string>
@ -43,6 +44,7 @@
<string name="account_form_placeholder_new_account">新しいアカウント</string>
<string name="account_form_title_create">アカウントを追加</string>
<string name="account_form_title_edit">アカウントを編集</string>
<string name="account_generic_error_dialog_message">少し時間をおいて再度お試しください。問題が続く場合はサポートへご連絡ください。こちらで解決をお手伝いします。</string>
<string name="account_label_tokens_info">%1$s ( %2$s内)</string>
<string name="account_main_account_title">メインアカウント</string>
<string name="account_recover_limit_dialog_description">すでにアクティブアカウントの上限%1$s件を超えています。復元するには、1つをアーカイブしてください。</string>
@ -435,7 +437,7 @@
<string name="disclaimer_error_loading">インターネット接続を確認するか、別のネットワークに切り替えてください。</string>
<string name="disclaimer_title">利用規約</string>
<string name="domain_receive_assets_default_address">デフォルトアドレス</string>
<string name="domain_receive_assets_legacy_address">レガシーアドレス</string>
<string name="domain_receive_assets_legacy_address">レガシー%sアドレス</string>
<string name="domain_receive_assets_navigation_title">資金を受け取る</string>
<string name="domain_receive_assets_network_name_address">%sアドレス</string>
<string name="domain_receive_assets_onboarding_description">他のネットワークで資産を送金すると、永久に失われます。</string>
@ -1416,9 +1418,20 @@
<string name="tangempay_card_details_swap_description">ポートフォリオ内のあらゆる資産をカードと交換</string>
<string name="tangempay_card_details_title">カードの詳細</string>
<string name="tangempay_card_details_unfreeze_card">カードの一時停止を解除</string>
<string name="tangempay_card_details_withdraw">出金</string>
<string name="tangempay_card_details_withdraw_error_title">現在、出金ができません</string>
<string name="tangempay_card_details_withdraw_in_progress_description">現在の処理が完了するまでは、スワップや新しい出金を開始することはできません。</string>
<string name="tangempay_card_details_withdraw_in_progress_title">出金処理中です</string>
<string name="tangempay_failed_to_issue_card">カードの発行に失敗しました</string>
<string name="tangempay_failed_to_issue_card_retry_description">技術的なエラーが発生しました。下のボタンをクリックして、もう一度お試しください。</string>
<string name="tangempay_failed_to_issue_card_support_description">技術的なエラーが発生しました。サポートへお問い合わせください。</string>
<string name="tangempay_issue_card_notification_description">通常は最大で15分ほどかかります</string>
<string name="tangempay_issue_card_notification_title">Tangemカードのセットアップ</string>
<string name="tangempay_issuing_your_card">カードを発行しています</string>
<string name="tangempay_issuing_your_card_description">カードを準備しています。少し時間がかかる場合があります。</string>
<string name="tangempay_kyc_card_ready_notification_title">Tangem Pay</string>
<string name="tangempay_kyc_failed_description">プロフィールを確認できませんでした。ご不明な点があればサポートまでお問い合わせください。</string>
<string name="tangempay_kyc_failed_title">申し訳ございませんが、本人確認を行うことができませんでした</string>
<string name="tangempay_kyc_in_progress_notification_button">ステータスを表示</string>
<string name="tangempay_kyc_in_progress_notification_title">Tangem PayのKYC手続き進行中</string>
<string name="tangempay_onboarding_get_card_button_text">カードをGET</string>

View file

@ -26,6 +26,7 @@
<string name="account_details_archive_description">Вы архивируете свой аккаунт, но в любое время можете вернуть его обратно</string>
<string name="account_details_archiving">Архивация...</string>
<string name="account_details_title">Аккаунт</string>
<string name="account_edit_failure_dialog_title">Невозможно отредактировать аккаунт</string>
<string name="account_for_rewards">Аккаунт для наград</string>
<string name="account_form_create_button">Добавить аккаунт</string>
<string name="account_form_edit_button">Сохранить</string>
@ -831,7 +832,7 @@
<string name="no_account_polkadot">Аккаунт получателя не активирован. Отправьте %s или более для активации аккаунта.</string>
<string name="no_account_send_to_create">Для создания аккаунта отправьте средства на этот адрес</string>
<string name="no_trustline_xlm_asset">Аккаунт получателя не содержит трастлайна для отправляемого актива.</string>
<string name="notification_black_friday_text">Получите $10 в BTC за каждый кошелёк\nПоторопитесь!</string>
<string name="notification_black_friday_text">Получите $10 в BTC за каждый кошелёк.\nПоторопитесь!</string>
<string name="notification_black_friday_title">Чёрная пятница: скидки до 30%</string>
<string name="notification_referral_promo_button">Присоединиться</string>
<string name="notification_referral_promo_text">Поделись промокодом — заработай 5 USDT с каждой покупки. Твои друзья получат скидку 10% на карту Tangem!</string>

View file

@ -44,6 +44,7 @@
<string name="account_form_placeholder_new_account">New account</string>
<string name="account_form_title_create">Add account</string>
<string name="account_form_title_edit">Edit account</string>
<string name="account_generic_error_dialog_message">Please try again later. If it keeps happening, get in touch with support and well help you resolve it.</string>
<string name="account_label_tokens_info">%1$s in %2$s</string>
<string name="account_main_account_title">Main account</string>
<string name="account_recover_limit_dialog_description">You have already exceeded the limit of %1$s active accounts. Archive one to recover</string>
@ -1986,6 +1987,7 @@
<string name="yield_module_promo_screen_self_custodial_title">Decentralized and self-custodial</string>
<string name="yield_module_promo_screen_terms_disclaimer">By using this service, you agree with provider\n%1$s and %2$s</string>
<string name="yield_module_promo_screen_title">Connect to Aave</string>
<string name="yield_module_promo_screen_title_v2">Enable %1$s%% APY on your balance</string>
<string name="yield_module_promo_screen_variable_rate_info">Aave %1$s%% • Variable Interest Rate</string>
<string name="yield_module_provider">Aave</string>
<string name="yield_module_rate_info_sheet_chart_average">Avg %s</string>

View file

@ -61,6 +61,7 @@ fun InputRowImageBase(
iconTint: Color = TangemTheme.colors.icon.informative,
isGrayscaleImage: Boolean = false,
@DrawableRes iconEndRes: Int? = null,
endIconTint: Color = TangemTheme.colors.icon.informative,
onImageError: (@Composable () -> Unit)? = null,
subtitleExtraContent: (@Composable RowScope.() -> Unit)? = null,
extraContent: (@Composable RowScope.() -> Unit)? = null,
@ -127,12 +128,12 @@ fun InputRowImageBase(
} else {
SpacerWMax()
}
InputRowEndIcon(iconEndRes)
InputRowEndIcon(iconEndRes, endIconTint)
}
}
@Composable
private fun RowScope.InputRowEndIcon(iconRes: Int?) {
private fun RowScope.InputRowEndIcon(iconRes: Int?, tint: Color = TangemTheme.colors.icon.informative) {
AnimatedVisibility(
visible = iconRes != null,
label = "End icon visibility animation",
@ -140,7 +141,7 @@ private fun RowScope.InputRowEndIcon(iconRes: Int?) {
val icon = remember(this) { requireNotNull(iconRes) }
Icon(
painter = rememberVectorPainter(image = ImageVector.vectorResource(id = icon)),
tint = TangemTheme.colors.icon.informative,
tint = tint,
contentDescription = null,
modifier = Modifier.padding(start = TangemTheme.dimens.spacing6),
)

View file

@ -57,6 +57,8 @@ sealed interface FeedbackEmailType {
}
sealed class Visa : FeedbackEmailType {
data class FailedIssueCard(override val walletMetaInfo: WalletMetaInfo) : Visa()
data class DirectUserRequest(override val walletMetaInfo: WalletMetaInfo) : Visa()
data class Activation(override val walletMetaInfo: WalletMetaInfo) : Visa()

View file

@ -73,6 +73,7 @@ class SendFeedbackEmailUseCase(
is FeedbackEmailType.TransactionSendingProblem,
is FeedbackEmailType.Visa.Activation,
is FeedbackEmailType.Visa.DirectUserRequest,
is FeedbackEmailType.Visa.FailedIssueCard,
-> {
append(resources.getStringSafe(R.string.feedback_data_collection_message))
skipLine()

View file

@ -19,6 +19,7 @@ internal class EmailMessageBodyResolver(
) {
/** Resolve email message body by [type] */
@Suppress("CyclomaticComplexMethod")
suspend fun resolve(type: FeedbackEmailType): String = with(FeedbackDataBuilder()) {
when (type) {
is FeedbackEmailType.DirectUserRequest -> addUserRequestBody(type.walletMetaInfo)
@ -33,6 +34,7 @@ internal class EmailMessageBodyResolver(
-> addPhoneInfoBody()
is FeedbackEmailType.Visa.Activation -> addUserRequestBody(type.walletMetaInfo)
is FeedbackEmailType.Visa.DirectUserRequest -> addUserRequestBody(type.walletMetaInfo)
is FeedbackEmailType.Visa.FailedIssueCard -> addUserRequestBody(type.walletMetaInfo)
is FeedbackEmailType.Visa.Dispute -> addVisaRequestBody(type.walletMetaInfo, type.visaTxDetails)
is FeedbackEmailType.Visa.DisputeV2 -> addTangemPayRequestBody(type.walletMetaInfo, type.item)
}

View file

@ -24,6 +24,7 @@ internal class EmailMessageTitleResolver(private val resources: Resources) {
is FeedbackEmailType.Visa.DirectUserRequest,
is FeedbackEmailType.Visa.Dispute,
is FeedbackEmailType.Visa.DisputeV2,
is FeedbackEmailType.Visa.FailedIssueCard,
-> R.string.feedback_preface_support
is FeedbackEmailType.RateCanBeBetter -> R.string.feedback_preface_rate_negative
is FeedbackEmailType.ScanningProblem -> R.string.feedback_preface_scan_failed

View file

@ -39,6 +39,7 @@ internal class EmailSubjectResolver(private val resources: Resources) {
FeedbackEmailType.CardAttestationFailed -> "Card attestation failed"
is FeedbackEmailType.Visa.Activation -> "[Visa] [Activation] {auto-filled subject}"
is FeedbackEmailType.Visa.DirectUserRequest -> "[Visa] {auto-filled subject}"
is FeedbackEmailType.Visa.FailedIssueCard -> "[Visa] {auto-filled subject}"
is FeedbackEmailType.Visa.Dispute,
is FeedbackEmailType.Visa.DisputeV2,
-> "[Visa] [DISPUTE] {auto-filled subject}"

View file

@ -426,6 +426,8 @@ internal class WalletModel @Inject constructor(
value = data,
cardFrozenState = cardFrozenState,
onClickKyc = innerWalletRouter::openTangemPayOnboarding,
onIssuingCard = clickIntents::onIssuingCardClicked,
onIssuingFailed = clickIntents::onIssuingFailedClicked,
openDetails = { config ->
innerWalletRouter.openTangemPayDetails(
userWalletId = userWalletId,

View file

@ -1,12 +1,23 @@
package com.tangem.feature.wallet.child.wallet.model.intents
import com.tangem.core.decompose.di.ModelScoped
import com.tangem.core.decompose.ui.UiMessageSender
import com.tangem.core.res.R
import com.tangem.core.ui.components.bottomsheets.message.MessageBottomSheetUMV2
import com.tangem.core.ui.extensions.resourceReference
import com.tangem.core.ui.message.BottomSheetMessageV2
import com.tangem.domain.feedback.GetWalletMetaInfoUseCase
import com.tangem.domain.feedback.SendFeedbackEmailUseCase
import com.tangem.domain.feedback.models.FeedbackEmailType
import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.domain.models.wallet.requireColdWallet
import com.tangem.domain.pay.repository.OnboardingRepository
import com.tangem.domain.pay.usecase.ProduceTangemPayInitialDataUseCase
import com.tangem.domain.wallets.usecase.GetUserWalletUseCase
import com.tangem.feature.wallet.child.wallet.model.TangemPayMainInfoManager
import com.tangem.feature.wallet.presentation.wallet.state.WalletStateController
import com.tangem.features.tangempay.TangemPayFeatureToggles
import kotlinx.collections.immutable.persistentListOf
import kotlinx.coroutines.launch
import javax.inject.Inject
@ -15,15 +26,26 @@ internal interface TangemPayIntents {
suspend fun onPullToRefresh()
fun onRefreshPayToken(userWalletId: UserWalletId)
fun onIssuingCardClicked()
fun onIssuingFailedClicked()
fun onPaySupportClick()
}
@Suppress("LongParameterList")
@ModelScoped
internal class TangemPayClickIntentsImplementor @Inject constructor(
private val stateHolder: WalletStateController,
private val featureToggles: TangemPayFeatureToggles,
private val onboardingRepository: OnboardingRepository,
private val produceInitialDataTangemPay: ProduceTangemPayInitialDataUseCase,
private val getWalletMetainfoUseCase: GetWalletMetaInfoUseCase,
private val getUserWalletUseCase: GetUserWalletUseCase,
private val sendFeedbackEmailUseCase: SendFeedbackEmailUseCase,
private val tangemPayInfoManager: TangemPayMainInfoManager,
private val uiMessageSender: UiMessageSender,
) : BaseWalletClickIntents(), TangemPayIntents {
override suspend fun onPullToRefresh() {
@ -42,4 +64,72 @@ internal class TangemPayClickIntentsImplementor @Inject constructor(
tangemPayInfoManager.refreshTangemPayInfo(userWalletId)
}
}
override fun onIssuingCardClicked() {
val icon = MessageBottomSheetUMV2.Icon(
res = com.tangem.core.ui.R.drawable.ic_clock_24,
backgroundType = MessageBottomSheetUMV2.Icon.BackgroundType.Informative,
)
val info = MessageBottomSheetUMV2.InfoBlock(
title = resourceReference(R.string.tangempay_issuing_your_card),
body = resourceReference(R.string.tangempay_issuing_your_card_description),
)
val button = MessageBottomSheetUMV2.Button(
text = resourceReference(R.string.common_got_it),
onClick = { closeBs() },
)
val issuingBottomSheet = BottomSheetMessageV2(
messageBottomSheetUMV2 = MessageBottomSheetUMV2(
elements = persistentListOf(icon, info, button),
),
)
uiMessageSender.send(issuingBottomSheet)
}
override fun onIssuingFailedClicked() {
val icon = MessageBottomSheetUMV2.Icon(
res = com.tangem.core.ui.R.drawable.ic_alert_24,
backgroundType = MessageBottomSheetUMV2.Icon.BackgroundType.Warning,
type = MessageBottomSheetUMV2.Icon.Type.Warning,
)
val info = MessageBottomSheetUMV2.InfoBlock(
title = resourceReference(R.string.tangempay_failed_to_issue_card),
body = resourceReference(R.string.tangempay_failed_to_issue_card_support_description),
)
val button = MessageBottomSheetUMV2.Button(
text = resourceReference(R.string.details_row_title_contact_to_support),
onClick = {
onPaySupportClick()
closeBs()
},
)
val issuingBottomSheet = BottomSheetMessageV2(
messageBottomSheetUMV2 = MessageBottomSheetUMV2(
elements = persistentListOf(icon, info, button),
),
)
uiMessageSender.send(issuingBottomSheet)
}
override fun onPaySupportClick() {
modelScope.launch {
val userWalletId = stateHolder.getSelectedWalletId()
val userWallet = getUserWalletUseCase.invoke(userWalletId).getOrNull() ?: return@launch
val cardInfo = getWalletMetainfoUseCase.invoke(
userWallet.requireColdWallet().scanResponse,
).getOrNull() ?: return@launch
sendFeedbackEmailUseCase(
FeedbackEmailType.Visa.FailedIssueCard(
walletMetaInfo = cardInfo,
),
)
}
}
}

View file

@ -7,10 +7,10 @@ import com.tangem.core.decompose.di.ModelScoped
import com.tangem.domain.feedback.GetWalletMetaInfoUseCase
import com.tangem.domain.feedback.SendFeedbackEmailUseCase
import com.tangem.domain.feedback.models.FeedbackEmailType
import com.tangem.domain.models.wallet.requireColdWallet
import com.tangem.domain.visa.GetVisaCurrencyUseCase
import com.tangem.domain.visa.GetVisaTxDetailsUseCase
import com.tangem.domain.visa.model.VisaTxDetails
import com.tangem.domain.models.wallet.requireColdWallet
import com.tangem.domain.wallets.usecase.GetWalletsUseCase
import com.tangem.feature.wallet.presentation.wallet.state.WalletStateController
import com.tangem.feature.wallet.presentation.wallet.state.transformers.converter.BalancesAndLimitsBottomSheetConverter

View file

@ -138,7 +138,6 @@ internal class WalletWarningsClickIntentsImplementor @Inject constructor(
private val userWalletsListRepository: UserWalletsListRepository,
private val setShouldShowNotificationUseCase: SetShouldShowNotificationUseCase,
private val notificationsRepository: NotificationsRepository,
private val messageSender: UiMessageSender,
private val setNotificationsEnabledUseCase: SetNotificationsEnabledUseCase,
private val getWalletsListForEnablingUseCase: GetWalletsForAutomaticallyPushEnablingUseCase,
private val uiMessageSender: UiMessageSender,
@ -492,7 +491,7 @@ internal class WalletWarningsClickIntentsImplementor @Inject constructor(
}
}
}
messageSender.send(message)
uiMessageSender.send(message)
}
}
}

View file

@ -18,9 +18,17 @@ internal sealed class TangemPayState {
val showProgress: Boolean = false,
) : TangemPayState()
data class FailedIssue(
val title: TextReference,
val description: TextReference,
@DrawableRes val iconRes: Int,
val onButtonClick: () -> Unit,
) : TangemPayState()
data class Card(
val lastFourDigits: TextReference,
val balanceText: TextReference,
val balanceSymbol: TextReference,
val onClick: () -> Unit,
) : TangemPayState()

View file

@ -1,15 +1,18 @@
package com.tangem.feature.wallet.presentation.wallet.state.transformers
import com.tangem.core.ui.extensions.TextReference
import com.tangem.core.ui.extensions.stringReference
import com.tangem.core.ui.format.bigdecimal.fiat
import com.tangem.core.ui.format.bigdecimal.format
import com.tangem.domain.pay.TangemPayDetailsConfig
import com.tangem.domain.pay.model.CustomerInfo.CardInfo
import com.tangem.domain.pay.model.CustomerInfo.ProductInstance
import com.tangem.domain.pay.model.MainScreenCustomerInfo
import com.tangem.domain.pay.model.OrderStatus
import com.tangem.domain.visa.model.TangemPayCardFrozenState
import com.tangem.feature.wallet.presentation.wallet.state.model.TangemPayState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletScreenState
import com.tangem.feature.wallet.presentation.wallet.state.util.TangemPayStateCreator.createCancelledState
import com.tangem.feature.wallet.presentation.wallet.state.util.TangemPayStateCreator.createIssueProgressState
import com.tangem.feature.wallet.presentation.wallet.state.util.TangemPayStateCreator.createKycInProgressState
import java.util.Currency
@ -24,6 +27,8 @@ internal class TangemPayInitialStateTransformer(
private val value: MainScreenCustomerInfo? = null,
private val cardFrozenState: TangemPayCardFrozenState,
private val onClickKyc: () -> Unit = {},
private val onIssuingCard: () -> Unit = {},
private val onIssuingFailed: () -> Unit = {},
private val openDetails: (config: TangemPayDetailsConfig) -> Unit = {},
) : WalletScreenStateTransformer {
@ -37,9 +42,10 @@ internal class TangemPayInitialStateTransformer(
val productInstance = value?.info?.productInstance
return when {
value == null -> TangemPayState.Empty
value.orderStatus == OrderStatus.CANCELED -> createCancelledState(onIssuingFailed)
!value.info.isKycApproved -> createKycInProgressState(onClickKyc)
cardInfo != null && productInstance != null -> getCardInfoState(cardInfo, productInstance)
else -> createIssueProgressState()
else -> createIssueProgressState(onIssuingCard)
}
}
@ -47,6 +53,7 @@ internal class TangemPayInitialStateTransformer(
TangemPayState.Card(
lastFourDigits = TextReference.Str("*${cardInfo.lastFourDigits}"),
balanceText = TextReference.Str(getBalanceText(cardInfo)),
balanceSymbol = stringReference("USDC"), // TODO hardcode for now
onClick = {
openDetails(
TangemPayDetailsConfig(

View file

@ -1,10 +0,0 @@
package com.tangem.feature.wallet.presentation.wallet.state.transformers
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletScreenState
import com.tangem.feature.wallet.presentation.wallet.state.util.TangemPayStateCreator.createIssueProgressState
internal class TangemPayIssueProgressStateTransformer : WalletScreenStateTransformer {
override fun transform(prevState: WalletScreenState): WalletScreenState =
prevState.copy(tangemPayState = createIssueProgressState())
}

View file

@ -8,19 +8,26 @@ import com.tangem.feature.wallet.presentation.wallet.state.model.TangemPayState.
internal object TangemPayStateCreator {
fun createKycInProgressState(onClickKyc: () -> Unit): TangemPayState = Progress(
title = TextReference.Res(R.string.tangempay_kyc_in_progress_notification_title),
description = TextReference.EMPTY,
title = TextReference.Res(R.string.tangempay_payment_account),
description = TextReference.Res(R.string.tangempay_kyc_in_progress_notification_title),
buttonText = TextReference.Res(R.string.tangempay_kyc_in_progress_notification_button),
iconRes = R.drawable.ic_promo_kyc_36,
onButtonClick = onClickKyc,
)
fun createIssueProgressState(): TangemPayState = Progress(
title = TextReference.Res(R.string.tangempay_issue_card_notification_title),
description = TextReference.Res(R.string.tangempay_issue_card_notification_description),
fun createIssueProgressState(onIssuingCardClick: () -> Unit): TangemPayState = Progress(
title = TextReference.Res(R.string.tangempay_payment_account),
description = TextReference.Res(R.string.tangempay_issuing_your_card),
buttonText = TextReference.EMPTY,
iconRes = R.drawable.ic_tangem_pay_promo_card_36,
onButtonClick = {},
onButtonClick = onIssuingCardClick,
showProgress = true,
)
fun createCancelledState(onIssueFailedClick: () -> Unit): TangemPayState = TangemPayState.FailedIssue(
title = TextReference.Res(R.string.tangempay_payment_account),
description = TextReference.Res(R.string.tangempay_failed_to_issue_card),
iconRes = R.drawable.ic_alert_24,
onButtonClick = onIssueFailedClick,
)
}

View file

@ -2,13 +2,11 @@ package com.tangem.feature.wallet.presentation.wallet.ui.components.singlecurren
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
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.res.painterResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
@ -39,9 +37,9 @@ internal fun TangemPayCardMainBlock(
verticalAlignment = Alignment.CenterVertically,
) {
Image(
painter = painterResource(R.drawable.img_tangem_pay_card_main_36),
painter = painterResource(R.drawable.img_visa_36),
contentDescription = null,
modifier = Modifier.size(36.dp).clip(CircleShape),
modifier = Modifier.size(36.dp),
)
Spacer(Modifier.width(12.dp))
@ -58,23 +56,15 @@ internal fun TangemPayCardMainBlock(
Spacer(Modifier.height(6.dp))
Row(verticalAlignment = Alignment.CenterVertically) {
Image(
painter = painterResource(R.drawable.img_visa_label_26_16),
contentDescription = null,
modifier = Modifier.size(26.dp, 16.dp),
)
Spacer(Modifier.width(4.dp))
Text(
text = state.lastFourDigits.resolveReference(),
style = TangemTheme.typography.caption2,
color = TangemTheme.colors.text.tertiary,
)
}
Text(
text = state.lastFourDigits.resolveReference(),
style = TangemTheme.typography.caption2,
color = TangemTheme.colors.text.tertiary,
)
}
Box(
Column(
modifier = Modifier.fillMaxHeight(),
contentAlignment = Alignment.TopEnd,
horizontalAlignment = Alignment.End,
) {
Text(
text = state.balanceText.resolveReference().orMaskWithStars(isBalanceHidden),
@ -82,6 +72,13 @@ internal fun TangemPayCardMainBlock(
color = TangemTheme.colors.text.primary1,
textAlign = TextAlign.End,
)
Text(
text = state.balanceSymbol.resolveReference(),
style = TangemTheme.typography.body2,
color = TangemTheme.colors.text.tertiary,
textAlign = TextAlign.End,
)
}
}
}

View file

@ -0,0 +1,37 @@
package com.tangem.feature.wallet.presentation.wallet.ui.components.visa
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import com.tangem.core.ui.components.block.BlockCard
import com.tangem.core.ui.components.inputrow.InputRowImageBase
import com.tangem.core.ui.res.TangemTheme
import com.tangem.feature.wallet.presentation.wallet.state.model.TangemPayState
@Composable
internal fun TangemPayFailedIssueState(state: TangemPayState.FailedIssue) {
BlockCard(
modifier = Modifier
.clip(RoundedCornerShape(size = TangemTheme.dimens.radius14))
.background(TangemTheme.colors.background.primary),
) {
InputRowImageBase(
modifier = Modifier
.padding(
all = TangemTheme.dimens.spacing12,
)
.clickable(onClick = { state.onButtonClick }),
subtitle = state.title,
caption = state.description,
subtitleColor = TangemTheme.colors.text.primary1,
captionColor = TangemTheme.colors.text.tertiary,
iconResWebp = com.tangem.core.ui.R.drawable.img_visa_36,
iconEndRes = state.iconRes,
endIconTint = TangemTheme.colors.icon.warning,
)
}
}

View file

@ -3,15 +3,10 @@ package com.tangem.feature.wallet.presentation.wallet.ui.components.visa
import android.content.res.Configuration
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.tangem.common.ui.R
import com.tangem.core.ui.components.notifications.Notification
import com.tangem.core.ui.components.notifications.NotificationConfig
import com.tangem.core.ui.components.notifications.NotificationConfig.ButtonsState.*
import com.tangem.core.ui.extensions.TextReference
import com.tangem.core.ui.res.TangemTheme
import com.tangem.core.ui.res.TangemThemePreview
@ -22,27 +17,12 @@ import com.tangem.feature.wallet.presentation.wallet.ui.components.singlecurrenc
@Composable
internal fun TangemPayMainScreenBlock(state: TangemPayState, isBalanceHidden: Boolean, modifier: Modifier = Modifier) {
when (state) {
is Progress -> {
Notification(
modifier = modifier
.fillMaxWidth(),
config = NotificationConfig(
title = state.title,
iconSize = 36.dp,
subtitle = state.description,
iconResId = state.iconRes,
buttonsState = SecondaryButtonConfig(
text = state.buttonText,
onClick = state.onButtonClick,
shouldShowProgress = state.showProgress,
),
),
)
}
is Progress -> TangemPayProgressState(state)
is TangemPayState.Card -> TangemPayCardMainBlock(state, isBalanceHidden, modifier)
is TangemPayState.Empty -> Unit
is TangemPayState.RefreshNeeded -> TangemPayRefreshBlock(state, modifier)
is TangemPayState.TemporaryUnavailable -> TangemPayUnavailableBlock(state, modifier)
is TangemPayState.FailedIssue -> TangemPayFailedIssueState(state)
}
}
@ -90,6 +70,7 @@ private fun TangemPayMainScreenBlockPreview() {
TangemPayState.Card(
lastFourDigits = TextReference.Str("*1234"),
balanceText = TextReference.Str("$ 0.00"),
balanceSymbol = TextReference.Str("USDC"),
onClick = {},
),
isBalanceHidden = false,

View file

@ -0,0 +1,36 @@
package com.tangem.feature.wallet.presentation.wallet.ui.components.visa
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import com.tangem.core.ui.R
import com.tangem.core.ui.components.block.BlockCard
import com.tangem.core.ui.components.inputrow.InputRowImageBase
import com.tangem.core.ui.res.TangemTheme
import com.tangem.feature.wallet.presentation.wallet.state.model.TangemPayState
@Composable
internal fun TangemPayProgressState(state: TangemPayState.Progress) {
BlockCard(
modifier = Modifier
.clip(RoundedCornerShape(size = TangemTheme.dimens.radius14))
.background(TangemTheme.colors.background.primary),
) {
InputRowImageBase(
modifier = Modifier
.padding(
all = TangemTheme.dimens.spacing12,
)
.clickable(onClick = { state.onButtonClick }),
subtitle = state.title,
caption = state.description,
subtitleColor = TangemTheme.colors.text.primary1,
captionColor = TangemTheme.colors.text.tertiary,
iconResWebp = R.drawable.img_visa_36,
)
}
}