From 4229114bb63dd339d93902dc22ebd8a96770348d Mon Sep 17 00:00:00 2001 From: Tangem Date: Wed, 20 Sep 2023 11:15:22 +0500 Subject: [PATCH] Updated on 2026-08-14 --- .../state/components/TokenDetailsNotification.kt | 10 +++++----- .../factory/TokenDetailsLoadedBalanceConverter.kt | 2 +- .../factory/TokenDetailsNotificationConverter.kt | 12 ++++++------ .../tokendetails/viewmodels/TokenDetailsViewModel.kt | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/components/TokenDetailsNotification.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/components/TokenDetailsNotification.kt index ea35a155a6..2bf2422fef 100644 --- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/components/TokenDetailsNotification.kt +++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/components/TokenDetailsNotification.kt @@ -12,7 +12,7 @@ import com.tangem.features.tokendetails.impl.R @Immutable sealed class TokenDetailsNotification(open val config: NotificationConfig) { - data class RentInfoNotification( + data class RentInfo( private val rentInfo: CryptoCurrencyWarning.Rent, private val onCloseClick: () -> Unit, ) : TokenDetailsNotification( @@ -27,7 +27,7 @@ sealed class TokenDetailsNotification(open val config: NotificationConfig) { ), ) - data class ExistentialDepositNotification( + data class ExistentialDeposit( private val existentialInfo: CryptoCurrencyWarning.ExistentialDeposit, private val onCloseClick: () -> Unit, ) : TokenDetailsNotification( @@ -42,7 +42,7 @@ sealed class TokenDetailsNotification(open val config: NotificationConfig) { ), ) - data class NetworkFeeFeeNotification( + data class NetworkFeeFee( private val feeInfo: CryptoCurrencyWarning.BalanceNotEnoughForFee, private val onBuyClick: () -> Unit, ) : TokenDetailsNotification( @@ -63,13 +63,13 @@ sealed class TokenDetailsNotification(open val config: NotificationConfig) { ), iconResId = feeInfo.currency.networkIconResId, buttonsState = NotificationConfig.ButtonsState.SecondaryButtonConfig( - text = TextReference.Str("Buy"), + text = TextReference.Res(R.string.common_buy), onClick = onBuyClick, ), ), ) - object NetworksUnreachableNotification : TokenDetailsNotification( + object NetworksUnreachable : TokenDetailsNotification( config = NotificationConfig( title = TextReference.Str("Some networks are unreachable"), subtitle = TextReference.Str("The problem is on the crypto-network side. It will be fixed soon."), diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsLoadedBalanceConverter.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsLoadedBalanceConverter.kt index d881dbe36a..44401e8414 100644 --- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsLoadedBalanceConverter.kt +++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsLoadedBalanceConverter.kt @@ -38,7 +38,7 @@ internal class TokenDetailsLoadedBalanceConverter( return state.copy( tokenBalanceBlockState = TokenDetailsBalanceBlockState.Error(state.tokenBalanceBlockState.actionButtons), marketPriceBlockState = MarketPriceBlockState.Error(state.marketPriceBlockState.currencyName), - notifications = persistentListOf(TokenDetailsNotification.NetworksUnreachableNotification), + notifications = persistentListOf(TokenDetailsNotification.NetworksUnreachable), ) } diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsNotificationConverter.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsNotificationConverter.kt index 9656012880..7cef79f416 100644 --- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsNotificationConverter.kt +++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsNotificationConverter.kt @@ -19,31 +19,31 @@ internal class TokenDetailsNotificationConverter( fun removeExistentialDeposit(currentState: TokenDetailsState): ImmutableList { val newNotifications = currentState.notifications.toMutableList() - newNotifications.removeBy { it is TokenDetailsNotification.ExistentialDepositNotification } + newNotifications.removeBy { it is TokenDetailsNotification.ExistentialDeposit } return newNotifications.toImmutableList() } fun removeRentInfo(currentState: TokenDetailsState): ImmutableList { val newNotifications = currentState.notifications.toMutableList() - newNotifications.removeBy { it is TokenDetailsNotification.RentInfoNotification } + newNotifications.removeBy { it is TokenDetailsNotification.RentInfo } return newNotifications.toImmutableList() } private fun mapToNotification(warning: CryptoCurrencyWarning): TokenDetailsNotification { return when (warning) { - is CryptoCurrencyWarning.BalanceNotEnoughForFee -> TokenDetailsNotification.NetworkFeeFeeNotification( + is CryptoCurrencyWarning.BalanceNotEnoughForFee -> TokenDetailsNotification.NetworkFeeFee( feeInfo = warning, onBuyClick = clickIntents::onBuyClick, ) - is CryptoCurrencyWarning.ExistentialDeposit -> TokenDetailsNotification.ExistentialDepositNotification( + is CryptoCurrencyWarning.ExistentialDeposit -> TokenDetailsNotification.ExistentialDeposit( existentialInfo = warning, onCloseClick = clickIntents::onCloseExistentialDepositNotification, ) - is CryptoCurrencyWarning.Rent -> TokenDetailsNotification.RentInfoNotification( + is CryptoCurrencyWarning.Rent -> TokenDetailsNotification.RentInfo( rentInfo = warning, onCloseClick = clickIntents::onCloseRentInfoNotification, ) - CryptoCurrencyWarning.SomeNetworksUnreachable -> TokenDetailsNotification.NetworksUnreachableNotification + CryptoCurrencyWarning.SomeNetworksUnreachable -> TokenDetailsNotification.NetworksUnreachable } } } \ No newline at end of file diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/viewmodels/TokenDetailsViewModel.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/viewmodels/TokenDetailsViewModel.kt index 9ef4aaafa0..36cfad8630 100644 --- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/viewmodels/TokenDetailsViewModel.kt +++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/viewmodels/TokenDetailsViewModel.kt @@ -129,7 +129,7 @@ internal class TokenDetailsViewModel @Inject constructor( } private fun updateWarnings(selectedWallet: UserWallet) { - viewModelScope.launch { + viewModelScope.launch(dispatchers.io) { getCurrencyWarningsUseCase.invoke( userWalletId = selectedWallet.walletId, currency = cryptoCurrency,