From 22fafe9ddef34a0b19bc3d6bd21ffb873efe91be Mon Sep 17 00:00:00 2001 From: Tangem Date: Wed, 28 May 2025 12:58:13 +0300 Subject: [PATCH] Updated on 2026-08-14 --- .../com/tangem/domain/visa/error/VisaError.kt | 29 ++++++++++--------- .../wallet/ui/components/WalletNFTItem.kt | 6 ++-- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/domain/visa/models/src/main/kotlin/com/tangem/domain/visa/error/VisaError.kt b/domain/visa/models/src/main/kotlin/com/tangem/domain/visa/error/VisaError.kt index 74fe7a43fb..ec42fc56c5 100644 --- a/domain/visa/models/src/main/kotlin/com/tangem/domain/visa/error/VisaError.kt +++ b/domain/visa/models/src/main/kotlin/com/tangem/domain/visa/error/VisaError.kt @@ -49,28 +49,29 @@ enum class VisaActivationError( sealed class VisaApiError( override val errorCode: Int, ) : UniversalError { - // TODO codes may change - data object Unspecified : VisaApiError(104100000) - data object ProductInstanceNotFoundActivationRequired : VisaApiError(104100100) - data object ProductInstanceIsBlocked : VisaApiError(104101000) - data object ProductInstanceIsNotActivated : VisaApiError(104101100) - data object ProductInstanceIsAlreadyActivated : VisaApiError(104101200) - data object CustomerIsBlocked : VisaApiError(104102000) - data object UnknownWithoutCode : VisaApiError(104101999) + data object Unspecified : VisaApiError(104110205) + data object ProductInstanceNotFoundActivationRequired : VisaApiError(104110206) + data object ProductInstanceIsBlocked : VisaApiError(104110209) + data object ProductInstanceIsNotActivated : VisaApiError(104110208) + data object ProductInstanceIsAlreadyActivated : VisaApiError(104110207) + data object CustomerIsBlocked : VisaApiError(104110210) + data object UnknownWithoutCode : VisaApiError(104110999) data class Unknown(override val errorCode: Int) : VisaApiError(errorCode) + fun isUnknown() = this is UnknownWithoutCode || this is Unknown + data object RefreshTokenExpired : VisaApiError(104004001) companion object { fun fromBackendError(backendErrorCode: Int): VisaApiError { val universalErrorCode = 104_000_000 + backendErrorCode return when (universalErrorCode) { - 104100000 -> Unspecified - 104100100 -> ProductInstanceNotFoundActivationRequired - 104101000 -> ProductInstanceIsBlocked - 104101100 -> ProductInstanceIsNotActivated - 104101200 -> ProductInstanceIsAlreadyActivated - 104102000 -> CustomerIsBlocked + Unspecified.errorCode -> Unspecified + ProductInstanceNotFoundActivationRequired.errorCode -> ProductInstanceNotFoundActivationRequired + ProductInstanceIsBlocked.errorCode -> ProductInstanceIsBlocked + ProductInstanceIsNotActivated.errorCode -> ProductInstanceIsNotActivated + ProductInstanceIsAlreadyActivated.errorCode -> ProductInstanceIsAlreadyActivated + CustomerIsBlocked.errorCode -> CustomerIsBlocked else -> Unknown(universalErrorCode) } } diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/WalletNFTItem.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/WalletNFTItem.kt index 3eb3de541b..079f2876e1 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/WalletNFTItem.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/WalletNFTItem.kt @@ -25,7 +25,6 @@ import com.tangem.core.ui.R import com.tangem.core.ui.components.RectangleShimmer import com.tangem.core.ui.components.TextShimmer import com.tangem.core.ui.components.text.applyBladeBrush -import com.tangem.core.ui.extensions.pluralStringResourceSafe import com.tangem.core.ui.extensions.stringResourceSafe import com.tangem.core.ui.res.TangemTheme import com.tangem.core.ui.res.TangemThemePreview @@ -107,9 +106,8 @@ private fun WalletNFTItemContent(state: WalletNFTItemUM.Content, onClick: () -> overflow = TextOverflow.Ellipsis, ) Text( - text = pluralStringResourceSafe( - id = R.plurals.nft_wallet_count, - state.collectionsCount, + text = stringResourceSafe( + id = R.string.nft_wallet_count, state.assetsCount, state.collectionsCount, ),