Updated on 2026-08-14

This commit is contained in:
Tangem 2025-02-07 19:22:44 +04:00
parent 9ad06df95c
commit 01348109c2
6 changed files with 63 additions and 26 deletions

View file

@ -1,10 +1,15 @@
package com.tangem.domain.markets
import arrow.core.*
import arrow.core.None
import arrow.core.Option
import arrow.core.toOption
import com.tangem.domain.tokens.model.CryptoCurrency
import com.tangem.domain.tokens.model.Quote
import com.tangem.domain.tokens.repository.QuotesRepository
import kotlinx.coroutines.flow.*
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.flow.map
@Suppress("UnusedPrivateMember")
class GetCurrencyQuotesUseCase(
@ -18,7 +23,7 @@ class GetCurrencyQuotesUseCase(
): Flow<Option<Quote.Value>> {
val rawId = currencyID.rawCurrencyId ?: return flowOf(None)
return quotesRepository.getQuotesUpdates(
return quotesRepository.getQuotesUpdatesLegacy(
currenciesIds = setOf(rawId),
refresh = refresh,
).map { it.filterIsInstance<Quote.Value>().firstOrNull().toOption() }.catch { emit(None) }