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>
(cherry picked from commit 0086743a53)
# Conflicts:
# app/src/main/java/eu/kanade/domain/source/interactor/GetEnabledSources.kt
# app/src/main/java/eu/kanade/tachiyomi/App.kt
# app/src/main/java/eu/kanade/tachiyomi/AppModule.kt
# app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateNotifier.kt
# app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt
# app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt
# app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt
# app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt
# app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAdvancedController.kt
# core/src/main/java/eu/kanade/tachiyomi/network/NetworkHelper.kt
This commit is contained in:
@@ -14,6 +14,7 @@ import eu.kanade.tachiyomi.source.model.Page
|
||||
import eu.kanade.tachiyomi.source.model.SChapter
|
||||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
import exh.log.maybeInjectEHLogger
|
||||
import exh.pref.SourcePreferences
|
||||
import exh.source.DelegatedHttpSource
|
||||
import okhttp3.Headers
|
||||
import okhttp3.OkHttpClient
|
||||
@@ -409,7 +410,7 @@ abstract class HttpSource : CatalogueSource {
|
||||
|
||||
// EXH -->
|
||||
private var delegate: DelegatedHttpSource? = null
|
||||
get() = if (Injekt.get<NetworkHelper>().preferences.getBoolean("eh_delegate_sources", true)) { // todo
|
||||
get() = if (Injekt.get<SourcePreferences>().delegateSources().get()) {
|
||||
field
|
||||
} else {
|
||||
null
|
||||
|
||||
@@ -2,12 +2,12 @@ package exh.metadata.metadata
|
||||
|
||||
import android.content.Context
|
||||
import androidx.core.net.toUri
|
||||
import eu.kanade.tachiyomi.network.NetworkHelper
|
||||
import eu.kanade.tachiyomi.source.R
|
||||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
import eu.kanade.tachiyomi.source.model.copy
|
||||
import exh.metadata.MetadataUtil
|
||||
import exh.metadata.metadata.base.RaisedSearchMetadata
|
||||
import exh.pref.SourcePreferences
|
||||
import kotlinx.serialization.Serializable
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
@@ -53,7 +53,7 @@ class EHentaiSearchMetadata : RaisedSearchMetadata() {
|
||||
|
||||
// No title bug?
|
||||
val title = altTitle
|
||||
?.takeIf { Injekt.get<NetworkHelper>().preferences.getBoolean("use_jp_title", false) } // todo
|
||||
?.takeIf { Injekt.get<SourcePreferences>().useJapaneseTitle().get() } // todo
|
||||
?: title
|
||||
|
||||
// Set artist (if we can find one)
|
||||
|
||||
@@ -6,13 +6,15 @@ import eu.kanade.tachiyomi.source.model.Page
|
||||
import eu.kanade.tachiyomi.source.model.SChapter
|
||||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
import eu.kanade.tachiyomi.source.online.HttpSource
|
||||
import exh.pref.SourcePreferences
|
||||
import okhttp3.Response
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
|
||||
@Suppress("OverridingDeprecatedMember", "DEPRECATION")
|
||||
class EnhancedHttpSource(
|
||||
val originalSource: HttpSource,
|
||||
val enhancedSource: HttpSource,
|
||||
val delegateSources:() -> Boolean
|
||||
val enhancedSource: HttpSource
|
||||
) : HttpSource() {
|
||||
|
||||
/**
|
||||
@@ -247,7 +249,7 @@ class EnhancedHttpSource(
|
||||
override fun getFilterList() = source().getFilterList()
|
||||
|
||||
fun source(): HttpSource {
|
||||
return if (delegateSources()) {
|
||||
return if (Injekt.get<SourcePreferences>().delegateSources().get()) {
|
||||
enhancedSource
|
||||
} else {
|
||||
originalSource
|
||||
|
||||
Reference in New Issue
Block a user