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