Updated on 2026-08-14

This commit is contained in:
Tangem 2025-02-28 13:35:09 +04:00
parent e32d1a2b65
commit 592351f421
5 changed files with 77 additions and 21 deletions

View file

@ -35,8 +35,22 @@ internal class DefaultQuotesRepository(
private var quotesFetchedForAppCurrency: String? = null
private val mutex = Mutex()
@OptIn(ExperimentalCoroutinesApi::class)
override fun getQuotesUpdates(currenciesIds: Set<CryptoCurrency.RawID>): Flow<Set<Quote>> {
return quotesStore.get(currenciesIds)
return appPreferencesStore.getObject<CurrenciesResponse.Currency>(
key = PreferencesKeys.SELECTED_APP_CURRENCY_KEY,
)
.distinctUntilChanged()
.filterNotNull()
.flatMapLatest { appCurrency ->
fetchExpiredQuotes(
currenciesIds = currenciesIds,
appCurrencyId = appCurrency.id,
refresh = true,
)
quotesStore.get(currenciesIds)
}
.flowOn(dispatchers.io)
}