Updated on 2026-08-14
This commit is contained in:
parent
6dbd7bd861
commit
4773ed2485
9 changed files with 175 additions and 10 deletions
|
|
@ -55,6 +55,8 @@ object PreferencesKeys {
|
|||
|
||||
val FEATURE_TOGGLES_KEY by lazy { stringPreferencesKey(name = "featureToggles") }
|
||||
|
||||
val EXCLUDED_BLOCKCHAINS_KEY by lazy { stringPreferencesKey(name = "excludedBlockchains") }
|
||||
|
||||
val WAS_TWINS_ONBOARDING_SHOWN by lazy { booleanPreferencesKey(name = "twinsOnboardingShown") }
|
||||
|
||||
val IS_TANGEM_TOS_ACCEPTED_KEY by lazy { booleanPreferencesKey(name = "tangem_tos_accepted") }
|
||||
|
|
|
|||
|
|
@ -98,6 +98,12 @@ suspend inline fun <reified T> AppPreferencesStore.storeObjectList(key: Preferen
|
|||
edit { it[key] = adapter.toJson(value) }
|
||||
}
|
||||
|
||||
/** Store set of data [value] by string [key] */
|
||||
suspend inline fun <reified T> AppPreferencesStore.storeObjectSet(key: Preferences.Key<String>, value: Set<T>) {
|
||||
val adapter = moshi.adapter<Set<T>>(Types.newParameterizedType(Set::class.java, T::class.java))
|
||||
edit { it[key] = adapter.toJson(value) }
|
||||
}
|
||||
|
||||
/** Get flow of list of data [T] by string [key]. If data is not found, it returns `null` */
|
||||
inline fun <reified T> AppPreferencesStore.getObjectList(key: Preferences.Key<String>): Flow<List<T>?> {
|
||||
val adapter = moshi.adapter<List<T>>(Types.newParameterizedType(List::class.java, T::class.java))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue