From a6ab6a6eaf0a22d048848bdf70d21a00210a42c7 Mon Sep 17 00:00:00 2001 From: Tangem Date: Wed, 27 Mar 2024 12:43:32 +0100 Subject: [PATCH] Updated on 2026-08-14 --- core/res/src/main/res/values-ru/strings.xml | 7 ++- .../src/main/res/values-zh-rTW/strings.xml | 2 - core/res/src/main/res/values/strings.xml | 9 ++- .../swap/converters/ErrorsDataConverter.kt | 2 + .../feature/swap/domain/models/DataError.kt | 4 ++ .../domain/models/ui/SwapTransactionState.kt | 29 ++++++++++ .../feature/swap/domain/models/ui/TxState.kt | 22 -------- .../feature/swap/domain/SwapInteractor.kt | 6 +- .../feature/swap/domain/SwapInteractorImpl.kt | 55 ++++++++++--------- .../tangem/feature/swap/ui/StateBuilder.kt | 51 ++++++++++++++--- .../tangem/feature/swap/ui/TransactionCard.kt | 6 +- .../feature/swap/viewmodels/SwapViewModel.kt | 10 ++-- .../components/exchange/ExchangeProvider.kt | 3 +- 13 files changed, 131 insertions(+), 75 deletions(-) create mode 100644 features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/ui/SwapTransactionState.kt delete mode 100644 features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/ui/TxState.kt diff --git a/core/res/src/main/res/values-ru/strings.xml b/core/res/src/main/res/values-ru/strings.xml index 79539f13a8..95cd7e9498 100644 --- a/core/res/src/main/res/values-ru/strings.xml +++ b/core/res/src/main/res/values-ru/strings.xml @@ -183,6 +183,9 @@ Tangem предоставляет доступ к обмену через сторонних поставщиков в соответствии с их правилами Выберите провайдера Произошла ошибка. Код: %s + К сожалению обмен указанной пары через выбранного провайдера на данный момент не возможен. Попробуйте совершить обмен позже. (Код:\u00A0%s) + Выбранный провайдер не доступен для обмена. Попробуйте позже. (Код:\u00A0%s) + В данный момент обмен не возможен. Попробуйте позже. (Код:\u00A0%s) Курс обмена Обмен через %s Чтобы вернуть ваши деньги, посетите сайт провайдера @@ -273,10 +276,11 @@ Защита Позже вы сможете установить индивидуальный код доступа для каждой карты Персонализация - Код доступа можно восстановить с помощью привязанной карты. Не храните все карты в одном месте + Код доступа можно восстановить с помощью привязанной карты. Не храните все карты в одном месте. Восстановление Выберите любое слово, фразу или число в качестве кода доступа Создайте код доступа + Введите код доступа еще раз, чтобы избежать ошибки Повторно введите код доступа Код доступа должен состоять не менее чем из 4 символов. Введенные коды доступа не совпадают @@ -619,6 +623,7 @@ Нет доступных для обмена токенов Чтобы совершить транзакцию, вам необходимо внести немного %1$s %2$s Невозможно покрыть комиссию %s + Сумма получения не может быть менее %s Cервис временно недоступен Сумма для обмена должна быть не более %s Сумма для обмена должна быть не менее %s diff --git a/core/res/src/main/res/values-zh-rTW/strings.xml b/core/res/src/main/res/values-zh-rTW/strings.xml index a8a013bebc..841f0df3bb 100644 --- a/core/res/src/main/res/values-zh-rTW/strings.xml +++ b/core/res/src/main/res/values-zh-rTW/strings.xml @@ -139,11 +139,9 @@ 要訪問所有的網路您需要掃描卡片 掃描卡片 代幣 - 您必須設置一個單一的訪問代碼來保護您的所有錢包 保護 您可以稍後在每張卡上設置單獨的訪問密碼 個人化 - 門禁密碼可以用聯動卡恢復,不要把所有卡都放在一個地方 恢復 選擇您想要的任何單詞、短語或數字作為您的訪問代碼 建立訪問密碼 diff --git a/core/res/src/main/res/values/strings.xml b/core/res/src/main/res/values/strings.xml index d91eeb01d1..597b184e40 100644 --- a/core/res/src/main/res/values/strings.xml +++ b/core/res/src/main/res/values/strings.xml @@ -182,6 +182,9 @@ Tangem offers token swaps via 3rd-party providers according to each provider\'s terms Choose provider An error occurred. Code: %s + Oops! Swapping the selected pair through the chosen provider is temporarily unavailable. Please try again later. (Code:\u00A0%s) + Selected provider is unavailable at the moment. Please try again later. (Code:\u00A0%s) + Swaps are unavailable at the moment. Please try again later. (Code:\u00A0%s) Estimated amount Exchange by %s Visit provider’s website to refund your money @@ -269,14 +272,15 @@ Upvote Choose wallet The wallet doesn\'t support more than one network - You have to set up a single access code to protect all your wallets + You have to set up a single access code to protect all your cards Protect You can set up an individual access code on each card later Personalize - The access code can be restored with a linked card, don\'t keep all cards in one place + The access code can be restored with a linked card. Don’t keep all cards at one place. Restore Choose any word, phrase, or number you want as your access code Create Access Code + Enter your access code one more time to avoid a mistake Re-enter your Access Code Access code must be at least 4 characters long Entered access code didn\'t match the initial access code @@ -629,6 +633,7 @@ No available tokens to swap To make a transaction you need to deposit some %1$s %2$s Unable to cover %s fee + The amount to receive must be at least %s Service temporarily unavailable The amount of tokens to be swapped must not exceed %s The amount to swap must be at least %s diff --git a/features/swap/data/src/main/java/com/tangem/feature/swap/converters/ErrorsDataConverter.kt b/features/swap/data/src/main/java/com/tangem/feature/swap/converters/ErrorsDataConverter.kt index dca890c55e..ee0cf5d41d 100644 --- a/features/swap/data/src/main/java/com/tangem/feature/swap/converters/ErrorsDataConverter.kt +++ b/features/swap/data/src/main/java/com/tangem/feature/swap/converters/ErrorsDataConverter.kt @@ -18,9 +18,11 @@ internal class ErrorsDataConverter( return when (error.code) { 2010 -> DataError.BadRequest(code = error.code) + 2200 -> DataError.SwapsAreUnavailableNowError(code = error.code) 2210 -> DataError.ExchangeProviderNotFoundError(code = error.code) 2220 -> DataError.ExchangeProviderNotActiveError(code = error.code) 2230 -> DataError.ExchangeProviderNotAvailableError(code = error.code) + 2231 -> DataError.ExchangeProviderProviderInternalError(code = error.code) 2240 -> DataError.ExchangeNotPossibleError(code = error.code) 2250 -> tryParseExchangeTooSmallAmountError(error = error) 2251 -> tryParseExchangeTooBigAmountError(error = error) diff --git a/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/DataError.kt b/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/DataError.kt index d4881c27b8..12e5db5e37 100644 --- a/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/DataError.kt +++ b/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/DataError.kt @@ -8,12 +8,16 @@ sealed class DataError { data class BadRequest(override val code: Int) : DataError() + data class SwapsAreUnavailableNowError(override val code: Int) : DataError() + data class ExchangeProviderNotFoundError(override val code: Int) : DataError() data class ExchangeProviderNotActiveError(override val code: Int) : DataError() data class ExchangeProviderNotAvailableError(override val code: Int) : DataError() + data class ExchangeProviderProviderInternalError(override val code: Int) : DataError() + data class ExchangeNotPossibleError(override val code: Int) : DataError() data class ExchangeTooSmallAmountError(override val code: Int, val amount: SwapAmount) : DataError() diff --git a/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/ui/SwapTransactionState.kt b/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/ui/SwapTransactionState.kt new file mode 100644 index 0000000000..6ba68ddd31 --- /dev/null +++ b/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/ui/SwapTransactionState.kt @@ -0,0 +1,29 @@ +package com.tangem.feature.swap.domain.models.ui + +import com.tangem.feature.swap.domain.models.DataError +import java.math.BigDecimal + +sealed class SwapTransactionState { + + data class TxSent( + val fromAmount: String? = null, + val fromAmountValue: BigDecimal? = null, + val toAmount: String? = null, + val toAmountValue: BigDecimal? = null, + val txHash: String, + val txExternalUrl: String? = null, + val timestamp: Long, + ) : SwapTransactionState() + + data object UserCancelled : SwapTransactionState() + + data object BlockchainError : SwapTransactionState() + + data object TangemSdkError : SwapTransactionState() + + data object NetworkError : SwapTransactionState() + + data object UnknownError : SwapTransactionState() + + data class ExpressError(val dataError: DataError) : SwapTransactionState() +} \ No newline at end of file diff --git a/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/ui/TxState.kt b/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/ui/TxState.kt deleted file mode 100644 index 14259bc672..0000000000 --- a/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/ui/TxState.kt +++ /dev/null @@ -1,22 +0,0 @@ -package com.tangem.feature.swap.domain.models.ui - -import java.math.BigDecimal - -sealed class TxState { - - data class TxSent( - val fromAmount: String? = null, - val fromAmountValue: BigDecimal? = null, - val toAmount: String? = null, - val toAmountValue: BigDecimal? = null, - val txHash: String, - val txExternalUrl: String? = null, - val timestamp: Long, - ) : TxState() - - object UserCancelled : TxState() - object BlockchainError : TxState() - object TangemSdkError : TxState() - object NetworkError : TxState() - object UnknownError : TxState() -} \ No newline at end of file diff --git a/features/swap/domain/src/main/java/com/tangem/feature/swap/domain/SwapInteractor.kt b/features/swap/domain/src/main/java/com/tangem/feature/swap/domain/SwapInteractor.kt index b43322b46a..dafaff9a51 100644 --- a/features/swap/domain/src/main/java/com/tangem/feature/swap/domain/SwapInteractor.kt +++ b/features/swap/domain/src/main/java/com/tangem/feature/swap/domain/SwapInteractor.kt @@ -21,7 +21,7 @@ interface SwapInteractor { * @param permissionOptions data to give permissions */ @Throws(IllegalStateException::class) - suspend fun givePermissionToSwap(networkId: String, permissionOptions: PermissionOptions): TxState + suspend fun givePermissionToSwap(networkId: String, permissionOptions: PermissionOptions): SwapTransactionState /** * Find best quote for given tokens to swap @@ -51,7 +51,7 @@ interface SwapInteractor { * @param currencyToGet [Currency] * @param amountToSwap amount to swap * @param fee for tx - * @return [TxState] + * @return [SwapTransactionState] */ @Suppress("LongParameterList") @Throws(IllegalStateException::class) @@ -63,7 +63,7 @@ interface SwapInteractor { amountToSwap: String, includeFeeInAmount: IncludeFeeInAmount, fee: TxFee, - ): TxState + ): SwapTransactionState suspend fun updateQuotesStateWithSelectedFee( state: SwapState.QuotesLoadedState, diff --git a/features/swap/domain/src/main/java/com/tangem/feature/swap/domain/SwapInteractorImpl.kt b/features/swap/domain/src/main/java/com/tangem/feature/swap/domain/SwapInteractorImpl.kt index b401d09f3c..6df1eadf9d 100644 --- a/features/swap/domain/src/main/java/com/tangem/feature/swap/domain/SwapInteractorImpl.kt +++ b/features/swap/domain/src/main/java/com/tangem/feature/swap/domain/SwapInteractorImpl.kt @@ -197,7 +197,10 @@ internal class SwapInteractorImpl @Inject constructor( return repository.getPairs(initialCurrency, currenciesList) } - override suspend fun givePermissionToSwap(networkId: String, permissionOptions: PermissionOptions): TxState { + override suspend fun givePermissionToSwap( + networkId: String, + permissionOptions: PermissionOptions, + ): SwapTransactionState { val derivationPath = permissionOptions.fromToken.network.derivationPath.value val dataToSign = if (permissionOptions.approveType == SwapApproveType.UNLIMITED) { getApproveData( @@ -227,16 +230,16 @@ internal class SwapInteractorImpl @Inject constructor( return when (result) { is SendTxResult.Success -> { allowPermissionsHandler.addAddressToInProgress(permissionOptions.forTokenContractAddress) - TxState.TxSent( + SwapTransactionState.TxSent( txHash = userWalletManager.getLastTransactionHash(networkId, derivationPath).orEmpty(), timestamp = System.currentTimeMillis(), ) } - SendTxResult.UserCancelledError -> TxState.UserCancelled - is SendTxResult.BlockchainSdkError -> TxState.BlockchainError - is SendTxResult.TangemSdkError -> TxState.TangemSdkError - is SendTxResult.NetworkError -> TxState.NetworkError - is SendTxResult.UnknownError -> TxState.UnknownError + SendTxResult.UserCancelledError -> SwapTransactionState.UserCancelled + is SendTxResult.BlockchainSdkError -> SwapTransactionState.BlockchainError + is SendTxResult.TangemSdkError -> SwapTransactionState.TangemSdkError + is SendTxResult.NetworkError -> SwapTransactionState.NetworkError + is SendTxResult.UnknownError -> SwapTransactionState.UnknownError } } @@ -442,7 +445,7 @@ internal class SwapInteractorImpl @Inject constructor( amountToSwap: String, includeFeeInAmount: IncludeFeeInAmount, fee: TxFee, - ): TxState { + ): SwapTransactionState { return when (swapProvider.type) { ExchangeProviderType.CEX -> { val amountDecimal = toBigDecimalOrNull(amountToSwap) @@ -519,7 +522,7 @@ internal class SwapInteractorImpl @Inject constructor( currencyToGet: CryptoCurrency, amountToSwap: String, fee: TxFee, - ): TxState { + ): SwapTransactionState { val amountDecimal = requireNotNull(toBigDecimalOrNull(amountToSwap)) { "wrong amount format" } val amount = SwapAmount(amountDecimal, currencyToSend.decimals) val derivationPath = currencyToSend.network.derivationPath.value @@ -543,7 +546,7 @@ internal class SwapInteractorImpl @Inject constructor( return when (result) { is SendTxResult.Success -> { storeLastCryptoCurrencyId(currencyToGet) - TxState.TxSent( + SwapTransactionState.TxSent( fromAmount = amountFormatter.formatSwapAmountToUI( amount, currencyToSend.symbol, @@ -558,11 +561,11 @@ internal class SwapInteractorImpl @Inject constructor( timestamp = System.currentTimeMillis(), ) } - SendTxResult.UserCancelledError -> TxState.UserCancelled - is SendTxResult.BlockchainSdkError -> TxState.BlockchainError - is SendTxResult.TangemSdkError -> TxState.TangemSdkError - is SendTxResult.NetworkError -> TxState.NetworkError - is SendTxResult.UnknownError -> TxState.UnknownError + SendTxResult.UserCancelledError -> SwapTransactionState.UserCancelled + is SendTxResult.BlockchainSdkError -> SwapTransactionState.BlockchainError + is SendTxResult.TangemSdkError -> SwapTransactionState.TangemSdkError + is SendTxResult.NetworkError -> SwapTransactionState.NetworkError + is SendTxResult.UnknownError -> SwapTransactionState.UnknownError } } @@ -574,7 +577,7 @@ internal class SwapInteractorImpl @Inject constructor( txFee: TxFee, swapProvider: SwapProvider, userWalletId: UserWalletId, - ): TxState { + ): SwapTransactionState { val exchangeData = repository.getExchangeData( fromContractAddress = currencyToSend.currency.getContractAddress(), fromNetwork = currencyToSend.currency.network.backendId, @@ -586,15 +589,17 @@ internal class SwapInteractorImpl @Inject constructor( providerId = swapProvider.providerId, rateType = RateType.FLOAT, toAddress = currencyToGet.value.networkAddress?.defaultAddress?.value ?: "", - ).getOrNull() + ).getOrElse { return SwapTransactionState.ExpressError(it) } + + val exchangeDataCex = + exchangeData.transaction as? ExpressTransactionModel.CEX ?: return SwapTransactionState.UnknownError - val exchangeDataCex = exchangeData?.transaction as? ExpressTransactionModel.CEX ?: return TxState.UnknownError val txExtras = transactionManager.getMemoExtras( currencyToSend.currency.network.backendId, exchangeDataCex.txExtraId, ) if (txExtras == null && exchangeDataCex.txExtraId != null) { - return TxState.UnknownError + return SwapTransactionState.UnknownError } val txData = walletManagersFacade.createTransaction( amount = amount.value.convertToAmount(currencyToSend.currency), @@ -622,11 +627,11 @@ internal class SwapInteractorImpl @Inject constructor( return result.fold( ifLeft = { when (it) { - SendTransactionError.UserCancelledError -> TxState.UserCancelled - is SendTransactionError.BlockchainSdkError -> TxState.BlockchainError - is SendTransactionError.TangemSdkError -> TxState.TangemSdkError - is SendTransactionError.NetworkError -> TxState.NetworkError - else -> TxState.UnknownError + SendTransactionError.UserCancelledError -> SwapTransactionState.UserCancelled + is SendTransactionError.BlockchainSdkError -> SwapTransactionState.BlockchainError + is SendTransactionError.TangemSdkError -> SwapTransactionState.TangemSdkError + is SendTransactionError.NetworkError -> SwapTransactionState.NetworkError + else -> SwapTransactionState.UnknownError } }, ifRight = { @@ -643,7 +648,7 @@ internal class SwapInteractorImpl @Inject constructor( txExternalId = txCexModel?.externalTxId.orEmpty(), ) storeLastCryptoCurrencyId(currencyToGet.currency) - TxState.TxSent( + SwapTransactionState.TxSent( fromAmount = amountFormatter.formatSwapAmountToUI( amount, currencyToSend.currency.symbol, diff --git a/features/swap/presentation/src/main/java/com/tangem/feature/swap/ui/StateBuilder.kt b/features/swap/presentation/src/main/java/com/tangem/feature/swap/ui/StateBuilder.kt index fc73c5029a..70bfd13e22 100644 --- a/features/swap/presentation/src/main/java/com/tangem/feature/swap/ui/StateBuilder.kt +++ b/features/swap/presentation/src/main/java/com/tangem/feature/swap/ui/StateBuilder.kt @@ -926,7 +926,7 @@ internal class StateBuilder( @Suppress("LongParameterList") fun createSuccessState( uiState: SwapStateHolder, - txState: TxState.TxSent, + swapTransactionState: SwapTransactionState.TxSent, dataState: SwapProcessDataState, onExploreClick: () -> Unit, onStatusClick: () -> Unit, @@ -935,8 +935,8 @@ internal class StateBuilder( val fee = requireNotNull(dataState.selectedFee) val fromCryptoCurrency = requireNotNull(dataState.fromCryptoCurrency) val toCryptoCurrency = requireNotNull(dataState.toCryptoCurrency) - val fromAmount = txState.fromAmountValue ?: BigDecimal.ZERO - val toAmount = txState.toAmountValue ?: BigDecimal.ZERO + val fromAmount = swapTransactionState.fromAmountValue ?: BigDecimal.ZERO + val toAmount = swapTransactionState.toAmountValue ?: BigDecimal.ZERO val providerState = uiState.providerState as ProviderState.Content val fromFiatAmount = getFormattedFiatAmount(fromCryptoCurrency.value.fiatRate?.multiply(fromAmount)) @@ -944,7 +944,7 @@ internal class StateBuilder( return uiState.copy( successState = SwapSuccessStateHolder( - timestamp = txState.timestamp, + timestamp = swapTransactionState.timestamp, txUrl = txUrl, providerName = stringReference(providerState.name), providerType = stringReference(providerState.type), @@ -952,8 +952,8 @@ internal class StateBuilder( providerIcon = providerState.iconUrl, rate = providerState.subtitle, fee = stringReference("${fee.feeCryptoFormatted} (${fee.feeFiatFormatted})"), - fromTokenAmount = stringReference(txState.fromAmount.orEmpty()), - toTokenAmount = stringReference(txState.toAmount.orEmpty()), + fromTokenAmount = stringReference(swapTransactionState.fromAmount.orEmpty()), + toTokenAmount = stringReference(swapTransactionState.toAmount.orEmpty()), fromTokenFiatAmount = stringReference(fromFiatAmount), toTokenFiatAmount = stringReference(toFiatAmount), fromTokenIconState = iconStateConverter.convert(fromCryptoCurrency), @@ -964,17 +964,50 @@ internal class StateBuilder( ) } - fun createErrorTransaction(uiState: SwapStateHolder, txState: TxState, onAlertClick: () -> Unit): SwapStateHolder { + fun createErrorTransaction( + uiState: SwapStateHolder, + swapTransactionState: SwapTransactionState, + onAlertClick: () -> Unit, + ): SwapStateHolder { return uiState.copy( alert = SwapWarning.GenericWarning( - message = null, + message = if (swapTransactionState is SwapTransactionState.ExpressError) { + getAlertErrorMessage(swapTransactionState.dataError) + } else { + null + }, onClick = onAlertClick, - type = if (txState is TxState.NetworkError) GenericWarningType.NETWORK else GenericWarningType.OTHER, + type = if (swapTransactionState is SwapTransactionState.NetworkError) { + GenericWarningType.NETWORK + } else { + GenericWarningType.OTHER + }, ), changeCardsButtonState = ChangeCardsButtonState.ENABLED, ) } + private fun getAlertErrorMessage(dataError: DataError): TextReference? { + return when (dataError) { + is DataError.SwapsAreUnavailableNowError -> resourceReference( + id = R.string.express_error_swap_unavailable, + formatArgs = wrappedList(dataError.code), + ) + is DataError.ExchangeNotPossibleError -> resourceReference( + id = R.string.express_error_provider_unavailable, + formatArgs = wrappedList(dataError.code), + ) + is DataError.ExchangeProviderNotActiveError, + is DataError.ExchangeProviderNotAvailableError, + is DataError.ExchangeProviderProviderInternalError, + -> resourceReference( + id = R.string.express_error_swap_pair_unavailable, + formatArgs = wrappedList(dataError.code), + ) + else -> null + } + } + fun createAlert( uiState: SwapStateHolder, isPriceImpact: Boolean, diff --git a/features/swap/presentation/src/main/java/com/tangem/feature/swap/ui/TransactionCard.kt b/features/swap/presentation/src/main/java/com/tangem/feature/swap/ui/TransactionCard.kt index d9a604c6d4..bd77a3f66e 100644 --- a/features/swap/presentation/src/main/java/com/tangem/feature/swap/ui/TransactionCard.kt +++ b/features/swap/presentation/src/main/java/com/tangem/feature/swap/ui/TransactionCard.kt @@ -283,7 +283,7 @@ private fun Content( if (amountEquivalent != null) { if (type is TransactionCardType.ReadOnly) { - Row { + Row(modifier = Modifier.defaultMinSize(minHeight = TangemTheme.dimens.size20)) { if (priceImpact is PriceImpact.Value) { Text( text = makePriceImpactBalanceWarning( @@ -293,7 +293,6 @@ private fun Content( color = TangemTheme.colors.text.tertiary, style = TangemTheme.typography.body2, modifier = Modifier - .defaultMinSize(minHeight = TangemTheme.dimens.size20) .align(Alignment.CenterVertically), ) } else { @@ -302,7 +301,6 @@ private fun Content( text = it, color = TangemTheme.colors.text.tertiary, style = TangemTheme.typography.body2, - modifier = Modifier.defaultMinSize(minHeight = TangemTheme.dimens.size20), ) } } @@ -564,7 +562,7 @@ private fun TransactionCardPreview() { @Suppress("MagicNumber") private fun TransactionCardPreviewWithPriceImpact() { TransactionCard( - type = TransactionCardType.ReadOnly(), + type = TransactionCardType.ReadOnly(showWarning = true), amountEquivalent = "1 000 000", tokenIconUrl = "", tokenCurrency = "DAI", diff --git a/features/swap/presentation/src/main/java/com/tangem/feature/swap/viewmodels/SwapViewModel.kt b/features/swap/presentation/src/main/java/com/tangem/feature/swap/viewmodels/SwapViewModel.kt index 90e9ca9b8c..b297169695 100644 --- a/features/swap/presentation/src/main/java/com/tangem/feature/swap/viewmodels/SwapViewModel.kt +++ b/features/swap/presentation/src/main/java/com/tangem/feature/swap/viewmodels/SwapViewModel.kt @@ -503,7 +503,7 @@ internal class SwapViewModel @Inject constructor( ) }.onSuccess { when (it) { - is TxState.TxSent -> { + is SwapTransactionState.TxSent -> { sendSuccessSwapEvent(fromCurrency.currency, fee.feeType) val url = blockchainInteractor.getExplorerTransactionLink( networkId = fromCurrency.currency.network.backendId, @@ -512,7 +512,7 @@ internal class SwapViewModel @Inject constructor( updateWalletBalance() uiState = stateBuilder.createSuccessState( uiState = uiState, - txState = it, + swapTransactionState = it, dataState = dataState, txUrl = url, onExploreClick = { @@ -537,7 +537,7 @@ internal class SwapViewModel @Inject constructor( swapRouter.openScreen(SwapNavScreen.Success) } - is TxState.UserCancelled -> { + is SwapTransactionState.UserCancelled -> { startLoadingQuotesFromLastState() } else -> { @@ -604,14 +604,14 @@ internal class SwapViewModel @Inject constructor( ) }.onSuccess { when (it) { - is TxState.TxSent -> { + is SwapTransactionState.TxSent -> { sendApproveSuccessEvent(fromToken, feeForPermission.feeType, approveType) updateWalletBalance() uiState = stateBuilder.loadingPermissionState(uiState) uiState = stateBuilder.dismissBottomSheet(uiState) startLoadingQuotesFromLastState(isSilent = true) } - is TxState.UserCancelled -> Unit + is SwapTransactionState.UserCancelled -> Unit else -> { uiState = stateBuilder.createErrorTransaction(uiState, it) { uiState = stateBuilder.clearAlert(uiState) diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/ui/components/exchange/ExchangeProvider.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/ui/components/exchange/ExchangeProvider.kt index 41278b195c..173e79dc30 100644 --- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/ui/components/exchange/ExchangeProvider.kt +++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/ui/components/exchange/ExchangeProvider.kt @@ -19,7 +19,6 @@ import androidx.compose.ui.tooling.preview.Preview import com.tangem.core.ui.R import com.tangem.core.ui.components.inputrow.InputRowBestRate import com.tangem.core.ui.extensions.TextReference -import com.tangem.core.ui.extensions.wrappedList import com.tangem.core.ui.res.TangemTheme @Composable @@ -68,7 +67,7 @@ internal fun ExchangeProvider( ) Text( modifier = Modifier.align(Alignment.CenterVertically), - text = stringResource(R.string.express_transaction_id, wrappedList(providerTxId)), + text = stringResource(R.string.express_transaction_id, providerTxId), style = TangemTheme.typography.body2, color = TangemTheme.colors.text.tertiary, )