Updated on 2026-08-14

This commit is contained in:
Tangem 2024-12-12 20:09:16 +05:00
parent b946eb5435
commit 029ba6e96c
5 changed files with 10 additions and 24 deletions

View file

@ -100,14 +100,16 @@ internal class DefaultOnrampRepository(
return countriesStore.getSyncOrNull(COUNTRIES_KEY)
}
override suspend fun fetchCountries() = withContext(dispatchers.io) {
if (!countriesStore.getSyncOrNull(COUNTRIES_KEY).isNullOrEmpty()) return@withContext
override suspend fun fetchCountries(): List<OnrampCountry> = withContext(dispatchers.io) {
if (!countriesStore.getSyncOrNull(COUNTRIES_KEY).isNullOrEmpty()) return@withContext emptyList()
val result = onrampApi.getCountries()
.getOrThrow()
.map(countryConverter::convert)
countriesStore.store(COUNTRIES_KEY, result)
result
}
override suspend fun getCountryByIp(): OnrampCountry = withContext(dispatchers.io) {