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,9 +1,6 @@
package com.tangem.datasource.local.preferences.utils
import android.content.Context
import android.os.Build
import androidx.annotation.DoNotInline
import androidx.annotation.RequiresApi
import androidx.datastore.core.DataMigration
import androidx.datastore.preferences.core.*
import java.io.File
@ -72,27 +69,11 @@ internal class SharedPreferencesKeyMigration(
}
private fun deleteSharedPreferences(context: Context, name: String) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
if (!Api24Impl.deleteSharedPreferences(context, name)) {
throw IOException("Unable to delete SharedPreferences: $name")
}
} else {
val prefsFile = getSharedPrefsFile(context, name)
val prefsBackup = getSharedPrefsBackup(prefsFile)
val prefsFile = getSharedPrefsFile(context, name)
val prefsBackup = getSharedPrefsBackup(prefsFile)
prefsFile.delete()
prefsBackup.delete()
}
}
@RequiresApi(Build.VERSION_CODES.N)
private object Api24Impl {
@JvmStatic
@DoNotInline
fun deleteSharedPreferences(context: Context, name: String): Boolean {
return context.deleteSharedPreferences(name)
}
prefsFile.delete()
prefsBackup.delete()
}
private fun getSharedPrefsFile(context: Context, name: String): File {

View file

@ -1,7 +1,6 @@
package com.tangem.core.ui.utils
import android.icu.text.CompactDecimalFormat
import android.os.Build
import com.tangem.domain.tokens.model.CryptoCurrency
import com.tangem.utils.StringsSigns.DASH_SIGN
import com.tangem.utils.StringsSigns.LOWER_SIGN
@ -366,10 +365,6 @@ object BigDecimalFormatter {
threeDigitsMethod: Boolean = false,
scale: Int = 0,
): String {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
return BigDecimalFormatterCompat.formatCompactAmountNoLocaleContext(amount = amount)
}
if (threeDigitsMethod) {
val scaledAmount = amount.setScale(scale, RoundingMode.HALF_UP)
val digitsCount = scaledAmount.longValueExact().toString().count()

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)

View file

@ -88,9 +88,9 @@ markdown = "0.7.2"
# endregion Other libraries
# region Tangem
tangemBlockchainSdk = "develop-734"
tangemBlockchainSdk = "develop-736"
#tangemBlockchainSdk = "0.0.1" # Keep it! - used for local builds
tangemCardSdk = "develop-375"
tangemCardSdk = "develop-378"
#tangemCardSdk = "0.0.1" # Keep it! - used for local builds ^
tangemVico = "2.0.0-alpha.25-tangem16"
#tangemVico = "0.0.1" # Keep it! - used for local builds ^

View file

@ -4,7 +4,7 @@ internal object AppConfig {
const val packageName = "com.tangem.wallet"
const val versionCode = 1
const val versionName = "1.0.0-SNAPSHOT"
const val minSdkVersion = 23
const val minSdkVersion = 24
const val targetSdkVersion = 34
const val compileSdkVersion = 34
}