Updated on 2026-08-14
This commit is contained in:
parent
fde7ec8688
commit
111dea42be
11 changed files with 97 additions and 44 deletions
|
|
@ -50,6 +50,7 @@ internal class DefaultNetworksRepository(
|
|||
networks: Set<Network>,
|
||||
): Flow<Set<NetworkStatus>> {
|
||||
return networksStatusesStore.get(userWalletId, networks)
|
||||
.distinctUntilChanged()
|
||||
.flowOn(dispatchers.io)
|
||||
}
|
||||
|
||||
|
|
@ -120,17 +121,7 @@ internal class DefaultNetworksRepository(
|
|||
refresh: Boolean,
|
||||
) = coroutineScope {
|
||||
if (refresh) {
|
||||
val statusesToRefresh = networksStatusesStore.getSyncOrNull(userWalletId)?.mapNotNull {
|
||||
if (it.network in networks) {
|
||||
it.copy(value = NetworkStatus.Refreshing)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
if (statusesToRefresh != null) {
|
||||
networksStatusesStore.storeAll(key = userWalletId, values = statusesToRefresh.toSet())
|
||||
}
|
||||
networksStatusesStore.refresh(key = userWalletId, networks = networks)
|
||||
}
|
||||
|
||||
val currencies = getCurrencies(userWalletId, networks)
|
||||
|
|
|
|||
|
|
@ -100,6 +100,10 @@ internal class DefaultQuotesRepository(
|
|||
// it changes after filterExpiredCurrenciesIds
|
||||
// calls with different coroutines and lead to fetchQuotes
|
||||
mutex.withLock {
|
||||
if (refresh) {
|
||||
quotesStore.refresh(currenciesIds)
|
||||
}
|
||||
|
||||
val expiredCurrenciesIds = filterExpiredCurrenciesIds(
|
||||
currenciesIds = currenciesIds,
|
||||
refresh = refresh || quotesFetchedForAppCurrency != appCurrencyId,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue