From 49cce99b6657b072286fe1e36e21351b74f000c9 Mon Sep 17 00:00:00 2001 From: Tangem Date: Thu, 14 Dec 2023 20:28:25 +0300 Subject: [PATCH 1/3] Updated on 2026-08-14 --- .../com/tangem/feature/swap/viewmodels/SwapViewModel.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 b7606f80d0..b2c3060ae4 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 @@ -577,10 +577,12 @@ internal class SwapViewModel @Inject constructor( tokenDataState.toGroup } val available = group.available.filter { - it.currencyStatus.currency.name.contains(searchQuery, ignoreCase = true) + it.currencyStatus.currency.name.contains(searchQuery, ignoreCase = true) || + it.currencyStatus.currency.symbol.contains(searchQuery, ignoreCase = true) } val unavailable = group.unavailable.filter { - it.currencyStatus.currency.name.contains(searchQuery, ignoreCase = true) + it.currencyStatus.currency.name.contains(searchQuery, ignoreCase = true) || + it.currencyStatus.currency.symbol.contains(searchQuery, ignoreCase = true) } val filteredTokenDataState = if (isOrderReversed) { tokenDataState.copy( From 5b282452e7dc00ff223faeb9ad52778479c24b8b Mon Sep 17 00:00:00 2001 From: Tangem Date: Thu, 14 Dec 2023 20:52:42 +0300 Subject: [PATCH 2/3] Updated on 2026-08-14 --- .../NotificationWithBackground.kt | 32 ++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/notifications/NotificationWithBackground.kt b/core/ui/src/main/java/com/tangem/core/ui/components/notifications/NotificationWithBackground.kt index b377102b35..691cded7ba 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/notifications/NotificationWithBackground.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/notifications/NotificationWithBackground.kt @@ -22,10 +22,15 @@ import androidx.constraintlayout.compose.ConstraintLayout import androidx.constraintlayout.compose.Dimension import androidx.constraintlayout.compose.Visibility import com.tangem.core.ui.R -import com.tangem.core.ui.components.SecondaryButtonIconStart +import com.tangem.core.ui.components.buttons.common.TangemButton +import com.tangem.core.ui.components.buttons.common.TangemButtonColors +import com.tangem.core.ui.components.buttons.common.TangemButtonIconPosition import com.tangem.core.ui.extensions.resolveReference import com.tangem.core.ui.extensions.resourceReference import com.tangem.core.ui.extensions.stringReference +import com.tangem.core.ui.res.LocalIsInDarkTheme +import com.tangem.core.ui.res.TangemColorPalette.Dark6 +import com.tangem.core.ui.res.TangemColorPalette.Light4 import com.tangem.core.ui.res.TangemTheme /** @@ -113,10 +118,19 @@ fun NotificationWithBackground(config: NotificationConfig, modifier: Modifier = config.onCloseClick?.invoke() }, ) - SecondaryButtonIconStart( + val isDarkMode = LocalIsInDarkTheme.current + TangemButton( text = button?.text?.resolveReference().orEmpty(), - iconResId = button?.iconResId ?: R.drawable.ic_exchange_vertical_24, + icon = TangemButtonIconPosition.Start(button?.iconResId ?: R.drawable.ic_exchange_vertical_24), onClick = button?.onClick ?: {}, + colors = TangemButtonColors( + backgroundColor = if (isDarkMode) Light4 else TangemTheme.colors.button.secondary, + contentColor = Dark6, + disabledBackgroundColor = TangemTheme.colors.button.disabled, + disabledContentColor = TangemTheme.colors.text.disabled, + ), + enabled = true, + showProgress = false, modifier = Modifier.constrainAs(buttonRef) { start.linkTo(parent.start, spacing12) end.linkTo(parent.end, spacing12) @@ -135,7 +149,7 @@ fun NotificationWithBackground(config: NotificationConfig, modifier: Modifier = //region preview @Preview @Composable -private fun NotificationWithBackgroundPreview( +private fun NotificationWithBackgroundPreview_Light( @PreviewParameter(NotificationWithBackgroundPreviewProvider::class) config: NotificationConfig, ) { TangemTheme { @@ -143,6 +157,16 @@ private fun NotificationWithBackgroundPreview( } } +@Preview +@Composable +private fun NotificationWithBackgroundPreview_Dark( + @PreviewParameter(NotificationWithBackgroundPreviewProvider::class) config: NotificationConfig, +) { + TangemTheme(isDark = true) { + NotificationWithBackground(config = config) + } +} + private class NotificationWithBackgroundPreviewProvider : PreviewParameterProvider { override val values: Sequence get() = sequenceOf( From fb06b08e96015df968a52702f5a68df302af5ea1 Mon Sep 17 00:00:00 2001 From: Tangem Date: Fri, 15 Dec 2023 10:05:07 +0300 Subject: [PATCH 3/3] Updated on 2026-08-14 --- .../tokens/GetCryptoCurrencyActionsUseCase.kt | 21 +++++++------------ 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/GetCryptoCurrencyActionsUseCase.kt b/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/GetCryptoCurrencyActionsUseCase.kt index 61962b7ca5..2a0d6ad530 100644 --- a/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/GetCryptoCurrencyActionsUseCase.kt +++ b/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/GetCryptoCurrencyActionsUseCase.kt @@ -1,6 +1,5 @@ package com.tangem.domain.tokens -import com.tangem.domain.common.CardTypesResolver import com.tangem.domain.common.util.cardTypesResolver import com.tangem.domain.exchange.RampStateManager import com.tangem.domain.tokens.model.CryptoCurrency @@ -12,7 +11,6 @@ import com.tangem.domain.tokens.repository.MarketCryptoCurrencyRepository import com.tangem.domain.tokens.repository.NetworksRepository import com.tangem.domain.tokens.repository.QuotesRepository import com.tangem.domain.wallets.models.UserWallet -import com.tangem.domain.wallets.models.UserWalletId import com.tangem.utils.coroutines.CoroutineDispatcherProvider import com.tangem.utils.isNullOrZero import kotlinx.coroutines.ExperimentalCoroutinesApi @@ -53,10 +51,9 @@ class GetCryptoCurrencyActionsUseCase( val flow = networkFlow.mapLatest { maybeCoinStatus -> createTokenActionsState( - userWalletId = userWallet.walletId, + userWallet = userWallet, coinStatus = maybeCoinStatus.getOrNull(), cryptoCurrencyStatus = cryptoCurrencyStatus, - cardTypesResolver = userWallet.scanResponse.cardTypesResolver, ) } @@ -65,19 +62,17 @@ class GetCryptoCurrencyActionsUseCase( } private suspend fun createTokenActionsState( - userWalletId: UserWalletId, + userWallet: UserWallet, coinStatus: CryptoCurrencyStatus?, cryptoCurrencyStatus: CryptoCurrencyStatus, - cardTypesResolver: CardTypesResolver, ): TokenActionsState { return TokenActionsState( - walletId = userWalletId, + walletId = userWallet.walletId, cryptoCurrencyStatus = cryptoCurrencyStatus, states = createListOfActions( - userWalletId, + userWallet, coinStatus, cryptoCurrencyStatus, - cardTypesResolver, ), ) } @@ -87,10 +82,9 @@ class GetCryptoCurrencyActionsUseCase( * Actions priority: [Buy Send Receive Sell Swap] */ private suspend fun createListOfActions( - userWalletId: UserWalletId, + userWallet: UserWallet, coinStatus: CryptoCurrencyStatus?, cryptoCurrencyStatus: CryptoCurrencyStatus, - cardTypesResolver: CardTypesResolver, ): List { val cryptoCurrency = cryptoCurrencyStatus.currency if (cryptoCurrencyStatus.value is CryptoCurrencyStatus.MissedDerivation) { @@ -116,10 +110,9 @@ class GetCryptoCurrencyActionsUseCase( activeList.add(TokenActionsState.ActionState.Send(true)) } - val isMulticurrencyWallet = cardTypesResolver.isTangemWallet() || cardTypesResolver.isWallet2() // swap - if (isMulticurrencyWallet) { - if (marketCryptoCurrencyRepository.isExchangeable(userWalletId, cryptoCurrency)) { + if (userWallet.isMultiCurrency) { + if (marketCryptoCurrencyRepository.isExchangeable(userWallet.walletId, cryptoCurrency)) { activeList.add(TokenActionsState.ActionState.Swap(true)) } else { disabledList.add(TokenActionsState.ActionState.Swap(false))