Updated on 2026-08-14

This commit is contained in:
Tangem 2022-03-24 19:31:05 +03:00
parent cceb194a7a
commit 709d56c34d
2 changed files with 7 additions and 13 deletions

View file

@ -26,10 +26,7 @@ import com.tangem.tap.network.NetworkConnectivity
import com.tangem.tap.network.coinmarketcap.CoinMarketCapService
import com.tangem.tap.scope
import com.tangem.tap.store
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import kotlinx.coroutines.*
import java.math.BigDecimal
@ -88,11 +85,6 @@ class TapWalletManager {
loadFiatRate(fiatCurrency, currencies)
}
suspend fun loadFiatRate(fiatCurrency: FiatCurrencyName, currency: Currency) {
val currencies = listOf(currency)
loadFiatRate(fiatCurrency, currencies)
}
suspend fun loadFiatRate(fiatCurrency: FiatCurrencyName, currencies: List<Currency>) {
val results = mutableListOf<Pair<Currency, Result<BigDecimal>?>>()
currencies.forEach {

View file

@ -88,18 +88,20 @@ class WalletMiddleware {
when {
action.wallet != null -> {
globalState.tapWalletManager.loadFiatRate(
globalState.appCurrency, action.wallet
fiatCurrency = globalState.appCurrency,
wallet = action.wallet,
)
}
action.currency != null -> {
action.currencyList != null -> {
globalState.tapWalletManager.loadFiatRate(
globalState.appCurrency, action.currency
fiatCurrency = globalState.appCurrency,
currencies = action.currencyList,
)
}
else -> {
globalState.tapWalletManager.loadFiatRate(
fiatCurrency = globalState.appCurrency,
currencies = walletState.wallets.map { it.currency }
currencies = walletState.wallets.map { it.currency },
)
}
}