Updated on 2026-08-14

This commit is contained in:
Tangem 2024-03-01 14:14:52 +08:00
parent 3f1102f232
commit 6af3bb18e4
7 changed files with 65 additions and 6 deletions

View file

@ -65,11 +65,11 @@ class AppPreferencesStore(
}
/** Get map with [String] key and value [V] by string [key] from [MutablePreferences] */
inline fun <reified V> MutablePreferences.getObjectMap(key: Preferences.Key<String>): Map<String, V>? {
inline fun <reified V> MutablePreferences.getObjectMap(key: Preferences.Key<String>): Map<String, V> {
val type = Types.newParameterizedType(Map::class.java, String::class.java, V::class.java)
val adapter = moshi.adapter<Map<String, V>>(type)
return this[key]?.let(adapter::fromJson)
return this[key]?.let(adapter::fromJson).orEmpty()
}
/**

View file

@ -61,6 +61,8 @@ object PreferencesKeys {
val IS_TANGEM_TOS_ACCEPTED_KEY by lazy { booleanPreferencesKey(name = "tangem_tos_accepted") }
val APP_LOGS_KEY by lazy { stringPreferencesKey(name = "app_logs") }
fun getStart2CoinTOSAcceptedKey(region: String?) = booleanPreferencesKey(name = "start2Coin_tos_accepted_$region")
}