Split source preferences from PreferencesHelper (#8029)

This commit is contained in:
Andreas 2022-09-18 16:36:41 +02:00 committed by GitHub
parent f3cecd3cde
commit 30b3b2d3ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
28 changed files with 111 additions and 93 deletions

View File

@ -1,13 +1,13 @@
package eu.kanade.domain.extension.interactor package eu.kanade.domain.extension.interactor
import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.domain.source.service.SourcePreferences
import eu.kanade.tachiyomi.extension.ExtensionManager import eu.kanade.tachiyomi.extension.ExtensionManager
import eu.kanade.tachiyomi.util.system.LocaleHelper import eu.kanade.tachiyomi.util.system.LocaleHelper
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.combine
class GetExtensionLanguages( class GetExtensionLanguages(
private val preferences: PreferencesHelper, private val preferences: SourcePreferences,
private val extensionManager: ExtensionManager, private val extensionManager: ExtensionManager,
) { ) {
fun subscribe(): Flow<List<String>> { fun subscribe(): Flow<List<String>> {

View File

@ -1,6 +1,6 @@
package eu.kanade.domain.extension.interactor package eu.kanade.domain.extension.interactor
import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.domain.source.service.SourcePreferences
import eu.kanade.tachiyomi.extension.model.Extension import eu.kanade.tachiyomi.extension.model.Extension
import eu.kanade.tachiyomi.source.Source import eu.kanade.tachiyomi.source.Source
import eu.kanade.tachiyomi.ui.browse.extension.details.ExtensionSourceItem import eu.kanade.tachiyomi.ui.browse.extension.details.ExtensionSourceItem
@ -8,7 +8,7 @@ import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.map
class GetExtensionSources( class GetExtensionSources(
private val preferences: PreferencesHelper, private val preferences: SourcePreferences,
) { ) {
fun subscribe(extension: Extension.Installed): Flow<List<ExtensionSourceItem>> { fun subscribe(extension: Extension.Installed): Flow<List<ExtensionSourceItem>> {

View File

@ -1,14 +1,14 @@
package eu.kanade.domain.extension.interactor package eu.kanade.domain.extension.interactor
import eu.kanade.domain.extension.model.Extensions import eu.kanade.domain.extension.model.Extensions
import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.domain.source.service.SourcePreferences
import eu.kanade.tachiyomi.extension.ExtensionManager import eu.kanade.tachiyomi.extension.ExtensionManager
import eu.kanade.tachiyomi.extension.model.Extension import eu.kanade.tachiyomi.extension.model.Extension
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.combine
class GetExtensionsByType( class GetExtensionsByType(
private val preferences: PreferencesHelper, private val preferences: SourcePreferences,
private val extensionManager: ExtensionManager, private val extensionManager: ExtensionManager,
) { ) {

View File

@ -4,7 +4,7 @@ import eu.kanade.domain.source.model.Pin
import eu.kanade.domain.source.model.Pins import eu.kanade.domain.source.model.Pins
import eu.kanade.domain.source.model.Source import eu.kanade.domain.source.model.Source
import eu.kanade.domain.source.repository.SourceRepository import eu.kanade.domain.source.repository.SourceRepository
import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.domain.source.service.SourcePreferences
import eu.kanade.tachiyomi.source.LocalSource import eu.kanade.tachiyomi.source.LocalSource
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.combine
@ -12,7 +12,7 @@ import kotlinx.coroutines.flow.distinctUntilChanged
class GetEnabledSources( class GetEnabledSources(
private val repository: SourceRepository, private val repository: SourceRepository,
private val preferences: PreferencesHelper, private val preferences: SourcePreferences,
) { ) {
fun subscribe(): Flow<List<Source>> { fun subscribe(): Flow<List<Source>> {

View File

@ -2,14 +2,14 @@ package eu.kanade.domain.source.interactor
import eu.kanade.domain.source.model.Source import eu.kanade.domain.source.model.Source
import eu.kanade.domain.source.repository.SourceRepository import eu.kanade.domain.source.repository.SourceRepository
import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.domain.source.service.SourcePreferences
import eu.kanade.tachiyomi.util.system.LocaleHelper import eu.kanade.tachiyomi.util.system.LocaleHelper
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.combine
class GetLanguagesWithSources( class GetLanguagesWithSources(
private val repository: SourceRepository, private val repository: SourceRepository,
private val preferences: PreferencesHelper, private val preferences: SourcePreferences,
) { ) {
fun subscribe(): Flow<Map<String, List<Source>>> { fun subscribe(): Flow<Map<String, List<Source>>> {

View File

@ -2,7 +2,7 @@ package eu.kanade.domain.source.interactor
import eu.kanade.domain.source.model.Source import eu.kanade.domain.source.model.Source
import eu.kanade.domain.source.repository.SourceRepository import eu.kanade.domain.source.repository.SourceRepository
import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.domain.source.service.SourcePreferences
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.combine
import java.text.Collator import java.text.Collator
@ -11,7 +11,7 @@ import java.util.Locale
class GetSourcesWithFavoriteCount( class GetSourcesWithFavoriteCount(
private val repository: SourceRepository, private val repository: SourceRepository,
private val preferences: PreferencesHelper, private val preferences: SourcePreferences,
) { ) {
fun subscribe(): Flow<List<Pair<Source, Long>>> { fun subscribe(): Flow<List<Pair<Source, Long>>> {

View File

@ -1,9 +1,9 @@
package eu.kanade.domain.source.interactor package eu.kanade.domain.source.interactor
import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.domain.source.service.SourcePreferences
class SetMigrateSorting( class SetMigrateSorting(
private val preferences: PreferencesHelper, private val preferences: SourcePreferences,
) { ) {
fun await(mode: Mode, direction: Direction) { fun await(mode: Mode, direction: Direction) {
@ -14,12 +14,10 @@ class SetMigrateSorting(
enum class Mode { enum class Mode {
ALPHABETICAL, ALPHABETICAL,
TOTAL, TOTAL,
;
} }
enum class Direction { enum class Direction {
ASCENDING, ASCENDING,
DESCENDING, DESCENDING,
;
} }
} }

View File

@ -1,12 +1,10 @@
package eu.kanade.domain.source.interactor package eu.kanade.domain.source.interactor
import eu.kanade.domain.source.service.SourcePreferences
import eu.kanade.tachiyomi.core.preference.getAndSet import eu.kanade.tachiyomi.core.preference.getAndSet
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.util.preference.minusAssign
import eu.kanade.tachiyomi.util.preference.plusAssign
class ToggleLanguage( class ToggleLanguage(
val preferences: PreferencesHelper, val preferences: SourcePreferences,
) { ) {
fun await(language: String) { fun await(language: String) {

View File

@ -1,22 +1,24 @@
package eu.kanade.domain.source.interactor package eu.kanade.domain.source.interactor
import eu.kanade.domain.source.model.Source import eu.kanade.domain.source.model.Source
import eu.kanade.domain.source.service.SourcePreferences
import eu.kanade.tachiyomi.core.preference.getAndSet import eu.kanade.tachiyomi.core.preference.getAndSet
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.util.preference.minusAssign
import eu.kanade.tachiyomi.util.preference.plusAssign
class ToggleSource( class ToggleSource(
private val preferences: PreferencesHelper, private val preferences: SourcePreferences,
) { ) {
fun await(source: Source, enable: Boolean = source.id.toString() in preferences.disabledSources().get()) { fun await(source: Source, enable: Boolean = isEnabled(source.id)) {
await(source.id, enable) await(source.id, enable)
} }
fun await(sourceId: Long, enable: Boolean = sourceId.toString() in preferences.disabledSources().get()) { fun await(sourceId: Long, enable: Boolean = isEnabled(sourceId)) {
preferences.disabledSources().getAndSet { disabled -> preferences.disabledSources().getAndSet { disabled ->
if (enable) disabled.minus("$sourceId") else disabled.plus("$sourceId") if (enable) disabled.minus("$sourceId") else disabled.plus("$sourceId")
} }
} }
private fun isEnabled(sourceId: Long): Boolean {
return sourceId.toString() in preferences.disabledSources().get()
}
} }

View File

@ -1,13 +1,11 @@
package eu.kanade.domain.source.interactor package eu.kanade.domain.source.interactor
import eu.kanade.domain.source.model.Source import eu.kanade.domain.source.model.Source
import eu.kanade.domain.source.service.SourcePreferences
import eu.kanade.tachiyomi.core.preference.getAndSet import eu.kanade.tachiyomi.core.preference.getAndSet
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.util.preference.minusAssign
import eu.kanade.tachiyomi.util.preference.plusAssign
class ToggleSourcePin( class ToggleSourcePin(
private val preferences: PreferencesHelper, private val preferences: SourcePreferences,
) { ) {
fun await(source: Source) { fun await(source: Source) {

View File

@ -0,0 +1,33 @@
package eu.kanade.domain.source.service
import eu.kanade.domain.source.interactor.SetMigrateSorting
import eu.kanade.tachiyomi.core.preference.PreferenceStore
import eu.kanade.tachiyomi.core.preference.getEnum
import eu.kanade.tachiyomi.util.system.LocaleHelper
class SourcePreferences(
private val preferenceStore: PreferenceStore,
) {
fun enabledLanguages() = this.preferenceStore.getStringSet("source_languages", LocaleHelper.getDefaultEnabledLanguages())
fun disabledSources() = this.preferenceStore.getStringSet("hidden_catalogues", emptySet())
fun pinnedSources() = this.preferenceStore.getStringSet("pinned_catalogues", emptySet())
fun duplicatePinnedSources() = this.preferenceStore.getBoolean("duplicate_pinned_sources", false)
fun lastUsedSource() = this.preferenceStore.getLong("last_catalogue_source", -1)
fun showNsfwSource() = this.preferenceStore.getBoolean("show_nsfw_source", true)
fun migrationSortingMode() = this.preferenceStore.getEnum("pref_migration_sorting", SetMigrateSorting.Mode.ALPHABETICAL)
fun migrationSortingDirection() = this.preferenceStore.getEnum("pref_migration_direction", SetMigrateSorting.Direction.ASCENDING)
fun extensionUpdatesCount() = this.preferenceStore.getInt("ext_updates_count", 0)
fun trustedSignatures() = this.preferenceStore.getStringSet("trusted_signatures", emptySet())
fun searchPinnedSourcesOnly() = this.preferenceStore.getBoolean("search_pinned_sources_only", false)
}

View File

@ -13,6 +13,7 @@ import eu.kanade.data.AndroidDatabaseHandler
import eu.kanade.data.DatabaseHandler import eu.kanade.data.DatabaseHandler
import eu.kanade.data.dateAdapter import eu.kanade.data.dateAdapter
import eu.kanade.data.listOfStringsAdapter import eu.kanade.data.listOfStringsAdapter
import eu.kanade.domain.source.service.SourcePreferences
import eu.kanade.tachiyomi.core.preference.AndroidPreferenceStore import eu.kanade.tachiyomi.core.preference.AndroidPreferenceStore
import eu.kanade.tachiyomi.core.preference.PreferenceStore import eu.kanade.tachiyomi.core.preference.PreferenceStore
import eu.kanade.tachiyomi.data.cache.ChapterCache import eu.kanade.tachiyomi.data.cache.ChapterCache
@ -130,6 +131,9 @@ class PreferenceModule(val application: Application) : InjektModule {
verboseLogging = isDevFlavor, verboseLogging = isDevFlavor,
) )
} }
addSingletonFactory {
SourcePreferences(get())
}
addSingletonFactory { addSingletonFactory {
PreferencesHelper( PreferencesHelper(
context = application, context = application,

View File

@ -4,6 +4,7 @@ import android.content.Context
import android.os.Build import android.os.Build
import androidx.core.content.edit import androidx.core.content.edit
import androidx.preference.PreferenceManager import androidx.preference.PreferenceManager
import eu.kanade.domain.source.service.SourcePreferences
import eu.kanade.tachiyomi.data.backup.BackupCreatorJob import eu.kanade.tachiyomi.data.backup.BackupCreatorJob
import eu.kanade.tachiyomi.data.library.LibraryUpdateJob import eu.kanade.tachiyomi.data.library.LibraryUpdateJob
import eu.kanade.tachiyomi.data.preference.MANGA_NON_COMPLETED import eu.kanade.tachiyomi.data.preference.MANGA_NON_COMPLETED
@ -37,6 +38,7 @@ object Migrations {
context: Context, context: Context,
preferences: PreferencesHelper, preferences: PreferencesHelper,
networkPreferences: NetworkPreferences, networkPreferences: NetworkPreferences,
sourcePreferences: SourcePreferences,
): Boolean { ): Boolean {
val oldVersion = preferences.lastVersionCode().get() val oldVersion = preferences.lastVersionCode().get()
if (oldVersion < BuildConfig.VERSION_CODE) { if (oldVersion < BuildConfig.VERSION_CODE) {
@ -231,8 +233,8 @@ object Migrations {
} }
} }
if (oldVersion < 70) { if (oldVersion < 70) {
if (preferences.enabledLanguages().isSet()) { if (sourcePreferences.enabledLanguages().isSet()) {
preferences.enabledLanguages() += "all" sourcePreferences.enabledLanguages() += "all"
} }
} }
if (oldVersion < 71) { if (oldVersion < 71) {

View File

@ -37,9 +37,6 @@ object PreferenceKeys {
const val librarySortingMode = "library_sorting_mode" const val librarySortingMode = "library_sorting_mode"
const val migrationSortingMode = "pref_migration_sorting"
const val migrationSortingDirection = "pref_migration_direction"
const val hideNotificationContent = "hide_notification_content" const val hideNotificationContent = "hide_notification_content"
const val autoUpdateMetadata = "auto_update_metadata" const val autoUpdateMetadata = "auto_update_metadata"
@ -54,8 +51,6 @@ object PreferenceKeys {
const val skipFiltered = "skip_filtered" const val skipFiltered = "skip_filtered"
const val searchPinnedSourcesOnly = "search_pinned_sources_only"
const val defaultChapterFilterByRead = "default_chapter_filter_by_read" const val defaultChapterFilterByRead = "default_chapter_filter_by_read"
const val defaultChapterFilterByDownloaded = "default_chapter_filter_by_downloaded" const val defaultChapterFilterByDownloaded = "default_chapter_filter_by_downloaded"

View File

@ -4,7 +4,6 @@ import android.content.Context
import android.os.Build import android.os.Build
import android.os.Environment import android.os.Environment
import androidx.core.net.toUri import androidx.core.net.toUri
import eu.kanade.domain.source.interactor.SetMigrateSorting
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.core.preference.PreferenceStore import eu.kanade.tachiyomi.core.preference.PreferenceStore
import eu.kanade.tachiyomi.core.preference.getEnum import eu.kanade.tachiyomi.core.preference.getEnum
@ -16,7 +15,6 @@ import eu.kanade.tachiyomi.ui.library.setting.LibrarySort
import eu.kanade.tachiyomi.ui.reader.setting.OrientationType import eu.kanade.tachiyomi.ui.reader.setting.OrientationType
import eu.kanade.tachiyomi.ui.reader.setting.ReadingModeType import eu.kanade.tachiyomi.ui.reader.setting.ReadingModeType
import eu.kanade.tachiyomi.util.system.DeviceUtil import eu.kanade.tachiyomi.util.system.DeviceUtil
import eu.kanade.tachiyomi.util.system.LocaleHelper
import eu.kanade.tachiyomi.util.system.isDynamicColorAvailable import eu.kanade.tachiyomi.util.system.isDynamicColorAvailable
import eu.kanade.tachiyomi.widget.ExtendedNavigationView import eu.kanade.tachiyomi.widget.ExtendedNavigationView
import java.io.File import java.io.File
@ -166,16 +164,12 @@ class PreferencesHelper(
fun autoUpdateTrack() = this.preferenceStore.getBoolean(Keys.autoUpdateTrack, true) fun autoUpdateTrack() = this.preferenceStore.getBoolean(Keys.autoUpdateTrack, true)
fun lastUsedSource() = this.preferenceStore.getLong("last_catalogue_source", -1)
fun lastUsedCategory() = this.preferenceStore.getInt("last_used_category", 0) fun lastUsedCategory() = this.preferenceStore.getInt("last_used_category", 0)
fun lastVersionCode() = this.preferenceStore.getInt("last_version_code", 0) fun lastVersionCode() = this.preferenceStore.getInt("last_version_code", 0)
fun sourceDisplayMode() = this.preferenceStore.getObject("pref_display_mode_catalogue", LibraryDisplayMode.default, LibraryDisplayMode.Serializer::serialize, LibraryDisplayMode.Serializer::deserialize) fun sourceDisplayMode() = this.preferenceStore.getObject("pref_display_mode_catalogue", LibraryDisplayMode.default, LibraryDisplayMode.Serializer::serialize, LibraryDisplayMode.Serializer::deserialize)
fun enabledLanguages() = this.preferenceStore.getStringSet("source_languages", LocaleHelper.getDefaultEnabledLanguages())
fun trackUsername(sync: TrackService) = this.preferenceStore.getString(Keys.trackUsername(sync.id), "") fun trackUsername(sync: TrackService) = this.preferenceStore.getString(Keys.trackUsername(sync.id), "")
fun trackPassword(sync: TrackService) = this.preferenceStore.getString(Keys.trackPassword(sync.id), "") fun trackPassword(sync: TrackService) = this.preferenceStore.getString(Keys.trackPassword(sync.id), "")
@ -260,24 +254,11 @@ class PreferencesHelper(
fun librarySortingMode() = this.preferenceStore.getObject(Keys.librarySortingMode, LibrarySort.default, LibrarySort.Serializer::serialize, LibrarySort.Serializer::deserialize) fun librarySortingMode() = this.preferenceStore.getObject(Keys.librarySortingMode, LibrarySort.default, LibrarySort.Serializer::serialize, LibrarySort.Serializer::deserialize)
fun migrationSortingMode() = this.preferenceStore.getEnum(Keys.migrationSortingMode, SetMigrateSorting.Mode.ALPHABETICAL)
fun migrationSortingDirection() = this.preferenceStore.getEnum(Keys.migrationSortingDirection, SetMigrateSorting.Direction.ASCENDING)
fun automaticExtUpdates() = this.preferenceStore.getBoolean("automatic_ext_updates", true) fun automaticExtUpdates() = this.preferenceStore.getBoolean("automatic_ext_updates", true)
fun showNsfwSource() = this.preferenceStore.getBoolean("show_nsfw_source", true)
fun extensionUpdatesCount() = this.preferenceStore.getInt("ext_updates_count", 0)
fun lastAppCheck() = this.preferenceStore.getLong("last_app_check", 0) fun lastAppCheck() = this.preferenceStore.getLong("last_app_check", 0)
fun lastExtCheck() = this.preferenceStore.getLong("last_ext_check", 0) fun lastExtCheck() = this.preferenceStore.getLong("last_ext_check", 0)
fun searchPinnedSourcesOnly() = this.preferenceStore.getBoolean(Keys.searchPinnedSourcesOnly, false)
fun disabledSources() = this.preferenceStore.getStringSet("hidden_catalogues", emptySet())
fun pinnedSources() = this.preferenceStore.getStringSet("pinned_catalogues", emptySet())
fun downloadNewChapters() = this.preferenceStore.getBoolean("download_new", false) fun downloadNewChapters() = this.preferenceStore.getBoolean("download_new", false)
fun downloadNewChapterCategories() = this.preferenceStore.getStringSet("download_new_categories", emptySet()) fun downloadNewChapterCategories() = this.preferenceStore.getStringSet("download_new_categories", emptySet())
@ -295,8 +276,6 @@ class PreferencesHelper(
fun migrateFlags() = this.preferenceStore.getInt("migrate_flags", Int.MAX_VALUE) fun migrateFlags() = this.preferenceStore.getInt("migrate_flags", Int.MAX_VALUE)
fun trustedSignatures() = this.preferenceStore.getStringSet("trusted_signatures", emptySet())
fun filterChapterByRead() = this.preferenceStore.getInt(Keys.defaultChapterFilterByRead, DomainManga.SHOW_ALL.toInt()) fun filterChapterByRead() = this.preferenceStore.getInt(Keys.defaultChapterFilterByRead, DomainManga.SHOW_ALL.toInt())
fun filterChapterByDownloaded() = this.preferenceStore.getInt(Keys.defaultChapterFilterByDownloaded, DomainManga.SHOW_ALL.toInt()) fun filterChapterByDownloaded() = this.preferenceStore.getInt(Keys.defaultChapterFilterByDownloaded, DomainManga.SHOW_ALL.toInt())
@ -320,8 +299,6 @@ class PreferencesHelper(
fun autoClearChapterCache() = this.preferenceStore.getBoolean(Keys.autoClearChapterCache, false) fun autoClearChapterCache() = this.preferenceStore.getBoolean(Keys.autoClearChapterCache, false)
fun duplicatePinnedSources() = this.preferenceStore.getBoolean("duplicate_pinned_sources", false)
fun setChapterSettingsDefault(manga: Manga) { fun setChapterSettingsDefault(manga: Manga) {
filterChapterByRead().set(manga.readFilter) filterChapterByRead().set(manga.readFilter)
filterChapterByDownloaded().set(manga.downloadedFilter) filterChapterByDownloaded().set(manga.downloadedFilter)

View File

@ -4,8 +4,8 @@ import android.content.Context
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import com.jakewharton.rxrelay.BehaviorRelay import com.jakewharton.rxrelay.BehaviorRelay
import eu.kanade.domain.source.model.SourceData import eu.kanade.domain.source.model.SourceData
import eu.kanade.domain.source.service.SourcePreferences
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.extension.api.ExtensionGithubApi import eu.kanade.tachiyomi.extension.api.ExtensionGithubApi
import eu.kanade.tachiyomi.extension.model.AvailableSources import eu.kanade.tachiyomi.extension.model.AvailableSources
import eu.kanade.tachiyomi.extension.model.Extension import eu.kanade.tachiyomi.extension.model.Extension
@ -42,7 +42,7 @@ import java.util.Locale
*/ */
class ExtensionManager( class ExtensionManager(
private val context: Context, private val context: Context,
private val preferences: PreferencesHelper = Injekt.get(), private val preferences: SourcePreferences = Injekt.get(),
) { ) {
/** /**

View File

@ -6,7 +6,7 @@ import android.content.pm.PackageInfo
import android.content.pm.PackageManager import android.content.pm.PackageManager
import androidx.core.content.pm.PackageInfoCompat import androidx.core.content.pm.PackageInfoCompat
import dalvik.system.PathClassLoader import dalvik.system.PathClassLoader
import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.domain.source.service.SourcePreferences
import eu.kanade.tachiyomi.extension.model.Extension import eu.kanade.tachiyomi.extension.model.Extension
import eu.kanade.tachiyomi.extension.model.LoadResult import eu.kanade.tachiyomi.extension.model.LoadResult
import eu.kanade.tachiyomi.source.CatalogueSource import eu.kanade.tachiyomi.source.CatalogueSource
@ -26,7 +26,7 @@ import uy.kohesive.injekt.injectLazy
@SuppressLint("PackageManagerGetSignatures") @SuppressLint("PackageManagerGetSignatures")
internal object ExtensionLoader { internal object ExtensionLoader {
private val preferences: PreferencesHelper by injectLazy() private val preferences: SourcePreferences by injectLazy()
private val loadNsfwSource by lazy { private val loadNsfwSource by lazy {
preferences.showNsfwSource().get() preferences.showNsfwSource().get()
} }

View File

@ -2,7 +2,7 @@ package eu.kanade.tachiyomi.source
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import eu.kanade.domain.source.model.SourceData import eu.kanade.domain.source.model.SourceData
import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.domain.source.service.SourcePreferences
import eu.kanade.tachiyomi.extension.ExtensionManager import eu.kanade.tachiyomi.extension.ExtensionManager
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
@ -14,7 +14,7 @@ fun Source.getPreferenceKey(): String = "source_$id"
fun Source.toSourceData(): SourceData = SourceData(id = id, lang = lang, name = name) fun Source.toSourceData(): SourceData = SourceData(id = id, lang = lang, name = name)
fun Source.getNameForMangaInfo(): String { fun Source.getNameForMangaInfo(): String {
val preferences = Injekt.get<PreferencesHelper>() val preferences = Injekt.get<SourcePreferences>()
val enabledLanguages = preferences.enabledLanguages().get() val enabledLanguages = preferences.enabledLanguages().get()
.filterNot { it in listOf("all", "other") } .filterNot { it in listOf("all", "other") }
val hasOneActiveLanguages = enabledLanguages.size == 1 val hasOneActiveLanguages = enabledLanguages.size == 1

View File

@ -3,9 +3,9 @@ package eu.kanade.tachiyomi.ui.browse.extension
import android.os.Bundle import android.os.Bundle
import eu.kanade.domain.extension.interactor.GetExtensionLanguages import eu.kanade.domain.extension.interactor.GetExtensionLanguages
import eu.kanade.domain.source.interactor.ToggleLanguage import eu.kanade.domain.source.interactor.ToggleLanguage
import eu.kanade.domain.source.service.SourcePreferences
import eu.kanade.presentation.browse.ExtensionFilterState import eu.kanade.presentation.browse.ExtensionFilterState
import eu.kanade.presentation.browse.ExtensionFilterStateImpl import eu.kanade.presentation.browse.ExtensionFilterStateImpl
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter
import eu.kanade.tachiyomi.util.lang.launchIO import eu.kanade.tachiyomi.util.lang.launchIO
import eu.kanade.tachiyomi.util.system.logcat import eu.kanade.tachiyomi.util.system.logcat
@ -21,7 +21,7 @@ class ExtensionFilterPresenter(
private val state: ExtensionFilterStateImpl = ExtensionFilterState() as ExtensionFilterStateImpl, private val state: ExtensionFilterStateImpl = ExtensionFilterState() as ExtensionFilterStateImpl,
private val getExtensionLanguages: GetExtensionLanguages = Injekt.get(), private val getExtensionLanguages: GetExtensionLanguages = Injekt.get(),
private val toggleLanguage: ToggleLanguage = Injekt.get(), private val toggleLanguage: ToggleLanguage = Injekt.get(),
private val preferences: PreferencesHelper = Injekt.get(), private val preferences: SourcePreferences = Injekt.get(),
) : BasePresenter<ExtensionFilterController>(), ExtensionFilterState by state { ) : BasePresenter<ExtensionFilterController>(), ExtensionFilterState by state {
private val _events = Channel<Event>(Int.MAX_VALUE) private val _events = Channel<Event>(Int.MAX_VALUE)

View File

@ -3,11 +3,11 @@ package eu.kanade.tachiyomi.ui.browse.extension
import android.app.Application import android.app.Application
import androidx.annotation.StringRes import androidx.annotation.StringRes
import eu.kanade.domain.extension.interactor.GetExtensionsByType import eu.kanade.domain.extension.interactor.GetExtensionsByType
import eu.kanade.domain.source.service.SourcePreferences
import eu.kanade.presentation.browse.ExtensionState import eu.kanade.presentation.browse.ExtensionState
import eu.kanade.presentation.browse.ExtensionsState import eu.kanade.presentation.browse.ExtensionsState
import eu.kanade.presentation.browse.ExtensionsStateImpl import eu.kanade.presentation.browse.ExtensionsStateImpl
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.extension.ExtensionManager import eu.kanade.tachiyomi.extension.ExtensionManager
import eu.kanade.tachiyomi.extension.model.Extension import eu.kanade.tachiyomi.extension.model.Extension
import eu.kanade.tachiyomi.extension.model.InstallStep import eu.kanade.tachiyomi.extension.model.InstallStep
@ -31,7 +31,7 @@ import uy.kohesive.injekt.api.get
class ExtensionsPresenter( class ExtensionsPresenter(
private val presenterScope: CoroutineScope, private val presenterScope: CoroutineScope,
private val state: ExtensionsStateImpl = ExtensionState() as ExtensionsStateImpl, private val state: ExtensionsStateImpl = ExtensionState() as ExtensionsStateImpl,
private val preferences: PreferencesHelper = Injekt.get(), private val preferences: SourcePreferences = Injekt.get(),
private val extensionManager: ExtensionManager = Injekt.get(), private val extensionManager: ExtensionManager = Injekt.get(),
private val getExtensions: GetExtensionsByType = Injekt.get(), private val getExtensions: GetExtensionsByType = Injekt.get(),
) : ExtensionsState by state { ) : ExtensionsState by state {

View File

@ -150,7 +150,7 @@ class SearchController(
} }
override fun onTitleClick(source: CatalogueSource) { override fun onTitleClick(source: CatalogueSource) {
presenter.preferences.lastUsedSource().set(source.id) presenter.sourcePreferences.lastUsedSource().set(source.id)
router.pushController(SourceSearchController(manga, source, presenter.query)) router.pushController(SourceSearchController(manga, source, presenter.query))
} }

View File

@ -2,9 +2,9 @@ package eu.kanade.tachiyomi.ui.browse.migration.sources
import eu.kanade.domain.source.interactor.GetSourcesWithFavoriteCount import eu.kanade.domain.source.interactor.GetSourcesWithFavoriteCount
import eu.kanade.domain.source.interactor.SetMigrateSorting import eu.kanade.domain.source.interactor.SetMigrateSorting
import eu.kanade.domain.source.service.SourcePreferences
import eu.kanade.presentation.browse.MigrateSourceState import eu.kanade.presentation.browse.MigrateSourceState
import eu.kanade.presentation.browse.MigrateSourceStateImpl import eu.kanade.presentation.browse.MigrateSourceStateImpl
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.util.lang.launchIO import eu.kanade.tachiyomi.util.lang.launchIO
import eu.kanade.tachiyomi.util.system.logcat import eu.kanade.tachiyomi.util.system.logcat
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
@ -21,7 +21,7 @@ import uy.kohesive.injekt.api.get
class MigrationSourcesPresenter( class MigrationSourcesPresenter(
private val presenterScope: CoroutineScope, private val presenterScope: CoroutineScope,
private val state: MigrateSourceStateImpl = MigrateSourceState() as MigrateSourceStateImpl, private val state: MigrateSourceStateImpl = MigrateSourceState() as MigrateSourceStateImpl,
private val preferences: PreferencesHelper = Injekt.get(), private val preferences: SourcePreferences = Injekt.get(),
private val getSourcesWithFavoriteCount: GetSourcesWithFavoriteCount = Injekt.get(), private val getSourcesWithFavoriteCount: GetSourcesWithFavoriteCount = Injekt.get(),
private val setMigrateSorting: SetMigrateSorting = Injekt.get(), private val setMigrateSorting: SetMigrateSorting = Injekt.get(),
) : MigrateSourceState by state { ) : MigrateSourceState by state {

View File

@ -5,9 +5,9 @@ import eu.kanade.domain.source.interactor.GetLanguagesWithSources
import eu.kanade.domain.source.interactor.ToggleLanguage import eu.kanade.domain.source.interactor.ToggleLanguage
import eu.kanade.domain.source.interactor.ToggleSource import eu.kanade.domain.source.interactor.ToggleSource
import eu.kanade.domain.source.model.Source import eu.kanade.domain.source.model.Source
import eu.kanade.domain.source.service.SourcePreferences
import eu.kanade.presentation.browse.SourcesFilterState import eu.kanade.presentation.browse.SourcesFilterState
import eu.kanade.presentation.browse.SourcesFilterStateImpl import eu.kanade.presentation.browse.SourcesFilterStateImpl
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter
import eu.kanade.tachiyomi.util.lang.launchIO import eu.kanade.tachiyomi.util.lang.launchIO
import eu.kanade.tachiyomi.util.system.logcat import eu.kanade.tachiyomi.util.system.logcat
@ -24,7 +24,7 @@ class SourcesFilterPresenter(
private val getLanguagesWithSources: GetLanguagesWithSources = Injekt.get(), private val getLanguagesWithSources: GetLanguagesWithSources = Injekt.get(),
private val toggleSource: ToggleSource = Injekt.get(), private val toggleSource: ToggleSource = Injekt.get(),
private val toggleLanguage: ToggleLanguage = Injekt.get(), private val toggleLanguage: ToggleLanguage = Injekt.get(),
private val preferences: PreferencesHelper = Injekt.get(), private val preferences: SourcePreferences = Injekt.get(),
) : BasePresenter<SourceFilterController>(), SourcesFilterState by state { ) : BasePresenter<SourceFilterController>(), SourcesFilterState by state {
private val _events = Channel<Event>(Int.MAX_VALUE) private val _events = Channel<Event>(Int.MAX_VALUE)

View File

@ -5,6 +5,7 @@ import eu.kanade.domain.source.interactor.ToggleSource
import eu.kanade.domain.source.interactor.ToggleSourcePin import eu.kanade.domain.source.interactor.ToggleSourcePin
import eu.kanade.domain.source.model.Pin import eu.kanade.domain.source.model.Pin
import eu.kanade.domain.source.model.Source import eu.kanade.domain.source.model.Source
import eu.kanade.domain.source.service.SourcePreferences
import eu.kanade.presentation.browse.SourceUiModel import eu.kanade.presentation.browse.SourceUiModel
import eu.kanade.presentation.browse.SourcesState import eu.kanade.presentation.browse.SourcesState
import eu.kanade.presentation.browse.SourcesStateImpl import eu.kanade.presentation.browse.SourcesStateImpl
@ -25,6 +26,7 @@ class SourcesPresenter(
private val presenterScope: CoroutineScope, private val presenterScope: CoroutineScope,
private val state: SourcesStateImpl = SourcesState() as SourcesStateImpl, private val state: SourcesStateImpl = SourcesState() as SourcesStateImpl,
private val preferences: PreferencesHelper = Injekt.get(), private val preferences: PreferencesHelper = Injekt.get(),
private val sourcePreferences: SourcePreferences = Injekt.get(),
private val getEnabledSources: GetEnabledSources = Injekt.get(), private val getEnabledSources: GetEnabledSources = Injekt.get(),
private val toggleSource: ToggleSource = Injekt.get(), private val toggleSource: ToggleSource = Injekt.get(),
private val toggleSourcePin: ToggleSourcePin = Injekt.get(), private val toggleSourcePin: ToggleSourcePin = Injekt.get(),
@ -79,7 +81,7 @@ class SourcesPresenter(
fun onOpenSource(source: Source) { fun onOpenSource(source: Source) {
if (!preferences.incognitoMode().get()) { if (!preferences.incognitoMode().get()) {
preferences.lastUsedSource().set(source.id) sourcePreferences.lastUsedSource().set(source.id)
} }
} }

View File

@ -11,6 +11,7 @@ import androidx.core.view.isVisible
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import dev.chrisbanes.insetter.applyInsetter import dev.chrisbanes.insetter.applyInsetter
import eu.kanade.domain.manga.model.Manga import eu.kanade.domain.manga.model.Manga
import eu.kanade.domain.source.service.SourcePreferences
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.databinding.GlobalSearchControllerBinding import eu.kanade.tachiyomi.databinding.GlobalSearchControllerBinding
@ -34,6 +35,7 @@ open class GlobalSearchController(
GlobalSearchAdapter.OnTitleClickListener { GlobalSearchAdapter.OnTitleClickListener {
private val preferences: PreferencesHelper by injectLazy() private val preferences: PreferencesHelper by injectLazy()
private val sourcePreferences: SourcePreferences by injectLazy()
/** /**
* Adapter containing search results grouped by lang. * Adapter containing search results grouped by lang.
@ -174,7 +176,7 @@ open class GlobalSearchController(
* @param searchResult result of search. * @param searchResult result of search.
*/ */
fun setItems(searchResult: List<GlobalSearchItem>) { fun setItems(searchResult: List<GlobalSearchItem>) {
if (searchResult.isEmpty() && preferences.searchPinnedSourcesOnly().get()) { if (searchResult.isEmpty() && sourcePreferences.searchPinnedSourcesOnly().get()) {
binding.emptyView.show(R.string.no_pinned_sources) binding.emptyView.show(R.string.no_pinned_sources)
} else { } else {
binding.emptyView.hide() binding.emptyView.hide()
@ -205,7 +207,7 @@ open class GlobalSearchController(
*/ */
override fun onTitleClick(source: CatalogueSource) { override fun onTitleClick(source: CatalogueSource) {
if (!preferences.incognitoMode().get()) { if (!preferences.incognitoMode().get()) {
preferences.lastUsedSource().set(source.id) sourcePreferences.lastUsedSource().set(source.id)
} }
router.pushController(BrowseSourceController(source, presenter.query)) router.pushController(BrowseSourceController(source, presenter.query))
} }

View File

@ -6,6 +6,7 @@ import eu.kanade.domain.manga.interactor.InsertManga
import eu.kanade.domain.manga.interactor.UpdateManga import eu.kanade.domain.manga.interactor.UpdateManga
import eu.kanade.domain.manga.model.toDbManga import eu.kanade.domain.manga.model.toDbManga
import eu.kanade.domain.manga.model.toMangaUpdate import eu.kanade.domain.manga.model.toMangaUpdate
import eu.kanade.domain.source.service.SourcePreferences
import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.data.database.models.toDomainManga import eu.kanade.tachiyomi.data.database.models.toDomainManga
import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.data.preference.PreferencesHelper
@ -35,6 +36,7 @@ open class GlobalSearchPresenter(
private val initialExtensionFilter: String? = null, private val initialExtensionFilter: String? = null,
val sourceManager: SourceManager = Injekt.get(), val sourceManager: SourceManager = Injekt.get(),
val preferences: PreferencesHelper = Injekt.get(), val preferences: PreferencesHelper = Injekt.get(),
val sourcePreferences: SourcePreferences = Injekt.get(),
private val getManga: GetManga = Injekt.get(), private val getManga: GetManga = Injekt.get(),
private val insertManga: InsertManga = Injekt.get(), private val insertManga: InsertManga = Injekt.get(),
private val updateManga: UpdateManga = Injekt.get(), private val updateManga: UpdateManga = Injekt.get(),
@ -96,9 +98,9 @@ open class GlobalSearchPresenter(
* @return list containing enabled sources. * @return list containing enabled sources.
*/ */
protected open fun getEnabledSources(): List<CatalogueSource> { protected open fun getEnabledSources(): List<CatalogueSource> {
val languages = preferences.enabledLanguages().get() val languages = sourcePreferences.enabledLanguages().get()
val disabledSourceIds = preferences.disabledSources().get() val disabledSourceIds = sourcePreferences.disabledSources().get()
val pinnedSourceIds = preferences.pinnedSources().get() val pinnedSourceIds = sourcePreferences.pinnedSources().get()
return sourceManager.getCatalogueSources() return sourceManager.getCatalogueSources()
.filter { it.lang in languages } .filter { it.lang in languages }
@ -123,8 +125,8 @@ open class GlobalSearchPresenter(
return filteredSources return filteredSources
} }
val onlyPinnedSources = preferences.searchPinnedSourcesOnly().get() val onlyPinnedSources = sourcePreferences.searchPinnedSourcesOnly().get()
val pinnedSourceIds = preferences.pinnedSources().get() val pinnedSourceIds = sourcePreferences.pinnedSources().get()
return enabledSources return enabledSources
.filter { if (onlyPinnedSources) it.id.toString() in pinnedSourceIds else true } .filter { if (onlyPinnedSources) it.id.toString() in pinnedSourceIds else true }
@ -156,7 +158,7 @@ open class GlobalSearchPresenter(
val initialItems = sources.map { createCatalogueSearchItem(it, null) } val initialItems = sources.map { createCatalogueSearchItem(it, null) }
var items = initialItems var items = initialItems
val pinnedSourceIds = preferences.pinnedSources().get() val pinnedSourceIds = sourcePreferences.pinnedSources().get()
fetchSourcesSubscription?.unsubscribe() fetchSourcesSubscription?.unsubscribe()
fetchSourcesSubscription = Observable.from(sources) fetchSourcesSubscription = Observable.from(sources)

View File

@ -31,6 +31,7 @@ import com.bluelinelabs.conductor.RouterTransaction
import com.google.android.material.navigation.NavigationBarView import com.google.android.material.navigation.NavigationBarView
import com.google.android.material.transition.platform.MaterialContainerTransformSharedElementCallback import com.google.android.material.transition.platform.MaterialContainerTransformSharedElementCallback
import dev.chrisbanes.insetter.applyInsetter import dev.chrisbanes.insetter.applyInsetter
import eu.kanade.domain.source.service.SourcePreferences
import eu.kanade.tachiyomi.BuildConfig import eu.kanade.tachiyomi.BuildConfig
import eu.kanade.tachiyomi.Migrations import eu.kanade.tachiyomi.Migrations
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
@ -78,6 +79,8 @@ import uy.kohesive.injekt.injectLazy
class MainActivity : BaseActivity() { class MainActivity : BaseActivity() {
private val sourcePreferences: SourcePreferences by injectLazy()
lateinit var binding: MainActivityBinding lateinit var binding: MainActivityBinding
private lateinit var router: Router private lateinit var router: Router
@ -112,6 +115,7 @@ class MainActivity : BaseActivity() {
context = applicationContext, context = applicationContext,
preferences = preferences, preferences = preferences,
networkPreferences = Injekt.get(), networkPreferences = Injekt.get(),
sourcePreferences = sourcePreferences,
) )
} else { } else {
false false
@ -254,7 +258,7 @@ class MainActivity : BaseActivity() {
.onEach { setUnreadUpdatesBadge() } .onEach { setUnreadUpdatesBadge() }
.launchIn(lifecycleScope) .launchIn(lifecycleScope)
preferences.extensionUpdatesCount() sourcePreferences.extensionUpdatesCount()
.asHotFlow { setExtensionsBadge() } .asHotFlow { setExtensionsBadge() }
.launchIn(lifecycleScope) .launchIn(lifecycleScope)
@ -371,7 +375,7 @@ class MainActivity : BaseActivity() {
this@MainActivity, this@MainActivity,
fromAvailableExtensionList = true, fromAvailableExtensionList = true,
)?.let { pendingUpdates -> )?.let { pendingUpdates ->
preferences.extensionUpdatesCount().set(pendingUpdates.size) sourcePreferences.extensionUpdatesCount().set(pendingUpdates.size)
} }
} catch (e: Exception) { } catch (e: Exception) {
logcat(LogPriority.ERROR, e) logcat(LogPriority.ERROR, e)
@ -392,7 +396,7 @@ class MainActivity : BaseActivity() {
} }
private fun setExtensionsBadge() { private fun setExtensionsBadge() {
val updates = preferences.extensionUpdatesCount().get() val updates = sourcePreferences.extensionUpdatesCount().get()
if (updates > 0) { if (updates > 0) {
nav.getOrCreateBadge(R.id.nav_browse).apply { nav.getOrCreateBadge(R.id.nav_browse).apply {
number = updates number = updates

View File

@ -2,10 +2,10 @@ package eu.kanade.tachiyomi.ui.setting
import androidx.fragment.app.FragmentActivity import androidx.fragment.app.FragmentActivity
import androidx.preference.PreferenceScreen import androidx.preference.PreferenceScreen
import eu.kanade.domain.source.service.SourcePreferences
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.extension.ExtensionUpdateJob import eu.kanade.tachiyomi.extension.ExtensionUpdateJob
import eu.kanade.tachiyomi.util.preference.bindTo import eu.kanade.tachiyomi.util.preference.bindTo
import eu.kanade.tachiyomi.util.preference.defaultValue
import eu.kanade.tachiyomi.util.preference.infoPreference import eu.kanade.tachiyomi.util.preference.infoPreference
import eu.kanade.tachiyomi.util.preference.onChange import eu.kanade.tachiyomi.util.preference.onChange
import eu.kanade.tachiyomi.util.preference.preferenceCategory import eu.kanade.tachiyomi.util.preference.preferenceCategory
@ -14,10 +14,12 @@ import eu.kanade.tachiyomi.util.preference.summaryRes
import eu.kanade.tachiyomi.util.preference.switchPreference import eu.kanade.tachiyomi.util.preference.switchPreference
import eu.kanade.tachiyomi.util.preference.titleRes import eu.kanade.tachiyomi.util.preference.titleRes
import eu.kanade.tachiyomi.util.system.AuthenticatorUtil.isAuthenticationSupported import eu.kanade.tachiyomi.util.system.AuthenticatorUtil.isAuthenticationSupported
import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys import uy.kohesive.injekt.injectLazy
class SettingsBrowseController : SettingsController() { class SettingsBrowseController : SettingsController() {
private val sourcePreferences: SourcePreferences by injectLazy()
override fun setupPreferenceScreen(screen: PreferenceScreen) = screen.apply { override fun setupPreferenceScreen(screen: PreferenceScreen) = screen.apply {
titleRes = R.string.browse titleRes = R.string.browse
@ -25,7 +27,7 @@ class SettingsBrowseController : SettingsController() {
titleRes = R.string.label_sources titleRes = R.string.label_sources
switchPreference { switchPreference {
bindTo(preferences.duplicatePinnedSources()) bindTo(sourcePreferences.duplicatePinnedSources())
titleRes = R.string.pref_duplicate_pinned_sources titleRes = R.string.pref_duplicate_pinned_sources
summaryRes = R.string.pref_duplicate_pinned_sources_summary summaryRes = R.string.pref_duplicate_pinned_sources_summary
} }
@ -50,9 +52,8 @@ class SettingsBrowseController : SettingsController() {
titleRes = R.string.action_global_search titleRes = R.string.action_global_search
switchPreference { switchPreference {
key = Keys.searchPinnedSourcesOnly bindTo(sourcePreferences.searchPinnedSourcesOnly())
titleRes = R.string.pref_search_pinned_sources_only titleRes = R.string.pref_search_pinned_sources_only
defaultValue = false
} }
} }
@ -60,7 +61,7 @@ class SettingsBrowseController : SettingsController() {
titleRes = R.string.pref_category_nsfw_content titleRes = R.string.pref_category_nsfw_content
switchPreference { switchPreference {
bindTo(preferences.showNsfwSource()) bindTo(sourcePreferences.showNsfwSource())
titleRes = R.string.pref_show_nsfw_source titleRes = R.string.pref_show_nsfw_source
summaryRes = R.string.requires_app_restart summaryRes = R.string.requires_app_restart