Updated on 2026-08-14

This commit is contained in:
Tangem 2020-03-31 18:02:43 +03:00
parent 1db2b73863
commit 9118130996
10 changed files with 97 additions and 18 deletions

View file

@ -3,6 +3,7 @@ package com.tangem.data.dp
import android.annotation.SuppressLint
import android.content.Context
import android.content.SharedPreferences
import androidx.preference.PreferenceManager
import com.orhanobut.hawk.Hawk
import com.tangem.Constant
import com.tangem.tangem_card.reader.CardCrypto
@ -10,6 +11,7 @@ import com.tangem.tangem_card.reader.CardCrypto
class PrefsManager {
companion object {
const val PREF_NAME = "tangem_access"
@SuppressLint("StaticFieldLeak")
private var instance: PrefsManager? = null
@ -41,6 +43,11 @@ class PrefsManager {
Hawk.delete(Constant.PREF_LAST_WALLET_ADDRESS)
}
fun getSettingsBoolean(key: Int, default: Boolean): Boolean {
return PreferenceManager.getDefaultSharedPreferences(context)
.getBoolean(context.getString(key), default)
}
fun appendCid(newCid: String) {
val prevCids: String = Hawk.get("CID_Key", "")
if (!prevCids.contains(newCid)) Hawk.put("CID_Key", "$prevCids$newCid, ")