diff --git a/core/res/src/main/res/values-de/strings.xml b/core/res/src/main/res/values-de/strings.xml index bb6de8a19b..95bfe4d9e6 100644 --- a/core/res/src/main/res/values-de/strings.xml +++ b/core/res/src/main/res/values-de/strings.xml @@ -830,6 +830,8 @@ Das Zielkonto ist nicht aktiv. Sende %s oder mehr, um das Konto zu aktivieren. Senden Sie Geld an diese Andresse um ein Konto zu erstellen Das Zielkonto verfügt nicht über eine Vertrauensstellung für das gesendete Asset. + Sicher Dir 10 $ in BTC mit jeder Wallet greif schnell zu! + Black Friday: bis zu 30% Nachlass Jetzt beitreten Teile Deinen Code – verdiene 5 USDT pro Verkauf. Deine Freunde erhalten 10 % Rabatt. Erhalte BELOHNUNGEN für jeden Freund! diff --git a/core/res/src/main/res/values-ja/strings.xml b/core/res/src/main/res/values-ja/strings.xml index 84d5b13938..b15a7f50b0 100644 --- a/core/res/src/main/res/values-ja/strings.xml +++ b/core/res/src/main/res/values-ja/strings.xml @@ -32,6 +32,7 @@ このアカウントをアーカイブしますが、いつでも復元できます。 アーカイブ中・・・ アカウント + アカウントを編集できません アカウントが保存されました 報酬用のアカウント アカウント番号%s — アドレス導出に使用されます。 @@ -43,6 +44,7 @@ 新しいアカウント アカウントを追加 アカウントを編集 + 少し時間をおいて再度お試しください。問題が続く場合はサポートへご連絡ください。こちらで解決をお手伝いします。 %1$s ( %2$s内) メインアカウント すでにアクティブアカウントの上限%1$s件を超えています。復元するには、1つをアーカイブしてください。 @@ -435,7 +437,7 @@ インターネット接続を確認するか、別のネットワークに切り替えてください。 利用規約 デフォルトアドレス - レガシーアドレス + レガシー%sアドレス 資金を受け取る %sアドレス 他のネットワークで資産を送金すると、永久に失われます。 @@ -1416,9 +1418,20 @@ ポートフォリオ内のあらゆる資産をカードと交換 カードの詳細 カードの一時停止を解除 + 出金 + 現在、出金ができません + 現在の処理が完了するまでは、スワップや新しい出金を開始することはできません。 + 出金処理中です + カードの発行に失敗しました + 技術的なエラーが発生しました。下のボタンをクリックして、もう一度お試しください。 + 技術的なエラーが発生しました。サポートへお問い合わせください。 通常は最大で15分ほどかかります Tangemカードのセットアップ + カードを発行しています + カードを準備しています。少し時間がかかる場合があります。 Tangem Pay + プロフィールを確認できませんでした。ご不明な点があればサポートまでお問い合わせください。 + 申し訳ございませんが、本人確認を行うことができませんでした ステータスを表示 Tangem PayのKYC手続き進行中 カードをGET diff --git a/core/res/src/main/res/values-ru/strings.xml b/core/res/src/main/res/values-ru/strings.xml index 6288a0dc4c..db0fefa23f 100644 --- a/core/res/src/main/res/values-ru/strings.xml +++ b/core/res/src/main/res/values-ru/strings.xml @@ -26,6 +26,7 @@ Вы архивируете свой аккаунт, но в любое время можете вернуть его обратно Архивация... Аккаунт + Невозможно отредактировать аккаунт Аккаунт для наград Добавить аккаунт Сохранить @@ -831,7 +832,7 @@ Аккаунт получателя не активирован. Отправьте %s или более для активации аккаунта. Для создания аккаунта отправьте средства на этот адрес Аккаунт получателя не содержит трастлайна для отправляемого актива. - Получите $10 в BTC за каждый кошелёк\nПоторопитесь! + Получите $10 в BTC за каждый кошелёк.\nПоторопитесь! Чёрная пятница: скидки до 30% Присоединиться Поделись промокодом — заработай 5 USDT с каждой покупки. Твои друзья получат скидку 10% на карту Tangem! diff --git a/core/res/src/main/res/values/strings.xml b/core/res/src/main/res/values/strings.xml index 79b1362cb7..918fe3a51b 100644 --- a/core/res/src/main/res/values/strings.xml +++ b/core/res/src/main/res/values/strings.xml @@ -44,6 +44,7 @@ New account Add account Edit account + Please try again later. If it keeps happening, get in touch with support and we’ll help you resolve it. %1$s in %2$s Main account You have already exceeded the limit of %1$s active accounts. Archive one to recover @@ -1986,6 +1987,7 @@ Decentralized and self-custodial By using this service, you agree with provider\n%1$s and %2$s Connect to Aave + Enable %1$s%% APY on your balance Aave %1$s%% • Variable Interest Rate Aave Avg %s diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/inputrow/InputRowImageBase.kt b/core/ui/src/main/java/com/tangem/core/ui/components/inputrow/InputRowImageBase.kt index 322fb14ef4..95bab732db 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/inputrow/InputRowImageBase.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/inputrow/InputRowImageBase.kt @@ -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), ) diff --git a/domain/feedback/models/src/main/kotlin/com/tangem/domain/feedback/models/FeedbackEmailType.kt b/domain/feedback/models/src/main/kotlin/com/tangem/domain/feedback/models/FeedbackEmailType.kt index df2d3bd01e..75eb04a10a 100644 --- a/domain/feedback/models/src/main/kotlin/com/tangem/domain/feedback/models/FeedbackEmailType.kt +++ b/domain/feedback/models/src/main/kotlin/com/tangem/domain/feedback/models/FeedbackEmailType.kt @@ -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() diff --git a/domain/feedback/src/main/java/com/tangem/domain/feedback/SendFeedbackEmailUseCase.kt b/domain/feedback/src/main/java/com/tangem/domain/feedback/SendFeedbackEmailUseCase.kt index 0aff9662cf..97cf3eac5d 100644 --- a/domain/feedback/src/main/java/com/tangem/domain/feedback/SendFeedbackEmailUseCase.kt +++ b/domain/feedback/src/main/java/com/tangem/domain/feedback/SendFeedbackEmailUseCase.kt @@ -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() diff --git a/domain/feedback/src/main/java/com/tangem/domain/feedback/utils/EmailMessageBodyResolver.kt b/domain/feedback/src/main/java/com/tangem/domain/feedback/utils/EmailMessageBodyResolver.kt index cf9a7a8208..1984abe218 100644 --- a/domain/feedback/src/main/java/com/tangem/domain/feedback/utils/EmailMessageBodyResolver.kt +++ b/domain/feedback/src/main/java/com/tangem/domain/feedback/utils/EmailMessageBodyResolver.kt @@ -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) } diff --git a/domain/feedback/src/main/java/com/tangem/domain/feedback/utils/EmailMessageTitleResolver.kt b/domain/feedback/src/main/java/com/tangem/domain/feedback/utils/EmailMessageTitleResolver.kt index 7a76916fd1..349abcde4b 100644 --- a/domain/feedback/src/main/java/com/tangem/domain/feedback/utils/EmailMessageTitleResolver.kt +++ b/domain/feedback/src/main/java/com/tangem/domain/feedback/utils/EmailMessageTitleResolver.kt @@ -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 diff --git a/domain/feedback/src/main/java/com/tangem/domain/feedback/utils/EmailSubjectResolver.kt b/domain/feedback/src/main/java/com/tangem/domain/feedback/utils/EmailSubjectResolver.kt index e930678eae..c12948f861 100644 --- a/domain/feedback/src/main/java/com/tangem/domain/feedback/utils/EmailSubjectResolver.kt +++ b/domain/feedback/src/main/java/com/tangem/domain/feedback/utils/EmailSubjectResolver.kt @@ -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}" diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/WalletModel.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/WalletModel.kt index 2746942333..253fe5af7b 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/WalletModel.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/WalletModel.kt @@ -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, diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/intents/TangemPayClickIntents.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/intents/TangemPayClickIntents.kt index 4f13aa6654..2c4e464d63 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/intents/TangemPayClickIntents.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/intents/TangemPayClickIntents.kt @@ -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, + ), + ) + } + } } \ No newline at end of file diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/intents/VisaWalletIntents.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/intents/VisaWalletIntents.kt index 0c9b0a698c..726ed11fa8 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/intents/VisaWalletIntents.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/intents/VisaWalletIntents.kt @@ -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 diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/intents/WalletWarningsClickIntents.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/intents/WalletWarningsClickIntents.kt index e4f32d06b9..279b90f3ee 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/intents/WalletWarningsClickIntents.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/intents/WalletWarningsClickIntents.kt @@ -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) } } } diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/model/TangemPayState.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/model/TangemPayState.kt index 7159878276..71ad45e71a 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/model/TangemPayState.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/model/TangemPayState.kt @@ -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() diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/TangemPayInitialStateTransformer.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/TangemPayInitialStateTransformer.kt index c3b3ee25aa..9df5ca4796 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/TangemPayInitialStateTransformer.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/TangemPayInitialStateTransformer.kt @@ -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( diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/TangemPayIssueProgressStateTransformer.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/TangemPayIssueProgressStateTransformer.kt deleted file mode 100644 index b7bc76806e..0000000000 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/TangemPayIssueProgressStateTransformer.kt +++ /dev/null @@ -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()) -} \ No newline at end of file diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/util/TangemPayStateCreator.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/util/TangemPayStateCreator.kt index 4f09e36f0a..a28ff09b12 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/util/TangemPayStateCreator.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/util/TangemPayStateCreator.kt @@ -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, + ) } \ No newline at end of file diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/singlecurrency/TangemPayCardMainBlock.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/singlecurrency/TangemPayCardMainBlock.kt index 3a07018d27..f7d4d6fa87 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/singlecurrency/TangemPayCardMainBlock.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/singlecurrency/TangemPayCardMainBlock.kt @@ -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, + ) } } } diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/visa/TangemPayFailedIssueState.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/visa/TangemPayFailedIssueState.kt new file mode 100644 index 0000000000..f8e2f29da6 --- /dev/null +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/visa/TangemPayFailedIssueState.kt @@ -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, + ) + } +} \ No newline at end of file diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/visa/TangemPayMainScreenBlock.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/visa/TangemPayMainScreenBlock.kt index d38fbba5b1..4b4a9bce09 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/visa/TangemPayMainScreenBlock.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/visa/TangemPayMainScreenBlock.kt @@ -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, diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/visa/TangemPayProgressState.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/visa/TangemPayProgressState.kt new file mode 100644 index 0000000000..1dabba345f --- /dev/null +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/visa/TangemPayProgressState.kt @@ -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, + ) + } +} \ No newline at end of file