Updated on 2026-08-14
This commit is contained in:
parent
724af120da
commit
23ca8014da
3 changed files with 14 additions and 10 deletions
|
|
@ -102,15 +102,15 @@ internal class SwapInteractorImpl @Inject constructor(
|
|||
currency = currency,
|
||||
leastPairs = pairsLeast.pairs,
|
||||
cryptoCurrenciesList = walletCurrencyStatusesExceptInitial,
|
||||
tokenInfoForFilter = { it.from },
|
||||
tokenInfoForAvailable = { it.to },
|
||||
tokenInfoForFilter = { it.to },
|
||||
tokenInfoForAvailable = { it.from },
|
||||
),
|
||||
toGroup = getToCurrenciesGroup(
|
||||
currency = currency,
|
||||
leastPairs = pairsLeast.pairs,
|
||||
cryptoCurrenciesList = walletCurrencyStatusesExceptInitial,
|
||||
tokenInfoForFilter = { it.to },
|
||||
tokenInfoForAvailable = { it.from },
|
||||
tokenInfoForFilter = { it.from },
|
||||
tokenInfoForAvailable = { it.to },
|
||||
),
|
||||
allProviders = pairsLeast.allProviders,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -2,10 +2,7 @@ package com.tangem.feature.swap.converters
|
|||
|
||||
import com.tangem.common.Provider
|
||||
import com.tangem.core.ui.components.currency.tokenicon.TokenIconState
|
||||
import com.tangem.core.ui.extensions.getTintForTokenIcon
|
||||
import com.tangem.core.ui.extensions.networkIconResId
|
||||
import com.tangem.core.ui.extensions.stringReference
|
||||
import com.tangem.core.ui.extensions.tryGetBackgroundForTokenIcon
|
||||
import com.tangem.core.ui.extensions.*
|
||||
import com.tangem.core.ui.utils.BigDecimalFormatter
|
||||
import com.tangem.domain.appcurrency.model.AppCurrency
|
||||
import com.tangem.domain.tokens.model.CryptoCurrency
|
||||
|
|
@ -15,6 +12,7 @@ import com.tangem.feature.swap.domain.models.ui.CurrenciesGroup
|
|||
import com.tangem.feature.swap.models.SwapSelectTokenStateHolder
|
||||
import com.tangem.feature.swap.models.TokenBalanceData
|
||||
import com.tangem.feature.swap.models.TokenToSelectState
|
||||
import com.tangem.feature.swap.presentation.R
|
||||
import com.tangem.utils.converter.Converter
|
||||
import kotlinx.collections.immutable.toImmutableList
|
||||
|
||||
|
|
@ -26,8 +24,8 @@ class TokensDataConverter(
|
|||
) : Converter<CurrenciesGroup, SwapSelectTokenStateHolder> {
|
||||
|
||||
override fun convert(value: CurrenciesGroup): SwapSelectTokenStateHolder {
|
||||
val availableTitle = TokenToSelectState.Title(stringReference("My tokens")) // todo replace with resource
|
||||
val unavailableTitle = TokenToSelectState.Title(stringReference("My tokens")) // todo replace with resource
|
||||
val availableTitle = TokenToSelectState.Title(resourceReference(R.string.exchange_tokens_available_tokens_header))
|
||||
val unavailableTitle = TokenToSelectState.Title(resourceReference(R.string.exchange_tokens_available_tokens_header))
|
||||
return SwapSelectTokenStateHolder(
|
||||
availableTokens = value.available.map { tokenWithBalanceToTokenToSelect(it, true) }
|
||||
.toMutableList()
|
||||
|
|
|
|||
|
|
@ -653,12 +653,18 @@ internal class SwapViewModel @Inject constructor(
|
|||
private fun onChangeCardsClicked() {
|
||||
val newFromToken = dataState.toCryptoCurrency
|
||||
val newToToken = dataState.fromCryptoCurrency
|
||||
|
||||
|
||||
if (newFromToken != null && newToToken != null) {
|
||||
dataState = dataState.copy(
|
||||
fromCryptoCurrency = newFromToken,
|
||||
toCryptoCurrency = newToToken,
|
||||
)
|
||||
isOrderReversed = !isOrderReversed
|
||||
dataState.tokensDataState?.let {
|
||||
updateTokensState(it)
|
||||
}
|
||||
|
||||
val decimals = newFromToken.currency.decimals
|
||||
lastAmount.value = cutAmountWithDecimals(decimals, lastAmount.value)
|
||||
uiState = stateBuilder.updateSwapAmount(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue