Updated on 2026-08-14
This commit is contained in:
parent
e8d294efe1
commit
91b8f48839
2 changed files with 15 additions and 14 deletions
|
|
@ -8,7 +8,6 @@ import com.tangem.data.quotes.store.QuotesStatusesStore
|
|||
import com.tangem.data.quotes.store.setSourceAsCache
|
||||
import com.tangem.data.quotes.store.setSourceAsOnlyCache
|
||||
import com.tangem.data.quotes.utils.QuotesUnsupportedCurrenciesIdAdapter
|
||||
import com.tangem.datasource.api.tangemTech.models.QuotesResponse
|
||||
import com.tangem.datasource.appcurrency.AppCurrencyResponseStore
|
||||
import com.tangem.domain.core.utils.catchOn
|
||||
import com.tangem.domain.models.currency.CryptoCurrency
|
||||
|
|
@ -59,7 +58,6 @@ internal class DefaultMultiQuoteStatusFetcher @Inject constructor(
|
|||
fields = setOf(Field.PRICE, Field.PRICE_CHANGE_24H),
|
||||
)
|
||||
.getOrElse { error("Cause: $it") }
|
||||
.addSkippedIfHas(ids = replacementIdsResult.idsForRequest)
|
||||
|
||||
val updatedResponse = QuotesUnsupportedCurrenciesIdAdapter.getResponseWithUnsupportedCurrencies(
|
||||
response = response,
|
||||
|
|
@ -86,16 +84,4 @@ internal class DefaultMultiQuoteStatusFetcher @Inject constructor(
|
|||
|
||||
return appCurrencyId
|
||||
}
|
||||
|
||||
private fun QuotesResponse.addSkippedIfHas(ids: Set<String>): QuotesResponse {
|
||||
val skippedIds = ids.filterNot(quotes.keys::contains).ifEmpty {
|
||||
return this
|
||||
}
|
||||
|
||||
Timber.d("Some quotes are missing from the server response: $skippedIds")
|
||||
|
||||
val emptyQuotes = skippedIds.associateWith { QuotesResponse.Quote.EMPTY }
|
||||
|
||||
return copy(quotes = quotes + emptyQuotes)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue