Updated on 2026-08-14
This commit is contained in:
parent
ab4f446b4d
commit
cfd9da0f4b
7 changed files with 31 additions and 21 deletions
|
|
@ -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]
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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> */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue