Updated on 2026-08-14

This commit is contained in:
Tangem 2024-08-15 15:06:34 +03:00
parent 831a9ad0e2
commit 11f32af295
5 changed files with 10 additions and 42 deletions

View file

@ -1,15 +1,7 @@
package com.tangem.data.visa.utils
import android.os.Build
import timber.log.Timber
import java.util.Currency
internal fun findCurrencyByNumericCode(code: Int): Currency {
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
Currency.getAvailableCurrencies().firstOrNull { it.numericCode == code }
?: Currency.getInstance(VisaConstants.fiatCurrency.code)
} else {
Timber.w("Unable to get currency by numeric code on API level ${Build.VERSION.SDK_INT}")
Currency.getInstance(VisaConstants.fiatCurrency.code)
}
}
internal fun findCurrencyByNumericCode(code: Int) =
Currency.getAvailableCurrencies().firstOrNull { it.numericCode == code }
?: Currency.getInstance(VisaConstants.fiatCurrency.code)