Migrate the rest of the EH prefreches to Flow Prefrences
This commit is contained in:
parent
7d2ded5944
commit
5271abbd1f
2 changed files with 4 additions and 4 deletions
|
|
@ -33,8 +33,8 @@ fun <T> Preference<T>.asImmediateFlow(block: (value: T) -> Unit): Flow<T> {
|
||||||
@OptIn(ExperimentalCoroutinesApi::class)
|
@OptIn(ExperimentalCoroutinesApi::class)
|
||||||
class PreferencesHelper(val context: Context) {
|
class PreferencesHelper(val context: Context) {
|
||||||
|
|
||||||
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
|
private val prefs = PreferenceManager.getDefaultSharedPreferences(context)
|
||||||
val rxPrefs = RxSharedPreferences.create(prefs)
|
private val rxPrefs = RxSharedPreferences.create(prefs)
|
||||||
val flowPrefs = FlowSharedPreferences(prefs)
|
val flowPrefs = FlowSharedPreferences(prefs)
|
||||||
|
|
||||||
private val defaultDownloadsDir = Uri.fromFile(
|
private val defaultDownloadsDir = Uri.fromFile(
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,9 @@ enum class DebugToggles(val default: Boolean) {
|
||||||
val prefKey = "eh_debug_toggle_${name.toLowerCase()}"
|
val prefKey = "eh_debug_toggle_${name.toLowerCase()}"
|
||||||
|
|
||||||
var enabled: Boolean
|
var enabled: Boolean
|
||||||
get() = prefs.rxPrefs.getBoolean(prefKey, default).get()!!
|
get() = prefs.flowPrefs.getBoolean(prefKey, default).get()
|
||||||
set(value) {
|
set(value) {
|
||||||
prefs.rxPrefs.getBoolean(prefKey).set(value)
|
prefs.flowPrefs.getBoolean(prefKey).set(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue