Updated on 2026-08-14
This commit is contained in:
parent
d2e036e574
commit
ce006ff9b7
4 changed files with 25 additions and 12 deletions
|
|
@ -24,7 +24,9 @@ internal class DefaultQuotesStore(
|
|||
merge(*flows.toTypedArray())
|
||||
.scan<StoredQuote, Set<StoredQuote>>(emptySet()) { acc, quote ->
|
||||
acc.addOrReplace(quote) { it.rawCurrencyId == quote.rawCurrencyId }
|
||||
}.collect(::send)
|
||||
}
|
||||
.filter(Set<StoredQuote>::isNotEmpty)
|
||||
.collect(::send)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ internal object MockTokenLists {
|
|||
)
|
||||
|
||||
val noQuotesUngroupedTokenList = failedUngroupedTokenList.copy(
|
||||
totalFiatBalance = TokenList.FiatBalance.Loaded(amount = BigDecimal.ZERO, isAllAmountsSummarized = false),
|
||||
totalFiatBalance = TokenList.FiatBalance.Failed,
|
||||
currencies = MockTokensStates.noQuotesTokensStatuses,
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import com.tangem.domain.tokens.model.CryptoCurrency
|
|||
import com.tangem.domain.tokens.model.Network
|
||||
import com.tangem.domain.wallets.models.UserWalletId
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.emptyFlow
|
||||
import kotlinx.coroutines.flow.first
|
||||
import kotlinx.coroutines.flow.map
|
||||
|
||||
|
|
@ -78,6 +79,7 @@ internal class MockCurrenciesRepository(
|
|||
override suspend fun getMultiCurrencyWalletCurrency(
|
||||
userWalletId: UserWalletId,
|
||||
id: CryptoCurrency.ID,
|
||||
contractAddress: String?,
|
||||
derivationPath: Network.DerivationPath,
|
||||
): CryptoCurrency {
|
||||
val token = token.getOrElse { e -> throw e }
|
||||
|
|
@ -87,6 +89,11 @@ internal class MockCurrenciesRepository(
|
|||
return token
|
||||
}
|
||||
|
||||
override fun getMissedAddressesCryptoCurrencies(userWalletId: UserWalletId): Flow<List<CryptoCurrency>> {
|
||||
/* no-op */
|
||||
return emptyFlow()
|
||||
}
|
||||
|
||||
override suspend fun getNetworkCoin(
|
||||
userWalletId: UserWalletId,
|
||||
networkId: Network.ID,
|
||||
|
|
|
|||
|
|
@ -292,18 +292,22 @@ internal class TokenDetailsViewModel @Inject constructor(
|
|||
networkId = tokenCurrency.network.id,
|
||||
derivationPath = tokenCurrency.network.derivationPath,
|
||||
isSingleWalletWithTokens = wallet.scanResponse.cardTypesResolver.isSingleWalletWithToken(),
|
||||
).firstOrNull()
|
||||
)
|
||||
.conflate()
|
||||
.distinctUntilChanged()
|
||||
.firstOrNull()
|
||||
|
||||
maybeCoinStatus?.onRight { coinStatus ->
|
||||
reduxStateHolder.dispatch(
|
||||
action = TradeCryptoAction.New.SendToken(
|
||||
userWallet = wallet,
|
||||
tokenCurrency = tokenCurrency,
|
||||
tokenFiatRate = tokenFiatRate,
|
||||
coinFiatRate = coinStatus.value.fiatRate,
|
||||
reduxStateHolder.dispatch(
|
||||
action = TradeCryptoAction.New.SendToken(
|
||||
userWallet = wallet,
|
||||
tokenCurrency = tokenCurrency,
|
||||
tokenFiatRate = tokenFiatRate,
|
||||
coinFiatRate = maybeCoinStatus?.fold(
|
||||
ifLeft = { null },
|
||||
ifRight = { it.value.fiatRate },
|
||||
),
|
||||
)
|
||||
}
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue