Merge pull request #1880 from esensar/enable-use-english-for-compose

Add helpers to `BaseConfig` to be able to use `useEnglish` in compose
This commit is contained in:
Tibor Kaputa 2023-10-09 13:48:16 +02:00 committed by GitHub
commit 9e60e24790
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -218,10 +218,14 @@ open class BaseConfig(val context: Context) {
prefs.edit().putBoolean(USE_ENGLISH, useEnglish).commit() prefs.edit().putBoolean(USE_ENGLISH, useEnglish).commit()
} }
val useEnglishFlow = ::useEnglish.asFlowNonNull()
var wasUseEnglishToggled: Boolean var wasUseEnglishToggled: Boolean
get() = prefs.getBoolean(WAS_USE_ENGLISH_TOGGLED, false) get() = prefs.getBoolean(WAS_USE_ENGLISH_TOGGLED, false)
set(wasUseEnglishToggled) = prefs.edit().putBoolean(WAS_USE_ENGLISH_TOGGLED, wasUseEnglishToggled).apply() set(wasUseEnglishToggled) = prefs.edit().putBoolean(WAS_USE_ENGLISH_TOGGLED, wasUseEnglishToggled).apply()
val wasUseEnglishToggledFlow = ::wasUseEnglishToggled.asFlowNonNull()
var wasSharedThemeEverActivated: Boolean var wasSharedThemeEverActivated: Boolean
get() = prefs.getBoolean(WAS_SHARED_THEME_EVER_ACTIVATED, false) get() = prefs.getBoolean(WAS_SHARED_THEME_EVER_ACTIVATED, false)
set(wasSharedThemeEverActivated) = prefs.edit().putBoolean(WAS_SHARED_THEME_EVER_ACTIVATED, wasSharedThemeEverActivated).apply() set(wasSharedThemeEverActivated) = prefs.edit().putBoolean(WAS_SHARED_THEME_EVER_ACTIVATED, wasSharedThemeEverActivated).apply()