Updated on 2026-08-14

This commit is contained in:
Tangem 2023-12-15 15:06:07 +03:00
parent ab4f446b4d
commit cfd9da0f4b
7 changed files with 31 additions and 21 deletions

View file

@ -32,6 +32,11 @@ class AppPreferencesStore(
return edit { transform(it) }
}
/** Get data [T] by [key]. If data is not found, it returns [default] */
inline fun <reified T> MutablePreferences.getOrDefault(key: Preferences.Key<T>, default: T): T {
return this[key] ?: default
}
/**
* Get nullable data [T] by string [key] from [MutablePreferences]
*

View file

@ -45,7 +45,7 @@ object PreferencesKeys {
val IS_WALLET_SWAP_PROMO_SHOW_KEY by lazy { booleanPreferencesKey(name = "isWalletSwapPromoShown") }
val IS_TOKEN_SWAP_PROMO_SHOW_KEY by lazy { booleanPreferencesKey(name = "isTokenSwapPromoShown") }
val IS_TOKEN_SWAP_PROMO_SHOW_KEY by lazy { stringSetPreferencesKey(name = "isTokenSwapPromoShown") }
}
/** Preferences keys set that should be migrated from "PreferencesDataSource" to a new DataStore<Preferences> */