mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-16 14:07:28 +01:00
Use 1.x preference abstraction (#8020)
* Use 1.x preference abstraction - Uses SharedPreferences compared to 1.x impl which uses DataStore but it breaks all settings screens currently - Move PreferencesHelper to new PreferenceStore - PreferencesHelper should be split into smaller preference stores and be in core or domain - Remove flow preferences as new PreferenceStore handles changes for us Co-authored-by: inorichi <3521738+inorichi@users.noreply.github.com> * Fix PreferenceMutableState not updating * Fix changes not emitting on first subscription Co-authored-by: inorichi <3521738+inorichi@users.noreply.github.com>
This commit is contained in:
@@ -12,7 +12,7 @@ class GetExtensionLanguages(
|
||||
) {
|
||||
fun subscribe(): Flow<List<String>> {
|
||||
return combine(
|
||||
preferences.enabledLanguages().asFlow(),
|
||||
preferences.enabledLanguages().changes(),
|
||||
extensionManager.getAvailableExtensionsFlow(),
|
||||
) { enabledLanguage, availableExtensions ->
|
||||
availableExtensions
|
||||
|
||||
@@ -16,7 +16,7 @@ class GetExtensionSources(
|
||||
val isMultiLangSingleSource =
|
||||
isMultiSource && extension.sources.map { it.name }.distinct().size == 1
|
||||
|
||||
return preferences.disabledSources().asFlow().map { disabledSources ->
|
||||
return preferences.disabledSources().changes().map { disabledSources ->
|
||||
fun Source.isEnabled() = id.toString() !in disabledSources
|
||||
|
||||
extension.sources
|
||||
|
||||
@@ -16,7 +16,7 @@ class GetExtensionsByType(
|
||||
val showNsfwSources = preferences.showNsfwSource().get()
|
||||
|
||||
return combine(
|
||||
preferences.enabledLanguages().asFlow(),
|
||||
preferences.enabledLanguages().changes(),
|
||||
extensionManager.getInstalledExtensionsFlow(),
|
||||
extensionManager.getUntrustedExtensionsFlow(),
|
||||
extensionManager.getAvailableExtensionsFlow(),
|
||||
|
||||
Reference in New Issue
Block a user