Updated on 2026-08-14
This commit is contained in:
commit
69cfd56c13
3 changed files with 26 additions and 9 deletions
|
|
@ -26,10 +26,11 @@ class UserTokensRepository(
|
|||
private val networkService: UserTokensNetworkService,
|
||||
) {
|
||||
suspend fun getUserTokens(card: Card): List<Currency> {
|
||||
if (DemoHelper.isDemoCardId(card.cardId)) {
|
||||
return loadDemoCurrencies()
|
||||
}
|
||||
val userId = card.getUserId()
|
||||
if (DemoHelper.isDemoCardId(card.cardId)) {
|
||||
return loadTokensOffline(card, userId).ifEmpty { loadDemoCurrencies() }
|
||||
}
|
||||
|
||||
if (!NetworkConnectivity.getInstance().isOnlineOrConnecting()) {
|
||||
return loadTokensOffline(card, userId)
|
||||
}
|
||||
|
|
@ -68,9 +69,15 @@ class UserTokensRepository(
|
|||
}
|
||||
|
||||
suspend fun loadBlockchainsToDerive(card: Card): List<BlockchainNetwork> {
|
||||
return storageService.getUserTokens(card.getUserId())?.toBlockchainNetworks() ?: storageService.getUserTokens(
|
||||
card,
|
||||
).toBlockchainNetworks()
|
||||
val userId = card.getUserId()
|
||||
val blockchainNetworks = loadTokensOffline(card, userId).toBlockchainNetworks()
|
||||
|
||||
if (DemoHelper.isDemoCardId(card.cardId)) {
|
||||
return blockchainNetworks
|
||||
.ifEmpty { loadDemoCurrencies().toBlockchainNetworks() }
|
||||
}
|
||||
|
||||
return blockchainNetworks
|
||||
}
|
||||
|
||||
private fun loadDemoCurrencies(): List<Currency> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue