Updated on 2026-08-14

This commit is contained in:
Tangem 2024-07-29 13:07:57 +03:00
commit b0d5ab72e1
50 changed files with 378 additions and 137 deletions

View file

@ -52,19 +52,23 @@ internal class CoinsPagingSource(
suffix = CryptoCurrency.ID.Suffix.RawID(coin.id),
)
}
val quotes = quotesRepository.getQuotesSync(currenciesIds = coinsIds.toSet(), refresh = false)
LoadResult.Page(
data = CoinsResponseConverter.convert(
CoinsData(
response.coins,
response.imageHost,
quotes,
try {
val quotes = quotesRepository.getQuotesSync(currenciesIds = coinsIds.toSet(), refresh = false)
LoadResult.Page(
data = CoinsResponseConverter.convert(
CoinsData(
response.coins,
response.imageHost,
quotes,
),
),
),
prevKey = if (page == 0) null else page.minus(other = 1),
nextKey = if (response.coins.isEmpty()) null else page.plus(other = 1),
)
prevKey = if (page == 0) null else page.minus(other = 1),
nextKey = if (response.coins.isEmpty()) null else page.plus(other = 1),
)
} catch (t: Throwable) {
LoadResult.Error(t)
}
},
onFailure = { LoadResult.Error(it) },
)