Minor refactors

(cherry picked from commit 9b6c5effc9262f190c8758d2047708cd51549855)
This commit is contained in:
Jobobby04 2025-05-15 13:38:03 -04:00 committed by Cuong-Tran
parent 9136c15b9e
commit b85fa5b9c9
No known key found for this signature in database
GPG key ID: 94EFFE320FE7A47C
51 changed files with 367 additions and 413 deletions

View file

@ -14617,8 +14617,8 @@ Leu/kanade/presentation/more/settings/screen/ConfigureExhDialogKt;
HSPLeu/kanade/presentation/more/settings/screen/ConfigureExhDialogKt;->ConfigureExhDialog(ZLkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;I)V HSPLeu/kanade/presentation/more/settings/screen/ConfigureExhDialogKt;->ConfigureExhDialog(ZLkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;I)V
HPLeu/kanade/presentation/more/settings/screen/ConfigureExhDialogKt;->ConfigureExhDialog(ZLkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;I)V HPLeu/kanade/presentation/more/settings/screen/ConfigureExhDialogKt;->ConfigureExhDialog(ZLkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;I)V
Leu/kanade/presentation/more/settings/screen/ConfigureExhDialogKt$ConfigureExhDialog$1; Leu/kanade/presentation/more/settings/screen/ConfigureExhDialogKt$ConfigureExhDialog$1;
HSPLeu/kanade/presentation/more/settings/screen/ConfigureExhDialogKt$ConfigureExhDialog$1;-><init>(ZLtachiyomi/domain/UnsortedPreferences;Lkotlin/jvm/functions/Function0;Landroidx/compose/runtime/MutableState;Landroidx/compose/runtime/MutableState;Lkotlin/coroutines/Continuation;)V HSPLeu/kanade/presentation/more/settings/screen/ConfigureExhDialogKt$ConfigureExhDialog$1;-><init>(ZLtachiyomi/domain/ExhPreferences;Lkotlin/jvm/functions/Function0;Landroidx/compose/runtime/MutableState;Landroidx/compose/runtime/MutableState;Lkotlin/coroutines/Continuation;)V
PLeu/kanade/presentation/more/settings/screen/ConfigureExhDialogKt$ConfigureExhDialog$1;-><init>(ZLtachiyomi/domain/UnsortedPreferences;Lkotlin/jvm/functions/Function0;Landroidx/compose/runtime/MutableState;Landroidx/compose/runtime/MutableState;Lkotlin/coroutines/Continuation;)V PLeu/kanade/presentation/more/settings/screen/ConfigureExhDialogKt$ConfigureExhDialog$1;-><init>(ZLtachiyomi/domain/ExhPreferences;Lkotlin/jvm/functions/Function0;Landroidx/compose/runtime/MutableState;Landroidx/compose/runtime/MutableState;Lkotlin/coroutines/Continuation;)V
HSPLeu/kanade/presentation/more/settings/screen/ConfigureExhDialogKt$ConfigureExhDialog$1;->create(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Lkotlin/coroutines/Continuation; HSPLeu/kanade/presentation/more/settings/screen/ConfigureExhDialogKt$ConfigureExhDialog$1;->create(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Lkotlin/coroutines/Continuation;
PLeu/kanade/presentation/more/settings/screen/ConfigureExhDialogKt$ConfigureExhDialog$1;->create(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Lkotlin/coroutines/Continuation; PLeu/kanade/presentation/more/settings/screen/ConfigureExhDialogKt$ConfigureExhDialog$1;->create(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Lkotlin/coroutines/Continuation;
HSPLeu/kanade/presentation/more/settings/screen/ConfigureExhDialogKt$ConfigureExhDialog$1;->invokeSuspend(Ljava/lang/Object;)Ljava/lang/Object; HSPLeu/kanade/presentation/more/settings/screen/ConfigureExhDialogKt$ConfigureExhDialog$1;->invokeSuspend(Ljava/lang/Object;)Ljava/lang/Object;
@ -32652,13 +32652,13 @@ HSPLtachiyomi/data/updates/UpdatesRepositoryImpl$subscribeWithRead$1;-><init>(J)
PLtachiyomi/data/updates/UpdatesRepositoryImpl$subscribeWithRead$1;-><init>(J)V PLtachiyomi/data/updates/UpdatesRepositoryImpl$subscribeWithRead$1;-><init>(J)V
HSPLtachiyomi/data/updates/UpdatesRepositoryImpl$subscribeWithRead$1;->invoke(Ljava/lang/Object;)Ljava/lang/Object; HSPLtachiyomi/data/updates/UpdatesRepositoryImpl$subscribeWithRead$1;->invoke(Ljava/lang/Object;)Ljava/lang/Object;
PLtachiyomi/data/updates/UpdatesRepositoryImpl$subscribeWithRead$1;->invoke(Ljava/lang/Object;)Ljava/lang/Object; PLtachiyomi/data/updates/UpdatesRepositoryImpl$subscribeWithRead$1;->invoke(Ljava/lang/Object;)Ljava/lang/Object;
Ltachiyomi/domain/UnsortedPreferences; Ltachiyomi/domain/ExhPreferences;
HSPLtachiyomi/domain/UnsortedPreferences;-><init>(Ltachiyomi/core/preference/PreferenceStore;)V HSPLtachiyomi/domain/ExhPreferences;-><init>(Ltachiyomi/core/preference/PreferenceStore;)V
PLtachiyomi/domain/UnsortedPreferences;-><init>(Ltachiyomi/core/preference/PreferenceStore;)V PLtachiyomi/domain/ExhPreferences;-><init>(Ltachiyomi/core/preference/PreferenceStore;)V
HSPLtachiyomi/domain/UnsortedPreferences;->enableExhentai()Ltachiyomi/core/preference/Preference; HSPLtachiyomi/domain/ExhPreferences;->enableExhentai()Ltachiyomi/core/preference/Preference;
PLtachiyomi/domain/UnsortedPreferences;->enableExhentai()Ltachiyomi/core/preference/Preference; PLtachiyomi/domain/ExhPreferences;->enableExhentai()Ltachiyomi/core/preference/Preference;
HSPLtachiyomi/domain/UnsortedPreferences;->extensionRepos()Ltachiyomi/core/preference/Preference; HSPLtachiyomi/domain/ExhPreferences;->extensionRepos()Ltachiyomi/core/preference/Preference;
PLtachiyomi/domain/UnsortedPreferences;->extensionRepos()Ltachiyomi/core/preference/Preference; PLtachiyomi/domain/ExhPreferences;->extensionRepos()Ltachiyomi/core/preference/Preference;
Ltachiyomi/domain/backup/service/BackupPreferences; Ltachiyomi/domain/backup/service/BackupPreferences;
HSPLtachiyomi/domain/backup/service/BackupPreferences;-><init>(Ltachiyomi/core/provider/FolderProvider;Ltachiyomi/core/preference/PreferenceStore;)V HSPLtachiyomi/domain/backup/service/BackupPreferences;-><init>(Ltachiyomi/core/provider/FolderProvider;Ltachiyomi/core/preference/PreferenceStore;)V
PLtachiyomi/domain/backup/service/BackupPreferences;-><init>(Ltachiyomi/core/provider/FolderProvider;Ltachiyomi/core/preference/PreferenceStore;)V PLtachiyomi/domain/backup/service/BackupPreferences;-><init>(Ltachiyomi/core/provider/FolderProvider;Ltachiyomi/core/preference/PreferenceStore;)V
@ -32721,7 +32721,6 @@ PLtachiyomi/domain/download/service/DownloadPreferences;->downloadsDirectory()Lt
Ltachiyomi/domain/history/interactor/GetHistory; Ltachiyomi/domain/history/interactor/GetHistory;
HSPLtachiyomi/domain/history/interactor/GetHistory;-><init>(Ltachiyomi/domain/history/repository/HistoryRepository;)V HSPLtachiyomi/domain/history/interactor/GetHistory;-><init>(Ltachiyomi/domain/history/repository/HistoryRepository;)V
PLtachiyomi/domain/history/interactor/GetHistory;-><init>(Ltachiyomi/domain/history/repository/HistoryRepository;)V PLtachiyomi/domain/history/interactor/GetHistory;-><init>(Ltachiyomi/domain/history/repository/HistoryRepository;)V
Ltachiyomi/domain/history/interactor/GetHistoryByMangaId;
Ltachiyomi/domain/history/interactor/GetNextChapters; Ltachiyomi/domain/history/interactor/GetNextChapters;
HSPLtachiyomi/domain/history/interactor/GetNextChapters;-><init>(Ltachiyomi/domain/chapter/interactor/GetChapterByMangaId;Ltachiyomi/domain/chapter/interactor/GetMergedChapterByMangaId;Ltachiyomi/domain/manga/interactor/GetManga;Ltachiyomi/domain/history/repository/HistoryRepository;)V HSPLtachiyomi/domain/history/interactor/GetNextChapters;-><init>(Ltachiyomi/domain/chapter/interactor/GetChapterByMangaId;Ltachiyomi/domain/chapter/interactor/GetMergedChapterByMangaId;Ltachiyomi/domain/manga/interactor/GetManga;Ltachiyomi/domain/history/repository/HistoryRepository;)V
PLtachiyomi/domain/history/interactor/GetNextChapters;-><init>(Ltachiyomi/domain/chapter/interactor/GetChapterByMangaId;Ltachiyomi/domain/chapter/interactor/GetMergedChapterByMangaId;Ltachiyomi/domain/manga/interactor/GetManga;Ltachiyomi/domain/history/repository/HistoryRepository;)V PLtachiyomi/domain/history/interactor/GetNextChapters;-><init>(Ltachiyomi/domain/chapter/interactor/GetChapterByMangaId;Ltachiyomi/domain/chapter/interactor/GetMergedChapterByMangaId;Ltachiyomi/domain/manga/interactor/GetManga;Ltachiyomi/domain/history/repository/HistoryRepository;)V
@ -33492,4 +33491,4 @@ PLuy/kohesive/injekt/registry/default/DefaultRegistrar$addSingletonFactory$1$$sp
Luy/kohesive/injekt/registry/default/DefaultRegistrar$threadedValues$1; Luy/kohesive/injekt/registry/default/DefaultRegistrar$threadedValues$1;
HSPLuy/kohesive/injekt/registry/default/DefaultRegistrar$threadedValues$1;-><init>()V HSPLuy/kohesive/injekt/registry/default/DefaultRegistrar$threadedValues$1;-><init>()V
PLuy/kohesive/injekt/registry/default/DefaultRegistrar$threadedValues$1;-><init>()V PLuy/kohesive/injekt/registry/default/DefaultRegistrar$threadedValues$1;-><init>()V
Lxyz/nulldev/ts/api/http/serializer/FilterSerializer; Lxyz/nulldev/ts/api/http/serializer/FilterSerializer;

View file

@ -26,7 +26,6 @@ import tachiyomi.data.source.SavedSearchRepositoryImpl
import tachiyomi.domain.chapter.interactor.DeleteChapters import tachiyomi.domain.chapter.interactor.DeleteChapters
import tachiyomi.domain.chapter.interactor.GetChapterByUrl import tachiyomi.domain.chapter.interactor.GetChapterByUrl
import tachiyomi.domain.chapter.interactor.GetMergedChaptersByMangaId import tachiyomi.domain.chapter.interactor.GetMergedChaptersByMangaId
import tachiyomi.domain.history.interactor.GetHistoryByMangaId
import tachiyomi.domain.manga.interactor.DeleteByMergeId import tachiyomi.domain.manga.interactor.DeleteByMergeId
import tachiyomi.domain.manga.interactor.DeleteFavoriteEntries import tachiyomi.domain.manga.interactor.DeleteFavoriteEntries
import tachiyomi.domain.manga.interactor.DeleteMangaById import tachiyomi.domain.manga.interactor.DeleteMangaById
@ -91,7 +90,6 @@ class SYDomainModule : InjektModule {
addFactory { DeleteChapters(get()) } addFactory { DeleteChapters(get()) }
addFactory { DeleteMangaById(get()) } addFactory { DeleteMangaById(get()) }
addFactory { FilterSerializer() } addFactory { FilterSerializer() }
addFactory { GetHistoryByMangaId(get()) }
addFactory { GetChapterByUrl(get()) } addFactory { GetChapterByUrl(get()) }
addFactory { GetSourceCategories(get()) } addFactory { GetSourceCategories(get()) }
addFactory { CreateSourceCategory(get()) } addFactory { CreateSourceCategory(get()) }

View file

@ -108,6 +108,33 @@ class SourcePreferences(
BANDWIDTH_HERO, BANDWIDTH_HERO,
WSRV_NL, WSRV_NL,
} }
fun migrateFlags() = preferenceStore.getInt("migrate_flags", Int.MAX_VALUE)
fun defaultMangaOrder() = preferenceStore.getString("default_manga_order", "")
fun migrationSources() = preferenceStore.getString("migrate_sources", "")
fun smartMigration() = preferenceStore.getBoolean("smart_migrate", false)
fun useSourceWithMost() = preferenceStore.getBoolean("use_source_with_most", false)
fun skipPreMigration() = preferenceStore.getBoolean(Preference.appStateKey("skip_pre_migration"), false)
fun hideNotFoundMigration() = preferenceStore.getBoolean("hide_not_found_migration", false)
fun showOnlyUpdatesMigration() = preferenceStore.getBoolean("show_only_updates_migration", false)
fun allowLocalSourceHiddenFolders() = preferenceStore.getBoolean("allow_local_source_hidden_folders", false)
fun preferredMangaDexId() = preferenceStore.getString("preferred_mangaDex_id", "0")
fun mangadexSyncToLibraryIndexes() = preferenceStore.getStringSet(
"pref_mangadex_sync_to_library_indexes",
emptySet(),
)
fun recommendationSearchFlags() = preferenceStore.getInt("rec_search_flags", Int.MAX_VALUE)
// SY <-- // SY <--
// KMK --> // KMK -->

View file

@ -41,9 +41,9 @@ import eu.kanade.presentation.components.SOURCE_SEARCH_BOX_HEIGHT
import eu.kanade.presentation.util.animateItemFastScroll import eu.kanade.presentation.util.animateItemFastScroll
import eu.kanade.tachiyomi.ui.browse.migration.sources.MigrateSourceScreenModel import eu.kanade.tachiyomi.ui.browse.migration.sources.MigrateSourceScreenModel
import eu.kanade.tachiyomi.util.system.copyToClipboard import eu.kanade.tachiyomi.util.system.copyToClipboard
import exh.source.ExhPreferences
import exh.source.hentaiSourceIds import exh.source.hentaiSourceIds
import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.ImmutableList
import tachiyomi.domain.UnsortedPreferences
import tachiyomi.domain.source.model.Source import tachiyomi.domain.source.model.Source
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.i18n.kmk.KMR import tachiyomi.i18n.kmk.KMR
@ -120,7 +120,7 @@ private fun MigrateSourceList(
// KMK --> // KMK -->
val lazyListState = rememberLazyListState() val lazyListState = rememberLazyListState()
var filterObsoleteSource by rememberSaveable { mutableStateOf(false) } var filterObsoleteSource by rememberSaveable { mutableStateOf(false) }
val isHentaiEnabled = remember { Injekt.get<UnsortedPreferences>().isHentaiEnabled().get() } val isHentaiEnabled = remember { Injekt.get<ExhPreferences>().isHentaiEnabled().get() }
BackHandler(enabled = !state.searchQuery.isNullOrBlank()) { BackHandler(enabled = !state.searchQuery.isNullOrBlank()) {
onChangeSearchQuery("") onChangeSearchQuery("")

View file

@ -43,8 +43,8 @@ import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.more.DownloadQueueState import eu.kanade.tachiyomi.ui.more.DownloadQueueState
import eu.kanade.tachiyomi.util.system.openInBrowser import eu.kanade.tachiyomi.util.system.openInBrowser
import exh.pref.DelegateSourcePreferences import exh.pref.DelegateSourcePreferences
import exh.source.ExhPreferences
import tachiyomi.core.common.Constants import tachiyomi.core.common.Constants
import tachiyomi.domain.UnsortedPreferences
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.i18n.kmk.KMR import tachiyomi.i18n.kmk.KMR
import tachiyomi.i18n.sy.SYMR import tachiyomi.i18n.sy.SYMR
@ -83,7 +83,7 @@ fun MoreScreen(
) { ) {
val uriHandler = LocalUriHandler.current val uriHandler = LocalUriHandler.current
// SY --> // SY -->
val unsortedPreferences = remember { Injekt.get<UnsortedPreferences>() } val exhPreferences = remember { Injekt.get<ExhPreferences>() }
val delegateSourcePreferences = remember { Injekt.get<DelegateSourcePreferences>() } val delegateSourcePreferences = remember { Injekt.get<DelegateSourcePreferences>() }
// SY <-- // SY <--
@ -202,7 +202,7 @@ fun MoreScreen(
) )
} }
// SY --> // SY -->
if (unsortedPreferences.isHentaiEnabled().get() || delegateSourcePreferences.delegateSources().get()) { if (exhPreferences.isHentaiEnabled().get() || delegateSourcePreferences.delegateSources().get()) {
item { item {
TextPreferenceWidget( TextPreferenceWidget(
title = stringResource(SYMR.strings.eh_batch_add), title = stringResource(SYMR.strings.eh_batch_add),

View file

@ -13,13 +13,13 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.window.DialogProperties import androidx.compose.ui.window.DialogProperties
import eu.kanade.tachiyomi.util.system.toast import eu.kanade.tachiyomi.util.system.toast
import exh.log.xLogE import exh.log.xLogE
import exh.source.ExhPreferences
import exh.uconfig.EHConfigurator import exh.uconfig.EHConfigurator
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.NonCancellable import kotlinx.coroutines.NonCancellable
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
import tachiyomi.core.common.util.lang.launchUI import tachiyomi.core.common.util.lang.launchUI
import tachiyomi.domain.UnsortedPreferences
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.i18n.stringResource import tachiyomi.presentation.core.i18n.stringResource
@ -29,8 +29,8 @@ import kotlin.time.Duration.Companion.seconds
@Composable @Composable
fun ConfigureExhDialog(run: Boolean, onRunning: () -> Unit) { fun ConfigureExhDialog(run: Boolean, onRunning: () -> Unit) {
val unsortedPreferences = remember { val exhPreferences = remember {
Injekt.get<UnsortedPreferences>() Injekt.get<ExhPreferences>()
} }
var warnDialogOpen by remember { mutableStateOf(false) } var warnDialogOpen by remember { mutableStateOf(false) }
var configureDialogOpen by remember { mutableStateOf(false) } var configureDialogOpen by remember { mutableStateOf(false) }
@ -38,7 +38,7 @@ fun ConfigureExhDialog(run: Boolean, onRunning: () -> Unit) {
LaunchedEffect(run) { LaunchedEffect(run) {
if (run) { if (run) {
if (unsortedPreferences.exhShowSettingsUploadWarning().get()) { if (exhPreferences.exhShowSettingsUploadWarning().get()) {
warnDialogOpen = true warnDialogOpen = true
} else { } else {
configureDialogOpen = true configureDialogOpen = true
@ -57,7 +57,7 @@ fun ConfigureExhDialog(run: Boolean, onRunning: () -> Unit) {
confirmButton = { confirmButton = {
TextButton( TextButton(
onClick = { onClick = {
unsortedPreferences.exhShowSettingsUploadWarning().set(false) exhPreferences.exhShowSettingsUploadWarning().set(false)
configureDialogOpen = true configureDialogOpen = true
warnDialogOpen = false warnDialogOpen = false
}, },

View file

@ -72,6 +72,7 @@ import eu.kanade.tachiyomi.util.system.toast
import exh.debug.SettingsDebugScreen import exh.debug.SettingsDebugScreen
import exh.log.EHLogLevel import exh.log.EHLogLevel
import exh.pref.DelegateSourcePreferences import exh.pref.DelegateSourcePreferences
import exh.source.ExhPreferences
import exh.util.toAnnotatedString import exh.util.toAnnotatedString
import kotlinx.collections.immutable.persistentListOf import kotlinx.collections.immutable.persistentListOf
import kotlinx.collections.immutable.persistentMapOf import kotlinx.collections.immutable.persistentMapOf
@ -86,7 +87,6 @@ import tachiyomi.core.common.util.lang.launchNonCancellable
import tachiyomi.core.common.util.lang.withUIContext import tachiyomi.core.common.util.lang.withUIContext
import tachiyomi.core.common.util.system.ImageUtil import tachiyomi.core.common.util.system.ImageUtil
import tachiyomi.core.common.util.system.logcat import tachiyomi.core.common.util.system.logcat
import tachiyomi.domain.UnsortedPreferences
import tachiyomi.domain.chapter.interactor.GetChaptersByMangaId import tachiyomi.domain.chapter.interactor.GetChaptersByMangaId
import tachiyomi.domain.library.service.LibraryPreferences import tachiyomi.domain.library.service.LibraryPreferences
import tachiyomi.domain.manga.interactor.GetAllManga import tachiyomi.domain.manga.interactor.GetAllManga
@ -120,7 +120,7 @@ object SettingsAdvancedScreen : SearchableSettings {
val basePreferences = remember { Injekt.get<BasePreferences>() } val basePreferences = remember { Injekt.get<BasePreferences>() }
val networkPreferences = remember { Injekt.get<NetworkPreferences>() } val networkPreferences = remember { Injekt.get<NetworkPreferences>() }
val libraryPreferences = remember { Injekt.get<LibraryPreferences>() } val libraryPreferences = remember { Injekt.get<LibraryPreferences>() }
val unsortedPreferences = remember { Injekt.get<UnsortedPreferences>() } val exhPreferences = remember { Injekt.get<ExhPreferences>() }
return listOf( return listOf(
Preference.PreferenceItem.TextPreference( Preference.PreferenceItem.TextPreference(
@ -160,7 +160,7 @@ object SettingsAdvancedScreen : SearchableSettings {
), ),
// KMK --> // KMK -->
Preference.PreferenceItem.MultiSelectListPreference( Preference.PreferenceItem.MultiSelectListPreference(
preference = unsortedPreferences.appShouldAutoUpdate(), preference = exhPreferences.appShouldAutoUpdate(),
entries = persistentMapOf( entries = persistentMapOf(
AppUpdatePolicy.DEVICE_ONLY_ON_WIFI to stringResource(MR.strings.connected_to_wifi), AppUpdatePolicy.DEVICE_ONLY_ON_WIFI to stringResource(MR.strings.connected_to_wifi),
AppUpdatePolicy.DEVICE_NETWORK_NOT_METERED to stringResource(MR.strings.network_not_metered), AppUpdatePolicy.DEVICE_NETWORK_NOT_METERED to stringResource(MR.strings.network_not_metered),
@ -736,14 +736,14 @@ object SettingsAdvancedScreen : SearchableSettings {
val context = LocalContext.current val context = LocalContext.current
val navigator = LocalNavigator.currentOrThrow val navigator = LocalNavigator.currentOrThrow
val sourcePreferences = remember { Injekt.get<SourcePreferences>() } val sourcePreferences = remember { Injekt.get<SourcePreferences>() }
val unsortedPreferences = remember { Injekt.get<UnsortedPreferences>() } val exhPreferences = remember { Injekt.get<ExhPreferences>() }
val delegateSourcePreferences = remember { Injekt.get<DelegateSourcePreferences>() } val delegateSourcePreferences = remember { Injekt.get<DelegateSourcePreferences>() }
val securityPreferences = remember { Injekt.get<SecurityPreferences>() } val securityPreferences = remember { Injekt.get<SecurityPreferences>() }
return Preference.PreferenceGroup( return Preference.PreferenceGroup(
title = stringResource(SYMR.strings.developer_tools), title = stringResource(SYMR.strings.developer_tools),
preferenceItems = persistentListOf( preferenceItems = persistentListOf(
Preference.PreferenceItem.SwitchPreference( Preference.PreferenceItem.SwitchPreference(
preference = unsortedPreferences.isHentaiEnabled(), preference = exhPreferences.isHentaiEnabled(),
title = stringResource(SYMR.strings.toggle_hentai_features), title = stringResource(SYMR.strings.toggle_hentai_features),
subtitle = stringResource(SYMR.strings.toggle_hentai_features_summary), subtitle = stringResource(SYMR.strings.toggle_hentai_features_summary),
onValueChanged = { onValueChanged = {
@ -769,7 +769,7 @@ object SettingsAdvancedScreen : SearchableSettings {
), ),
), ),
Preference.PreferenceItem.ListPreference( Preference.PreferenceItem.ListPreference(
preference = unsortedPreferences.logLevel(), preference = exhPreferences.logLevel(),
entries = EHLogLevel.entries.mapIndexed { index, ehLogLevel -> entries = EHLogLevel.entries.mapIndexed { index, ehLogLevel ->
index to "${context.stringResource(ehLogLevel.nameRes)} (${ index to "${context.stringResource(ehLogLevel.nameRes)} (${
context.stringResource(ehLogLevel.description) context.stringResource(ehLogLevel.description)

View file

@ -20,7 +20,6 @@ import eu.kanade.tachiyomi.util.system.AuthenticatorUtil.authenticate
import kotlinx.collections.immutable.persistentListOf import kotlinx.collections.immutable.persistentListOf
import mihon.domain.extensionrepo.interactor.GetExtensionRepoCount import mihon.domain.extensionrepo.interactor.GetExtensionRepoCount
import tachiyomi.core.common.i18n.stringResource import tachiyomi.core.common.i18n.stringResource
import tachiyomi.domain.UnsortedPreferences
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.i18n.kmk.KMR import tachiyomi.i18n.kmk.KMR
import tachiyomi.i18n.sy.SYMR import tachiyomi.i18n.sy.SYMR
@ -51,7 +50,6 @@ object SettingsBrowseScreen : SearchableSettings {
val scope = rememberCoroutineScope() val scope = rememberCoroutineScope()
val hideFeedTab by remember { Injekt.get<UiPreferences>().hideFeedTab().asState(scope) } val hideFeedTab by remember { Injekt.get<UiPreferences>().hideFeedTab().asState(scope) }
val uiPreferences = remember { Injekt.get<UiPreferences>() } val uiPreferences = remember { Injekt.get<UiPreferences>() }
val unsortedPreferences = remember { Injekt.get<UnsortedPreferences>() }
// SY <-- // SY <--
// KMK --> // KMK -->
val relatedMangasInOverflow by uiPreferences.expandRelatedMangas().collectAsState() val relatedMangasInOverflow by uiPreferences.expandRelatedMangas().collectAsState()
@ -107,7 +105,7 @@ object SettingsBrowseScreen : SearchableSettings {
subtitle = stringResource(SYMR.strings.pref_source_navigation_summery), subtitle = stringResource(SYMR.strings.pref_source_navigation_summery),
), ),
Preference.PreferenceItem.SwitchPreference( Preference.PreferenceItem.SwitchPreference(
preference = unsortedPreferences.allowLocalSourceHiddenFolders(), preference = sourcePreferences.allowLocalSourceHiddenFolders(),
title = stringResource(SYMR.strings.pref_local_source_hidden_folders), title = stringResource(SYMR.strings.pref_local_source_hidden_folders),
subtitle = stringResource(SYMR.strings.pref_local_source_hidden_folders_summery), subtitle = stringResource(SYMR.strings.pref_local_source_hidden_folders_summery),
), ),
@ -167,6 +165,24 @@ object SettingsBrowseScreen : SearchableSettings {
Preference.PreferenceItem.InfoPreference(stringResource(MR.strings.parental_controls_info)), Preference.PreferenceItem.InfoPreference(stringResource(MR.strings.parental_controls_info)),
), ),
), ),
getMigrationCategory(sourcePreferences),
)
}
@Composable
fun getMigrationCategory(sourcePreferences: SourcePreferences): Preference.PreferenceGroup {
val skipPreMigration by sourcePreferences.skipPreMigration().collectAsState()
val migrationSources by sourcePreferences.migrationSources().collectAsState()
return Preference.PreferenceGroup(
stringResource(SYMR.strings.migration),
enabled = skipPreMigration || migrationSources.isNotEmpty(),
preferenceItems = persistentListOf(
Preference.PreferenceItem.SwitchPreference(
preference = sourcePreferences.skipPreMigration(),
title = stringResource(SYMR.strings.skip_pre_migration),
subtitle = stringResource(SYMR.strings.pref_skip_pre_migration_summary),
),
),
) )
} }
} }

View file

@ -53,6 +53,7 @@ import exh.eh.EHentaiUpdateWorkerConstants
import exh.eh.EHentaiUpdaterStats import exh.eh.EHentaiUpdaterStats
import exh.metadata.metadata.EHentaiSearchMetadata import exh.metadata.metadata.EHentaiSearchMetadata
import exh.source.EH_PACKAGE import exh.source.EH_PACKAGE
import exh.source.ExhPreferences
import exh.ui.login.EhLoginActivity import exh.ui.login.EhLoginActivity
import exh.util.nullIfBlank import exh.util.nullIfBlank
import kotlinx.collections.immutable.persistentListOf import kotlinx.collections.immutable.persistentListOf
@ -65,7 +66,6 @@ import tachiyomi.core.common.util.lang.launchNonCancellable
import tachiyomi.core.common.util.lang.withIOContext import tachiyomi.core.common.util.lang.withIOContext
import tachiyomi.core.common.util.lang.withUIContext import tachiyomi.core.common.util.lang.withUIContext
import tachiyomi.core.common.util.system.logcat import tachiyomi.core.common.util.system.logcat
import tachiyomi.domain.UnsortedPreferences
import tachiyomi.domain.library.service.LibraryPreferences.Companion.DEVICE_CHARGING import tachiyomi.domain.library.service.LibraryPreferences.Companion.DEVICE_CHARGING
import tachiyomi.domain.library.service.LibraryPreferences.Companion.DEVICE_ONLY_ON_WIFI import tachiyomi.domain.library.service.LibraryPreferences.Companion.DEVICE_ONLY_ON_WIFI
import tachiyomi.domain.manga.interactor.DeleteFavoriteEntries import tachiyomi.domain.manga.interactor.DeleteFavoriteEntries
@ -91,22 +91,22 @@ object SettingsEhScreen : SearchableSettings {
@Composable @Composable
override fun getTitleRes() = SYMR.strings.pref_category_eh override fun getTitleRes() = SYMR.strings.pref_category_eh
override fun isEnabled(): Boolean = Injekt.get<UnsortedPreferences>().isHentaiEnabled().get() override fun isEnabled(): Boolean = Injekt.get<ExhPreferences>().isHentaiEnabled().get()
@Composable @Composable
fun Reconfigure( fun Reconfigure(
unsortedPreferences: UnsortedPreferences, exhPreferences: ExhPreferences,
openWarnConfigureDialogController: () -> Unit, openWarnConfigureDialogController: () -> Unit,
) { ) {
var initialLoadGuard by remember { mutableStateOf(false) } var initialLoadGuard by remember { mutableStateOf(false) }
val useHentaiAtHome by unsortedPreferences.useHentaiAtHome().collectAsState() val useHentaiAtHome by exhPreferences.useHentaiAtHome().collectAsState()
val useJapaneseTitle by unsortedPreferences.useJapaneseTitle().collectAsState() val useJapaneseTitle by exhPreferences.useJapaneseTitle().collectAsState()
val useOriginalImages by unsortedPreferences.exhUseOriginalImages().collectAsState() val useOriginalImages by exhPreferences.exhUseOriginalImages().collectAsState()
val ehTagFilterValue by unsortedPreferences.ehTagFilterValue().collectAsState() val ehTagFilterValue by exhPreferences.ehTagFilterValue().collectAsState()
val ehTagWatchingValue by unsortedPreferences.ehTagWatchingValue().collectAsState() val ehTagWatchingValue by exhPreferences.ehTagWatchingValue().collectAsState()
val settingsLanguages by unsortedPreferences.exhSettingsLanguages().collectAsState() val settingsLanguages by exhPreferences.exhSettingsLanguages().collectAsState()
val enabledCategories by unsortedPreferences.exhEnabledCategories().collectAsState() val enabledCategories by exhPreferences.exhEnabledCategories().collectAsState()
val imageQuality by unsortedPreferences.imageQuality().collectAsState() val imageQuality by exhPreferences.imageQuality().collectAsState()
DisposableEffect( DisposableEffect(
useHentaiAtHome, useHentaiAtHome,
useJapaneseTitle, useJapaneseTitle,
@ -127,15 +127,15 @@ object SettingsEhScreen : SearchableSettings {
@Composable @Composable
override fun getPreferences(): List<Preference> { override fun getPreferences(): List<Preference> {
val unsortedPreferences: UnsortedPreferences = remember { Injekt.get() } val exhPreferences: ExhPreferences = remember { Injekt.get() }
val getFlatMetadataById: GetFlatMetadataById = remember { Injekt.get() } val getFlatMetadataById: GetFlatMetadataById = remember { Injekt.get() }
val deleteFavoriteEntries: DeleteFavoriteEntries = remember { Injekt.get() } val deleteFavoriteEntries: DeleteFavoriteEntries = remember { Injekt.get() }
val getExhFavoriteMangaWithMetadata: GetExhFavoriteMangaWithMetadata = remember { Injekt.get() } val getExhFavoriteMangaWithMetadata: GetExhFavoriteMangaWithMetadata = remember { Injekt.get() }
val exhentaiEnabled by unsortedPreferences.enableExhentai().collectAsState() val exhentaiEnabled by exhPreferences.enableExhentai().collectAsState()
var runConfigureDialog by remember { mutableStateOf(false) } var runConfigureDialog by remember { mutableStateOf(false) }
val openWarnConfigureDialogController = { runConfigureDialog = true } val openWarnConfigureDialogController = { runConfigureDialog = true }
Reconfigure(unsortedPreferences, openWarnConfigureDialogController) Reconfigure(exhPreferences, openWarnConfigureDialogController)
ConfigureExhDialog(run = runConfigureDialog, onRunning = { runConfigureDialog = false }) ConfigureExhDialog(run = runConfigureDialog, onRunning = { runConfigureDialog = false })
@ -144,43 +144,43 @@ object SettingsEhScreen : SearchableSettings {
Preference.PreferenceGroup( Preference.PreferenceGroup(
stringResource(MR.strings.source_settings), stringResource(MR.strings.source_settings),
preferenceItems = persistentListOf( preferenceItems = persistentListOf(
ehIncognitoMode(unsortedPreferences), ehIncognitoMode(exhPreferences),
), ),
), ),
// KMK <-- // KMK <--
Preference.PreferenceGroup( Preference.PreferenceGroup(
stringResource(SYMR.strings.ehentai_prefs_account_settings), stringResource(SYMR.strings.ehentai_prefs_account_settings),
preferenceItems = persistentListOf( preferenceItems = persistentListOf(
getLoginPreference(unsortedPreferences, openWarnConfigureDialogController), getLoginPreference(exhPreferences, openWarnConfigureDialogController),
useHentaiAtHome(exhentaiEnabled, unsortedPreferences), useHentaiAtHome(exhentaiEnabled, exhPreferences),
useJapaneseTitle(exhentaiEnabled, unsortedPreferences), useJapaneseTitle(exhentaiEnabled, exhPreferences),
useOriginalImages(exhentaiEnabled, unsortedPreferences), useOriginalImages(exhentaiEnabled, exhPreferences),
watchedTags(exhentaiEnabled), watchedTags(exhentaiEnabled),
tagFilterThreshold(exhentaiEnabled, unsortedPreferences), tagFilterThreshold(exhentaiEnabled, exhPreferences),
tagWatchingThreshold(exhentaiEnabled, unsortedPreferences), tagWatchingThreshold(exhentaiEnabled, exhPreferences),
settingsLanguages(exhentaiEnabled, unsortedPreferences), settingsLanguages(exhentaiEnabled, exhPreferences),
enabledCategories(exhentaiEnabled, unsortedPreferences), enabledCategories(exhentaiEnabled, exhPreferences),
watchedListDefaultState(exhentaiEnabled, unsortedPreferences), watchedListDefaultState(exhentaiEnabled, exhPreferences),
imageQuality(exhentaiEnabled, unsortedPreferences), imageQuality(exhentaiEnabled, exhPreferences),
enhancedEhentaiView(unsortedPreferences), enhancedEhentaiView(exhPreferences),
), ),
), ),
Preference.PreferenceGroup( Preference.PreferenceGroup(
stringResource(SYMR.strings.favorites_sync), stringResource(SYMR.strings.favorites_sync),
preferenceItems = persistentListOf( preferenceItems = persistentListOf(
readOnlySync(unsortedPreferences), readOnlySync(exhPreferences),
syncFavoriteNotes(), syncFavoriteNotes(),
lenientSync(unsortedPreferences), lenientSync(exhPreferences),
forceSyncReset(deleteFavoriteEntries), forceSyncReset(deleteFavoriteEntries),
), ),
), ),
Preference.PreferenceGroup( Preference.PreferenceGroup(
stringResource(SYMR.strings.gallery_update_checker), stringResource(SYMR.strings.gallery_update_checker),
preferenceItems = persistentListOf( preferenceItems = persistentListOf(
updateCheckerFrequency(unsortedPreferences), updateCheckerFrequency(exhPreferences),
autoUpdateRequirements(unsortedPreferences), autoUpdateRequirements(exhPreferences),
updaterStatistics( updaterStatistics(
unsortedPreferences, exhPreferences,
getExhFavoriteMangaWithMetadata, getExhFavoriteMangaWithMetadata,
getFlatMetadataById, getFlatMetadataById,
), ),
@ -192,10 +192,10 @@ object SettingsEhScreen : SearchableSettings {
// KMK --> // KMK -->
@Composable @Composable
fun ehIncognitoMode( fun ehIncognitoMode(
unsortedPreferences: UnsortedPreferences, exhPreferences: ExhPreferences,
): Preference.PreferenceItem.SwitchPreference { ): Preference.PreferenceItem.SwitchPreference {
return Preference.PreferenceItem.SwitchPreference( return Preference.PreferenceItem.SwitchPreference(
preference = unsortedPreferences.ehIncognitoMode(), preference = exhPreferences.ehIncognitoMode(),
title = stringResource(MR.strings.pref_incognito_mode), title = stringResource(MR.strings.pref_incognito_mode),
subtitle = stringResource(MR.strings.pref_incognito_mode_summary), subtitle = stringResource(MR.strings.pref_incognito_mode_summary),
onValueChanged = { newVal -> onValueChanged = { newVal ->
@ -209,7 +209,7 @@ object SettingsEhScreen : SearchableSettings {
@Composable @Composable
fun getLoginPreference( fun getLoginPreference(
unsortedPreferences: UnsortedPreferences, exhPreferences: ExhPreferences,
openWarnConfigureDialogController: () -> Unit, openWarnConfigureDialogController: () -> Unit,
): Preference.PreferenceItem.SwitchPreference { ): Preference.PreferenceItem.SwitchPreference {
val activityResultContract = val activityResultContract =
@ -220,9 +220,9 @@ object SettingsEhScreen : SearchableSettings {
} }
} }
val context = LocalContext.current val context = LocalContext.current
val value by unsortedPreferences.enableExhentai().collectAsState() val value by exhPreferences.enableExhentai().collectAsState()
return Preference.PreferenceItem.SwitchPreference( return Preference.PreferenceItem.SwitchPreference(
preference = unsortedPreferences.enableExhentai(), preference = exhPreferences.enableExhentai(),
title = stringResource(SYMR.strings.enable_exhentai), title = stringResource(SYMR.strings.enable_exhentai),
subtitle = if (!value) { subtitle = if (!value) {
stringResource(SYMR.strings.requires_login) stringResource(SYMR.strings.requires_login)
@ -231,7 +231,7 @@ object SettingsEhScreen : SearchableSettings {
}, },
onValueChanged = { newVal -> onValueChanged = { newVal ->
if (!newVal) { if (!newVal) {
unsortedPreferences.enableExhentai().set(false) exhPreferences.enableExhentai().set(false)
true true
} else { } else {
activityResultContract.launch(EhLoginActivity.newIntent(context)) activityResultContract.launch(EhLoginActivity.newIntent(context))
@ -244,10 +244,10 @@ object SettingsEhScreen : SearchableSettings {
@Composable @Composable
fun useHentaiAtHome( fun useHentaiAtHome(
exhentaiEnabled: Boolean, exhentaiEnabled: Boolean,
unsortedPreferences: UnsortedPreferences, exhPreferences: ExhPreferences,
): Preference.PreferenceItem.ListPreference<Int> { ): Preference.PreferenceItem.ListPreference<Int> {
return Preference.PreferenceItem.ListPreference( return Preference.PreferenceItem.ListPreference(
preference = unsortedPreferences.useHentaiAtHome(), preference = exhPreferences.useHentaiAtHome(),
entries = persistentMapOf( entries = persistentMapOf(
0 to stringResource(SYMR.strings.use_hentai_at_home_option_1), 0 to stringResource(SYMR.strings.use_hentai_at_home_option_1),
1 to stringResource(SYMR.strings.use_hentai_at_home_option_2), 1 to stringResource(SYMR.strings.use_hentai_at_home_option_2),
@ -261,11 +261,11 @@ object SettingsEhScreen : SearchableSettings {
@Composable @Composable
fun useJapaneseTitle( fun useJapaneseTitle(
exhentaiEnabled: Boolean, exhentaiEnabled: Boolean,
unsortedPreferences: UnsortedPreferences, exhPreferences: ExhPreferences,
): Preference.PreferenceItem.SwitchPreference { ): Preference.PreferenceItem.SwitchPreference {
val value by unsortedPreferences.useJapaneseTitle().collectAsState() val value by exhPreferences.useJapaneseTitle().collectAsState()
return Preference.PreferenceItem.SwitchPreference( return Preference.PreferenceItem.SwitchPreference(
preference = unsortedPreferences.useJapaneseTitle(), preference = exhPreferences.useJapaneseTitle(),
title = stringResource(SYMR.strings.show_japanese_titles), title = stringResource(SYMR.strings.show_japanese_titles),
subtitle = if (value) { subtitle = if (value) {
stringResource(SYMR.strings.show_japanese_titles_option_1) stringResource(SYMR.strings.show_japanese_titles_option_1)
@ -279,11 +279,11 @@ object SettingsEhScreen : SearchableSettings {
@Composable @Composable
fun useOriginalImages( fun useOriginalImages(
exhentaiEnabled: Boolean, exhentaiEnabled: Boolean,
unsortedPreferences: UnsortedPreferences, exhPreferences: ExhPreferences,
): Preference.PreferenceItem.SwitchPreference { ): Preference.PreferenceItem.SwitchPreference {
val value by unsortedPreferences.exhUseOriginalImages().collectAsState() val value by exhPreferences.exhUseOriginalImages().collectAsState()
return Preference.PreferenceItem.SwitchPreference( return Preference.PreferenceItem.SwitchPreference(
preference = unsortedPreferences.exhUseOriginalImages(), preference = exhPreferences.exhUseOriginalImages(),
title = stringResource(SYMR.strings.use_original_images), title = stringResource(SYMR.strings.use_original_images),
subtitle = if (value) { subtitle = if (value) {
stringResource(SYMR.strings.use_original_images_on) stringResource(SYMR.strings.use_original_images_on)
@ -379,9 +379,9 @@ object SettingsEhScreen : SearchableSettings {
@Composable @Composable
fun tagFilterThreshold( fun tagFilterThreshold(
exhentaiEnabled: Boolean, exhentaiEnabled: Boolean,
unsortedPreferences: UnsortedPreferences, exhPreferences: ExhPreferences,
): Preference.PreferenceItem.TextPreference { ): Preference.PreferenceItem.TextPreference {
val value by unsortedPreferences.ehTagFilterValue().collectAsState() val value by exhPreferences.ehTagFilterValue().collectAsState()
var dialogOpen by remember { mutableStateOf(false) } var dialogOpen by remember { mutableStateOf(false) }
if (dialogOpen) { if (dialogOpen) {
TagThresholdDialog( TagThresholdDialog(
@ -392,7 +392,7 @@ object SettingsEhScreen : SearchableSettings {
outsideRangeError = stringResource(SYMR.strings.tag_filtering_threshhold_error), outsideRangeError = stringResource(SYMR.strings.tag_filtering_threshhold_error),
onValueChange = { onValueChange = {
dialogOpen = false dialogOpen = false
unsortedPreferences.ehTagFilterValue().set(it) exhPreferences.ehTagFilterValue().set(it)
}, },
) )
} }
@ -409,9 +409,9 @@ object SettingsEhScreen : SearchableSettings {
@Composable @Composable
fun tagWatchingThreshold( fun tagWatchingThreshold(
exhentaiEnabled: Boolean, exhentaiEnabled: Boolean,
unsortedPreferences: UnsortedPreferences, exhPreferences: ExhPreferences,
): Preference.PreferenceItem.TextPreference { ): Preference.PreferenceItem.TextPreference {
val value by unsortedPreferences.ehTagWatchingValue().collectAsState() val value by exhPreferences.ehTagWatchingValue().collectAsState()
var dialogOpen by remember { mutableStateOf(false) } var dialogOpen by remember { mutableStateOf(false) }
if (dialogOpen) { if (dialogOpen) {
TagThresholdDialog( TagThresholdDialog(
@ -422,7 +422,7 @@ object SettingsEhScreen : SearchableSettings {
outsideRangeError = stringResource(SYMR.strings.tag_watching_threshhold_error), outsideRangeError = stringResource(SYMR.strings.tag_watching_threshhold_error),
onValueChange = { onValueChange = {
dialogOpen = false dialogOpen = false
unsortedPreferences.ehTagWatchingValue().set(it) exhPreferences.ehTagWatchingValue().set(it)
}, },
) )
} }
@ -632,9 +632,9 @@ object SettingsEhScreen : SearchableSettings {
@Composable @Composable
fun settingsLanguages( fun settingsLanguages(
exhentaiEnabled: Boolean, exhentaiEnabled: Boolean,
unsortedPreferences: UnsortedPreferences, exhPreferences: ExhPreferences,
): Preference.PreferenceItem.TextPreference { ): Preference.PreferenceItem.TextPreference {
val value by unsortedPreferences.exhSettingsLanguages().collectAsState() val value by exhPreferences.exhSettingsLanguages().collectAsState()
var dialogOpen by remember { mutableStateOf(false) } var dialogOpen by remember { mutableStateOf(false) }
if (dialogOpen) { if (dialogOpen) {
LanguagesDialog( LanguagesDialog(
@ -642,7 +642,7 @@ object SettingsEhScreen : SearchableSettings {
initialValue = value, initialValue = value,
onValueChange = { onValueChange = {
dialogOpen = false dialogOpen = false
unsortedPreferences.exhSettingsLanguages().set(it) exhPreferences.exhSettingsLanguages().set(it)
}, },
) )
} }
@ -798,9 +798,9 @@ object SettingsEhScreen : SearchableSettings {
@Composable @Composable
fun enabledCategories( fun enabledCategories(
exhentaiEnabled: Boolean, exhentaiEnabled: Boolean,
unsortedPreferences: UnsortedPreferences, exhPreferences: ExhPreferences,
): Preference.PreferenceItem.TextPreference { ): Preference.PreferenceItem.TextPreference {
val value by unsortedPreferences.exhEnabledCategories().collectAsState() val value by exhPreferences.exhEnabledCategories().collectAsState()
var dialogOpen by remember { mutableStateOf(false) } var dialogOpen by remember { mutableStateOf(false) }
if (dialogOpen) { if (dialogOpen) {
FrontPageCategoriesDialog( FrontPageCategoriesDialog(
@ -808,7 +808,7 @@ object SettingsEhScreen : SearchableSettings {
initialValue = value, initialValue = value,
onValueChange = { onValueChange = {
dialogOpen = false dialogOpen = false
unsortedPreferences.exhEnabledCategories().set(it) exhPreferences.exhEnabledCategories().set(it)
}, },
) )
} }
@ -825,10 +825,10 @@ object SettingsEhScreen : SearchableSettings {
@Composable @Composable
fun watchedListDefaultState( fun watchedListDefaultState(
exhentaiEnabled: Boolean, exhentaiEnabled: Boolean,
unsortedPreferences: UnsortedPreferences, exhPreferences: ExhPreferences,
): Preference.PreferenceItem.SwitchPreference { ): Preference.PreferenceItem.SwitchPreference {
return Preference.PreferenceItem.SwitchPreference( return Preference.PreferenceItem.SwitchPreference(
preference = unsortedPreferences.exhWatchedListDefaultState(), preference = exhPreferences.exhWatchedListDefaultState(),
title = stringResource(SYMR.strings.watched_list_default), title = stringResource(SYMR.strings.watched_list_default),
subtitle = stringResource(SYMR.strings.watched_list_state_summary), subtitle = stringResource(SYMR.strings.watched_list_state_summary),
enabled = exhentaiEnabled, enabled = exhentaiEnabled,
@ -838,10 +838,10 @@ object SettingsEhScreen : SearchableSettings {
@Composable @Composable
fun imageQuality( fun imageQuality(
exhentaiEnabled: Boolean, exhentaiEnabled: Boolean,
unsortedPreferences: UnsortedPreferences, exhPreferences: ExhPreferences,
): Preference.PreferenceItem.ListPreference<String> { ): Preference.PreferenceItem.ListPreference<String> {
return Preference.PreferenceItem.ListPreference( return Preference.PreferenceItem.ListPreference(
preference = unsortedPreferences.imageQuality(), preference = exhPreferences.imageQuality(),
entries = persistentMapOf( entries = persistentMapOf(
"auto" to stringResource(SYMR.strings.eh_image_quality_auto), "auto" to stringResource(SYMR.strings.eh_image_quality_auto),
"ovrs_2400" to stringResource(SYMR.strings.eh_image_quality_2400), "ovrs_2400" to stringResource(SYMR.strings.eh_image_quality_2400),
@ -857,18 +857,18 @@ object SettingsEhScreen : SearchableSettings {
} }
@Composable @Composable
fun enhancedEhentaiView(unsortedPreferences: UnsortedPreferences): Preference.PreferenceItem.SwitchPreference { fun enhancedEhentaiView(exhPreferences: ExhPreferences): Preference.PreferenceItem.SwitchPreference {
return Preference.PreferenceItem.SwitchPreference( return Preference.PreferenceItem.SwitchPreference(
preference = unsortedPreferences.enhancedEHentaiView(), preference = exhPreferences.enhancedEHentaiView(),
title = stringResource(SYMR.strings.pref_enhanced_e_hentai_view), title = stringResource(SYMR.strings.pref_enhanced_e_hentai_view),
subtitle = stringResource(SYMR.strings.pref_enhanced_e_hentai_view_summary), subtitle = stringResource(SYMR.strings.pref_enhanced_e_hentai_view_summary),
) )
} }
@Composable @Composable
fun readOnlySync(unsortedPreferences: UnsortedPreferences): Preference.PreferenceItem.SwitchPreference { fun readOnlySync(exhPreferences: ExhPreferences): Preference.PreferenceItem.SwitchPreference {
return Preference.PreferenceItem.SwitchPreference( return Preference.PreferenceItem.SwitchPreference(
preference = unsortedPreferences.exhReadOnlySync(), preference = exhPreferences.exhReadOnlySync(),
title = stringResource(SYMR.strings.disable_favorites_uploading), title = stringResource(SYMR.strings.disable_favorites_uploading),
subtitle = stringResource(SYMR.strings.disable_favorites_uploading_summary), subtitle = stringResource(SYMR.strings.disable_favorites_uploading_summary),
) )
@ -891,9 +891,9 @@ object SettingsEhScreen : SearchableSettings {
} }
@Composable @Composable
fun lenientSync(unsortedPreferences: UnsortedPreferences): Preference.PreferenceItem.SwitchPreference { fun lenientSync(exhPreferences: ExhPreferences): Preference.PreferenceItem.SwitchPreference {
return Preference.PreferenceItem.SwitchPreference( return Preference.PreferenceItem.SwitchPreference(
preference = unsortedPreferences.exhLenientSync(), preference = exhPreferences.exhLenientSync(),
title = stringResource(SYMR.strings.ignore_sync_errors), title = stringResource(SYMR.strings.ignore_sync_errors),
subtitle = stringResource(SYMR.strings.ignore_sync_errors_summary), subtitle = stringResource(SYMR.strings.ignore_sync_errors_summary),
) )
@ -963,12 +963,12 @@ object SettingsEhScreen : SearchableSettings {
@Composable @Composable
fun updateCheckerFrequency( fun updateCheckerFrequency(
unsortedPreferences: UnsortedPreferences, exhPreferences: ExhPreferences,
): Preference.PreferenceItem.ListPreference<Int> { ): Preference.PreferenceItem.ListPreference<Int> {
val value by unsortedPreferences.exhAutoUpdateFrequency().collectAsState() val value by exhPreferences.exhAutoUpdateFrequency().collectAsState()
val context = LocalContext.current val context = LocalContext.current
return Preference.PreferenceItem.ListPreference( return Preference.PreferenceItem.ListPreference(
preference = unsortedPreferences.exhAutoUpdateFrequency(), preference = exhPreferences.exhAutoUpdateFrequency(),
entries = persistentMapOf( entries = persistentMapOf(
0 to stringResource(SYMR.strings.time_between_batches_never), 0 to stringResource(SYMR.strings.time_between_batches_never),
1 to stringResource(SYMR.strings.time_between_batches_1_hour), 1 to stringResource(SYMR.strings.time_between_batches_1_hour),
@ -999,12 +999,12 @@ object SettingsEhScreen : SearchableSettings {
@Composable @Composable
fun autoUpdateRequirements( fun autoUpdateRequirements(
unsortedPreferences: UnsortedPreferences, exhPreferences: ExhPreferences,
): Preference.PreferenceItem.MultiSelectListPreference { ): Preference.PreferenceItem.MultiSelectListPreference {
val value by unsortedPreferences.exhAutoUpdateRequirements().collectAsState() val value by exhPreferences.exhAutoUpdateRequirements().collectAsState()
val context = LocalContext.current val context = LocalContext.current
return Preference.PreferenceItem.MultiSelectListPreference( return Preference.PreferenceItem.MultiSelectListPreference(
preference = unsortedPreferences.exhAutoUpdateRequirements(), preference = exhPreferences.exhAutoUpdateRequirements(),
entries = persistentMapOf( entries = persistentMapOf(
DEVICE_ONLY_ON_WIFI to stringResource(MR.strings.connected_to_wifi), DEVICE_ONLY_ON_WIFI to stringResource(MR.strings.connected_to_wifi),
DEVICE_CHARGING to stringResource(MR.strings.charging), DEVICE_CHARGING to stringResource(MR.strings.charging),
@ -1167,7 +1167,7 @@ object SettingsEhScreen : SearchableSettings {
@Composable @Composable
fun updaterStatistics( fun updaterStatistics(
unsortedPreferences: UnsortedPreferences, exhPreferences: ExhPreferences,
getExhFavoriteMangaWithMetadata: GetExhFavoriteMangaWithMetadata, getExhFavoriteMangaWithMetadata: GetExhFavoriteMangaWithMetadata,
getFlatMetadataById: GetFlatMetadataById, getFlatMetadataById: GetFlatMetadataById,
): Preference.PreferenceItem.TextPreference { ): Preference.PreferenceItem.TextPreference {
@ -1178,7 +1178,7 @@ object SettingsEhScreen : SearchableSettings {
value = withIOContext { value = withIOContext {
try { try {
val stats = val stats =
unsortedPreferences.exhAutoUpdateStats().get().nullIfBlank()?.let { exhPreferences.exhAutoUpdateStats().get().nullIfBlank()?.let {
Json.decodeFromString<EHentaiUpdaterStats>(it) Json.decodeFromString<EHentaiUpdaterStats>(it)
} }

View file

@ -25,7 +25,6 @@ import kotlinx.collections.immutable.persistentListOf
import kotlinx.collections.immutable.persistentMapOf import kotlinx.collections.immutable.persistentMapOf
import kotlinx.collections.immutable.toImmutableMap import kotlinx.collections.immutable.toImmutableMap
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import tachiyomi.domain.UnsortedPreferences
import tachiyomi.domain.category.interactor.GetCategories import tachiyomi.domain.category.interactor.GetCategories
import tachiyomi.domain.category.interactor.ResetCategoryFlags import tachiyomi.domain.category.interactor.ResetCategoryFlags
import tachiyomi.domain.category.model.Category import tachiyomi.domain.category.model.Category
@ -62,9 +61,6 @@ object SettingsLibraryScreen : SearchableSettings {
val getCategories = remember { Injekt.get<GetCategories>() } val getCategories = remember { Injekt.get<GetCategories>() }
val libraryPreferences = remember { Injekt.get<LibraryPreferences>() } val libraryPreferences = remember { Injekt.get<LibraryPreferences>() }
val allCategories by getCategories.subscribe().collectAsState(initial = emptyList()) val allCategories by getCategories.subscribe().collectAsState(initial = emptyList())
// SY -->
val unsortedPreferences = remember { Injekt.get<UnsortedPreferences>() }
// SY <--
return listOf( return listOf(
getCategoriesGroup(LocalNavigator.currentOrThrow, allCategories, libraryPreferences), getCategoriesGroup(LocalNavigator.currentOrThrow, allCategories, libraryPreferences),
@ -72,7 +68,6 @@ object SettingsLibraryScreen : SearchableSettings {
getBehaviorGroup(libraryPreferences), getBehaviorGroup(libraryPreferences),
// SY --> // SY -->
getSortingCategory(LocalNavigator.currentOrThrow, libraryPreferences), getSortingCategory(LocalNavigator.currentOrThrow, libraryPreferences),
getMigrationCategory(unsortedPreferences),
// SY <-- // SY <--
) )
} }
@ -319,22 +314,5 @@ object SettingsLibraryScreen : SearchableSettings {
), ),
) )
} }
@Composable
fun getMigrationCategory(unsortedPreferences: UnsortedPreferences): Preference.PreferenceGroup {
val skipPreMigration by unsortedPreferences.skipPreMigration().collectAsState()
val migrationSources by unsortedPreferences.migrationSources().collectAsState()
return Preference.PreferenceGroup(
stringResource(SYMR.strings.migration),
enabled = skipPreMigration || migrationSources.isNotEmpty(),
preferenceItems = persistentListOf(
Preference.PreferenceItem.SwitchPreference(
preference = unsortedPreferences.skipPreMigration(),
title = stringResource(SYMR.strings.skip_pre_migration),
subtitle = stringResource(SYMR.strings.pref_skip_pre_migration_summary),
),
),
)
}
// SY <-- // SY <--
} }

View file

@ -45,7 +45,6 @@ import logcat.LogPriority
import tachiyomi.core.common.util.lang.launchIO import tachiyomi.core.common.util.lang.launchIO
import tachiyomi.core.common.util.lang.withUIContext import tachiyomi.core.common.util.lang.withUIContext
import tachiyomi.core.common.util.system.logcat import tachiyomi.core.common.util.system.logcat
import tachiyomi.domain.UnsortedPreferences
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.components.material.padding
@ -68,14 +67,13 @@ object SettingsMangadexScreen : SearchableSettings {
@Composable @Composable
override fun getPreferences(): List<Preference> { override fun getPreferences(): List<Preference> {
val sourcePreferences: SourcePreferences = remember { Injekt.get() } val sourcePreferences: SourcePreferences = remember { Injekt.get() }
val unsortedPreferences: UnsortedPreferences = remember { Injekt.get() }
val trackPreferences: TrackPreferences = remember { Injekt.get() } val trackPreferences: TrackPreferences = remember { Injekt.get() }
val mdex = remember { MdUtil.getEnabledMangaDex(unsortedPreferences, sourcePreferences) } ?: return emptyList() val mdex = remember { MdUtil.getEnabledMangaDex(sourcePreferences) } ?: return emptyList()
return listOf( return listOf(
loginPreference(mdex, trackPreferences), loginPreference(mdex, trackPreferences),
preferredMangaDexId(unsortedPreferences, sourcePreferences), preferredMangaDexId(sourcePreferences),
syncMangaDexIntoThis(unsortedPreferences), syncMangaDexIntoThis(sourcePreferences),
syncLibraryToMangaDex(), syncLibraryToMangaDex(),
) )
} }
@ -177,11 +175,10 @@ object SettingsMangadexScreen : SearchableSettings {
@Composable @Composable
fun preferredMangaDexId( fun preferredMangaDexId(
unsortedPreferences: UnsortedPreferences,
sourcePreferences: SourcePreferences, sourcePreferences: SourcePreferences,
): Preference.PreferenceItem.ListPreference<String> { ): Preference.PreferenceItem.ListPreference<String> {
return Preference.PreferenceItem.ListPreference( return Preference.PreferenceItem.ListPreference(
preference = unsortedPreferences.preferredMangaDexId(), preference = sourcePreferences.preferredMangaDexId(),
entries = MdUtil.getEnabledMangaDexs(sourcePreferences) entries = MdUtil.getEnabledMangaDexs(sourcePreferences)
.associate { it.id.toString() to it.toString() } .associate { it.id.toString() to it.toString() }
.toImmutableMap(), .toImmutableMap(),
@ -253,7 +250,7 @@ object SettingsMangadexScreen : SearchableSettings {
} }
@Composable @Composable
fun syncMangaDexIntoThis(unsortedPreferences: UnsortedPreferences): Preference.PreferenceItem.TextPreference { fun syncMangaDexIntoThis(sourcePreferences: SourcePreferences): Preference.PreferenceItem.TextPreference {
val context = LocalContext.current val context = LocalContext.current
var dialogOpen by remember { mutableStateOf(false) } var dialogOpen by remember { mutableStateOf(false) }
if (dialogOpen) { if (dialogOpen) {
@ -261,7 +258,7 @@ object SettingsMangadexScreen : SearchableSettings {
onDismissRequest = { dialogOpen = false }, onDismissRequest = { dialogOpen = false },
onSelectionConfirmed = { items -> onSelectionConfirmed = { items ->
dialogOpen = false dialogOpen = false
unsortedPreferences.mangadexSyncToLibraryIndexes().set( sourcePreferences.mangadexSyncToLibraryIndexes().set(
List(items.size) { index -> (index + 1).toString() }.toSet(), List(items.size) { index -> (index + 1).toString() }.toSet(),
) )
LibraryUpdateJob.startNow( LibraryUpdateJob.startNow(

View file

@ -21,6 +21,7 @@ import androidx.work.workDataOf
import eu.kanade.domain.chapter.interactor.SyncChaptersWithSource import eu.kanade.domain.chapter.interactor.SyncChaptersWithSource
import eu.kanade.domain.manga.interactor.UpdateManga import eu.kanade.domain.manga.interactor.UpdateManga
import eu.kanade.domain.manga.model.toSManga import eu.kanade.domain.manga.model.toSManga
import eu.kanade.domain.source.service.SourcePreferences
import eu.kanade.domain.sync.SyncPreferences import eu.kanade.domain.sync.SyncPreferences
import eu.kanade.domain.track.model.toDbTrack import eu.kanade.domain.track.model.toDbTrack
import eu.kanade.domain.track.model.toDomainTrack import eu.kanade.domain.track.model.toDomainTrack
@ -61,7 +62,6 @@ import tachiyomi.core.common.i18n.stringResource
import tachiyomi.core.common.preference.getAndSet import tachiyomi.core.common.preference.getAndSet
import tachiyomi.core.common.util.lang.withIOContext import tachiyomi.core.common.util.lang.withIOContext
import tachiyomi.core.common.util.system.logcat import tachiyomi.core.common.util.system.logcat
import tachiyomi.domain.UnsortedPreferences
import tachiyomi.domain.category.model.Category import tachiyomi.domain.category.model.Category
import tachiyomi.domain.chapter.model.Chapter import tachiyomi.domain.chapter.model.Chapter
import tachiyomi.domain.chapter.model.NoChaptersException import tachiyomi.domain.chapter.model.NoChaptersException
@ -560,7 +560,7 @@ class LibraryUpdateJob(private val context: Context, workerParams: WorkerParamet
* filter all follows from Mangadex and only add reading or rereading manga to library * filter all follows from Mangadex and only add reading or rereading manga to library
*/ */
private suspend fun syncFollows() = coroutineScope { private suspend fun syncFollows() = coroutineScope {
val preferences = Injekt.get<UnsortedPreferences>() val preferences = Injekt.get<SourcePreferences>()
var count = 0 var count = 0
val mangaDex = MdUtil.getEnabledMangaDex(preferences, sourceManager = sourceManager) val mangaDex = MdUtil.getEnabledMangaDex(preferences, sourceManager = sourceManager)
?: return@coroutineScope ?: return@coroutineScope

View file

@ -18,8 +18,6 @@ import tachiyomi.core.common.util.lang.withIOContext
import tachiyomi.domain.manga.model.Manga import tachiyomi.domain.manga.model.Manga
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR import tachiyomi.i18n.sy.SYMR
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
import tachiyomi.domain.track.model.Track as DomainTrack import tachiyomi.domain.track.model.Track as DomainTrack
class MdList(id: Long) : BaseTracker(id, "MDList") { class MdList(id: Long) : BaseTracker(id, "MDList") {
@ -30,7 +28,7 @@ class MdList(id: Long) : BaseTracker(id, "MDList") {
.toImmutableList() .toImmutableList()
} }
private val mdex by lazy { MdUtil.getEnabledMangaDex(Injekt.get()) } private val mdex by lazy { MdUtil.getEnabledMangaDex() }
val interceptor = MangaDexAuthInterceptor(trackPreferences, this) val interceptor = MangaDexAuthInterceptor(trackPreferences, this)

View file

@ -5,8 +5,8 @@ import android.os.Build
import eu.kanade.tachiyomi.BuildConfig import eu.kanade.tachiyomi.BuildConfig
import eu.kanade.tachiyomi.util.system.isFossBuildType import eu.kanade.tachiyomi.util.system.isFossBuildType
import eu.kanade.tachiyomi.util.system.isPreviewBuildType import eu.kanade.tachiyomi.util.system.isPreviewBuildType
import exh.source.ExhPreferences
import tachiyomi.core.common.util.lang.withIOContext import tachiyomi.core.common.util.lang.withIOContext
import tachiyomi.domain.UnsortedPreferences
import tachiyomi.domain.release.interactor.GetApplicationRelease import tachiyomi.domain.release.interactor.GetApplicationRelease
import tachiyomi.domain.release.service.AppUpdatePolicy import tachiyomi.domain.release.service.AppUpdatePolicy
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
@ -22,14 +22,14 @@ class AppUpdateChecker(
private val getApplicationRelease: GetApplicationRelease by injectLazy() private val getApplicationRelease: GetApplicationRelease by injectLazy()
// KMK --> // KMK -->
private val preferences by lazy { Injekt.get<UnsortedPreferences>() } private val exhPreferences by lazy { Injekt.get<ExhPreferences>() }
// KMK <-- // KMK <--
suspend fun checkForUpdate( suspend fun checkForUpdate(
context: Context, context: Context,
forceCheck: Boolean = false, forceCheck: Boolean = false,
// KMK --> // KMK -->
autoUpdate: Boolean = AppUpdatePolicy.DISABLE_AUTO_DOWNLOAD !in preferences.appShouldAutoUpdate().get(), autoUpdate: Boolean = AppUpdatePolicy.DISABLE_AUTO_DOWNLOAD !in exhPreferences.appShouldAutoUpdate().get(),
// KMK <-- // KMK <--
): GetApplicationRelease.Result { ): GetApplicationRelease.Result {
return withIOContext { return withIOContext {

View file

@ -31,6 +31,7 @@ import eu.kanade.tachiyomi.util.system.setForegroundSafely
import eu.kanade.tachiyomi.util.system.toast import eu.kanade.tachiyomi.util.system.toast
import eu.kanade.tachiyomi.util.system.workManager import eu.kanade.tachiyomi.util.system.workManager
import exh.log.xLogE import exh.log.xLogE
import exh.source.ExhPreferences
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.cancel import kotlinx.coroutines.cancel
import kotlinx.coroutines.coroutineScope import kotlinx.coroutines.coroutineScope
@ -41,7 +42,6 @@ import okhttp3.internal.http2.StreamResetException
import tachiyomi.core.common.i18n.stringResource import tachiyomi.core.common.i18n.stringResource
import tachiyomi.core.common.util.lang.launchUI import tachiyomi.core.common.util.lang.launchUI
import tachiyomi.core.common.util.lang.withIOContext import tachiyomi.core.common.util.lang.withIOContext
import tachiyomi.domain.UnsortedPreferences
import tachiyomi.domain.release.service.AppUpdatePolicy import tachiyomi.domain.release.service.AppUpdatePolicy
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
@ -59,7 +59,7 @@ class AppUpdateDownloadJob(private val context: Context, workerParams: WorkerPar
private val network: NetworkHelper by injectLazy() private val network: NetworkHelper by injectLazy()
// KMK --> // KMK -->
private val preferences = Injekt.get<UnsortedPreferences>() private val exhPreferences = Injekt.get<ExhPreferences>()
// KMK <-- // KMK <--
override suspend fun doWork(): Result { override suspend fun doWork(): Result {
@ -70,7 +70,7 @@ class AppUpdateDownloadJob(private val context: Context, workerParams: WorkerPar
return Result.failure() return Result.failure()
} }
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) {
val restrictions = preferences.appShouldAutoUpdate().get() val restrictions = exhPreferences.appShouldAutoUpdate().get()
if (( if ((
AppUpdatePolicy.DEVICE_ONLY_ON_WIFI in restrictions && AppUpdatePolicy.DEVICE_ONLY_ON_WIFI in restrictions &&
!context.isConnectedToWifi() !context.isConnectedToWifi()
@ -294,7 +294,7 @@ class AppUpdateDownloadJob(private val context: Context, workerParams: WorkerPar
// KMK --> // KMK -->
if (scheduled) { if (scheduled) {
data.putBoolean(SCHEDULED_RUN, true) data.putBoolean(SCHEDULED_RUN, true)
val restrictions = Injekt.get<UnsortedPreferences>().appShouldAutoUpdate().get() val restrictions = Injekt.get<ExhPreferences>().appShouldAutoUpdate().get()
val networkType = if (AppUpdatePolicy.DEVICE_NETWORK_NOT_METERED in restrictions) { val networkType = if (AppUpdatePolicy.DEVICE_NETWORK_NOT_METERED in restrictions) {
NetworkType.UNMETERED NetworkType.UNMETERED
} else { } else {

View file

@ -2,7 +2,7 @@ package eu.kanade.tachiyomi.di
import android.app.Application import android.app.Application
import exh.pref.DelegateSourcePreferences import exh.pref.DelegateSourcePreferences
import tachiyomi.domain.UnsortedPreferences import exh.source.ExhPreferences
import uy.kohesive.injekt.api.InjektModule import uy.kohesive.injekt.api.InjektModule
import uy.kohesive.injekt.api.InjektRegistrar import uy.kohesive.injekt.api.InjektRegistrar
import uy.kohesive.injekt.api.addSingletonFactory import uy.kohesive.injekt.api.addSingletonFactory
@ -18,7 +18,7 @@ class SYPreferenceModule(val application: Application) : InjektModule {
} }
addSingletonFactory { addSingletonFactory {
UnsortedPreferences(get()) ExhPreferences(get())
} }
} }
} }

View file

@ -19,6 +19,7 @@ import exh.log.xLogD
import exh.source.BlacklistedSources import exh.source.BlacklistedSources
import exh.source.EHENTAI_EXT_SOURCES import exh.source.EHENTAI_EXT_SOURCES
import exh.source.EXHENTAI_EXT_SOURCES import exh.source.EXHENTAI_EXT_SOURCES
import exh.source.ExhPreferences
import exh.source.MERGED_SOURCE_ID import exh.source.MERGED_SOURCE_ID
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.SupervisorJob import kotlinx.coroutines.SupervisorJob
@ -33,7 +34,6 @@ import kotlinx.coroutines.flow.stateIn
import logcat.LogPriority import logcat.LogPriority
import tachiyomi.core.common.util.lang.withUIContext import tachiyomi.core.common.util.lang.withUIContext
import tachiyomi.core.common.util.system.logcat import tachiyomi.core.common.util.system.logcat
import tachiyomi.domain.UnsortedPreferences
import tachiyomi.domain.source.model.StubSource import tachiyomi.domain.source.model.StubSource
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
@ -172,7 +172,7 @@ class ExtensionManager(
private fun Extension.isBlacklisted( private fun Extension.isBlacklisted(
blacklistEnabled: Boolean = preferences.enableSourceBlacklist().get(), blacklistEnabled: Boolean = preferences.enableSourceBlacklist().get(),
// KMK --> // KMK -->
isHentaiEnabled: Boolean = Injekt.get<UnsortedPreferences>().isHentaiEnabled().get(), isHentaiEnabled: Boolean = Injekt.get<ExhPreferences>().isHentaiEnabled().get(),
// KMK <-- // KMK <--
): Boolean { ): Boolean {
return pkgName in BlacklistedSources.BLACKLISTED_EXTENSIONS && return pkgName in BlacklistedSources.BLACKLISTED_EXTENSIONS &&

View file

@ -11,6 +11,7 @@ import eu.kanade.tachiyomi.network.NetworkHelper
import eu.kanade.tachiyomi.network.awaitSuccess import eu.kanade.tachiyomi.network.awaitSuccess
import eu.kanade.tachiyomi.network.parseAs import eu.kanade.tachiyomi.network.parseAs
import exh.source.BlacklistedSources import exh.source.BlacklistedSources
import exh.source.ExhPreferences
import kotlinx.coroutines.async import kotlinx.coroutines.async
import kotlinx.coroutines.awaitAll import kotlinx.coroutines.awaitAll
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
@ -23,7 +24,6 @@ import tachiyomi.core.common.preference.Preference
import tachiyomi.core.common.preference.PreferenceStore import tachiyomi.core.common.preference.PreferenceStore
import tachiyomi.core.common.util.lang.withIOContext import tachiyomi.core.common.util.lang.withIOContext
import tachiyomi.core.common.util.system.logcat import tachiyomi.core.common.util.system.logcat
import tachiyomi.domain.UnsortedPreferences
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
import uy.kohesive.injekt.injectLazy import uy.kohesive.injekt.injectLazy
@ -183,7 +183,7 @@ internal class ExtensionApi {
private fun Extension.isBlacklisted( private fun Extension.isBlacklisted(
blacklistEnabled: Boolean = sourcePreferences.enableSourceBlacklist().get(), blacklistEnabled: Boolean = sourcePreferences.enableSourceBlacklist().get(),
// KMK --> // KMK -->
isHentaiEnabled: Boolean = Injekt.get<UnsortedPreferences>().isHentaiEnabled().get(), isHentaiEnabled: Boolean = Injekt.get<ExhPreferences>().isHentaiEnabled().get(),
// KMK <-- // KMK <--
): Boolean { ): Boolean {
return pkgName in BlacklistedSources.BLACKLISTED_EXTENSIONS && return pkgName in BlacklistedSources.BLACKLISTED_EXTENSIONS &&

View file

@ -3,6 +3,7 @@
package eu.kanade.tachiyomi.source package eu.kanade.tachiyomi.source
import android.content.Context import android.content.Context
import eu.kanade.domain.source.service.SourcePreferences
import eu.kanade.tachiyomi.data.download.DownloadManager import eu.kanade.tachiyomi.data.download.DownloadManager
import eu.kanade.tachiyomi.extension.ExtensionManager import eu.kanade.tachiyomi.extension.ExtensionManager
import eu.kanade.tachiyomi.source.online.HttpSource import eu.kanade.tachiyomi.source.online.HttpSource
@ -21,6 +22,7 @@ import exh.source.EHENTAI_EXT_SOURCES
import exh.source.EIGHTMUSES_SOURCE_ID import exh.source.EIGHTMUSES_SOURCE_ID
import exh.source.EXHENTAI_EXT_SOURCES import exh.source.EXHENTAI_EXT_SOURCES
import exh.source.EnhancedHttpSource import exh.source.EnhancedHttpSource
import exh.source.ExhPreferences
import exh.source.HBROWSE_SOURCE_ID import exh.source.HBROWSE_SOURCE_ID
import exh.source.MERGED_SOURCE_ID import exh.source.MERGED_SOURCE_ID
import exh.source.PURURIN_SOURCE_ID import exh.source.PURURIN_SOURCE_ID
@ -38,7 +40,6 @@ import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.map
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking import kotlinx.coroutines.runBlocking
import tachiyomi.domain.UnsortedPreferences
import tachiyomi.domain.source.model.StubSource import tachiyomi.domain.source.model.StubSource
import tachiyomi.domain.source.repository.StubSourceRepository import tachiyomi.domain.source.repository.StubSourceRepository
import tachiyomi.domain.source.service.SourceManager import tachiyomi.domain.source.service.SourceManager
@ -71,19 +72,20 @@ class AndroidSourceManager(
} }
// SY --> // SY -->
private val preferences: UnsortedPreferences by injectLazy() private val exhPreferences: ExhPreferences by injectLazy()
private val sourcePreferences: SourcePreferences by injectLazy()
// SY <-- // SY <--
init { init {
scope.launch { scope.launch {
extensionManager.installedExtensionsFlow extensionManager.installedExtensionsFlow
// SY --> // SY -->
.combine(preferences.enableExhentai().changes()) { extensions, enableExhentai -> .combine(exhPreferences.enableExhentai().changes()) { extensions, enableExhentai ->
extensions to enableExhentai extensions to enableExhentai
} }
// KMK --> // KMK -->
.combine( .combine(
preferences.isHentaiEnabled().changes(), exhPreferences.isHentaiEnabled().changes(),
) { (a, b), c -> Triple(a, b, c) } ) { (a, b), c -> Triple(a, b, c) }
// KMK <-- // KMK <--
// SY <-- // SY <--
@ -95,7 +97,7 @@ class AndroidSourceManager(
Injekt.get(), Injekt.get(),
Injekt.get(), Injekt.get(),
// SY --> // SY -->
preferences.allowLocalSourceHiddenFolders()::get, sourcePreferences.allowLocalSourceHiddenFolders()::get,
// SY <-- // SY <--
), ),
), ),

View file

@ -44,6 +44,7 @@ import exh.metadata.metadata.EHentaiSearchMetadata.Companion.TAG_TYPE_WEAK
import exh.metadata.metadata.RaisedSearchMetadata.Companion.TAG_TYPE_VIRTUAL import exh.metadata.metadata.RaisedSearchMetadata.Companion.TAG_TYPE_VIRTUAL
import exh.metadata.metadata.RaisedSearchMetadata.Companion.toGenreString import exh.metadata.metadata.RaisedSearchMetadata.Companion.toGenreString
import exh.metadata.metadata.base.RaisedTag import exh.metadata.metadata.base.RaisedTag
import exh.source.ExhPreferences
import exh.ui.login.EhLoginActivity import exh.ui.login.EhLoginActivity
import exh.util.UriFilter import exh.util.UriFilter
import exh.util.UriGroup import exh.util.UriGroup
@ -84,7 +85,6 @@ import org.jsoup.nodes.TextNode
import rx.Observable import rx.Observable
import tachiyomi.core.common.util.lang.runAsObservable import tachiyomi.core.common.util.lang.runAsObservable
import tachiyomi.core.common.util.lang.withIOContext import tachiyomi.core.common.util.lang.withIOContext
import tachiyomi.domain.UnsortedPreferences
import uy.kohesive.injekt.injectLazy import uy.kohesive.injekt.injectLazy
import java.io.ByteArrayOutputStream import java.io.ByteArrayOutputStream
import java.io.IOException import java.io.IOException
@ -133,7 +133,7 @@ class EHentai(
} }
// KMK <-- // KMK <--
private val preferences: UnsortedPreferences by injectLazy() private val exhPreferences: ExhPreferences by injectLazy()
private val updateHelper: EHentaiUpdateHelper by injectLazy() private val updateHelper: EHentaiUpdateHelper by injectLazy()
/** /**
@ -500,7 +500,7 @@ class EHentai(
} }
private fun <T : MangasPage> T.checkValid(): MangasPage = private fun <T : MangasPage> T.checkValid(): MangasPage =
if (exh && mangas.isEmpty() && preferences.igneousVal().get().equals("mystery", true)) { if (exh && mangas.isEmpty() && exhPreferences.igneousVal().get().equals("mystery", true)) {
throw Exception( throw Exception(
"Invalid igneous cookie, try re-logging or finding a correct one to input in the login menu", "Invalid igneous cookie, try re-logging or finding a correct one to input in the login menu",
) )
@ -910,30 +910,30 @@ class EHentai(
} }
fun spPref() = if (exh) { fun spPref() = if (exh) {
preferences.exhSettingsProfile() exhPreferences.exhSettingsProfile()
} else { } else {
preferences.ehSettingsProfile() exhPreferences.ehSettingsProfile()
} }
private fun rawCookies(sp: Int): Map<String, String> { private fun rawCookies(sp: Int): Map<String, String> {
val cookies: MutableMap<String, String> = mutableMapOf() val cookies: MutableMap<String, String> = mutableMapOf()
if (preferences.enableExhentai().get()) { if (exhPreferences.enableExhentai().get()) {
cookies[EhLoginActivity.MEMBER_ID_COOKIE] = preferences.memberIdVal().get() cookies[EhLoginActivity.MEMBER_ID_COOKIE] = exhPreferences.memberIdVal().get()
cookies[EhLoginActivity.PASS_HASH_COOKIE] = preferences.passHashVal().get() cookies[EhLoginActivity.PASS_HASH_COOKIE] = exhPreferences.passHashVal().get()
cookies[EhLoginActivity.IGNEOUS_COOKIE] = preferences.igneousVal().get() cookies[EhLoginActivity.IGNEOUS_COOKIE] = exhPreferences.igneousVal().get()
cookies["sp"] = sp.toString() cookies["sp"] = sp.toString()
val sessionKey = preferences.exhSettingsKey().get() val sessionKey = exhPreferences.exhSettingsKey().get()
if (sessionKey.isNotBlank()) { if (sessionKey.isNotBlank()) {
cookies["sk"] = sessionKey cookies["sk"] = sessionKey
} }
val sessionCookie = preferences.exhSessionCookie().get() val sessionCookie = exhPreferences.exhSessionCookie().get()
if (sessionCookie.isNotBlank()) { if (sessionCookie.isNotBlank()) {
cookies["s"] = sessionCookie cookies["s"] = sessionCookie
} }
val hathPerksCookie = preferences.exhHathPerksCookies().get() val hathPerksCookie = exhPreferences.exhHathPerksCookies().get()
if (hathPerksCookie.isNotBlank()) { if (hathPerksCookie.isNotBlank()) {
cookies["hath_perks"] = hathPerksCookie cookies["hath_perks"] = hathPerksCookie
} }
@ -980,7 +980,7 @@ class EHentai(
ToplistOptions(), ToplistOptions(),
Filter.Separator(), Filter.Separator(),
AutoCompleteTags(), AutoCompleteTags(),
Watched(isEnabled = preferences.exhWatchedListDefaultState().get()), Watched(isEnabled = exhPreferences.exhWatchedListDefaultState().get()),
GenreGroup(), GenreGroup(),
AdvancedGroup(), AdvancedGroup(),
ReverseFilter(), ReverseFilter(),

View file

@ -17,6 +17,7 @@ import androidx.compose.runtime.rememberUpdatedState
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.viewinterop.AndroidView import androidx.compose.ui.viewinterop.AndroidView
import androidx.core.view.isVisible import androidx.core.view.isVisible
import eu.kanade.domain.source.service.SourcePreferences
import eu.kanade.presentation.components.AdaptiveSheet import eu.kanade.presentation.components.AdaptiveSheet
import eu.kanade.presentation.theme.colorscheme.AndroidViewColorScheme import eu.kanade.presentation.theme.colorscheme.AndroidViewColorScheme
import eu.kanade.tachiyomi.databinding.MigrationBottomSheetBinding import eu.kanade.tachiyomi.databinding.MigrationBottomSheetBinding
@ -25,7 +26,6 @@ import eu.kanade.tachiyomi.util.system.toast
import tachiyomi.core.common.i18n.stringResource import tachiyomi.core.common.i18n.stringResource
import tachiyomi.core.common.preference.Preference import tachiyomi.core.common.preference.Preference
import tachiyomi.core.common.util.lang.toLong import tachiyomi.core.common.util.lang.toLong
import tachiyomi.domain.UnsortedPreferences
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR import tachiyomi.i18n.sy.SYMR
import uy.kohesive.injekt.injectLazy import uy.kohesive.injekt.injectLazy
@ -110,7 +110,7 @@ class MigrationBottomSheetDialogState(
private val fullSettings: Boolean = true, private val fullSettings: Boolean = true,
// KMK <-- // KMK <--
) { ) {
private val preferences: UnsortedPreferences by injectLazy() private val preferences: SourcePreferences by injectLazy()
/** /**
* Init general reader preferences. * Init general reader preferences.

View file

@ -10,14 +10,12 @@ import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.update import kotlinx.coroutines.flow.update
import tachiyomi.core.common.util.lang.launchIO import tachiyomi.core.common.util.lang.launchIO
import tachiyomi.domain.UnsortedPreferences
import tachiyomi.domain.source.service.SourceManager import tachiyomi.domain.source.service.SourceManager
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
class PreMigrationScreenModel( class PreMigrationScreenModel(
private val sourceManager: SourceManager = Injekt.get(), private val sourceManager: SourceManager = Injekt.get(),
private val prefs: UnsortedPreferences = Injekt.get(),
private val sourcePreferences: SourcePreferences = Injekt.get(), private val sourcePreferences: SourcePreferences = Injekt.get(),
) : ScreenModel { ) : ScreenModel {
@ -53,7 +51,7 @@ class PreMigrationScreenModel(
*/ */
private fun getEnabledSources(): List<MigrationSourceItem> { private fun getEnabledSources(): List<MigrationSourceItem> {
val languages = sourcePreferences.enabledLanguages().get() val languages = sourcePreferences.enabledLanguages().get()
val sourcesSaved = prefs.migrationSources().get().split("/") val sourcesSaved = sourcePreferences.migrationSources().get().split("/")
.mapNotNull { it.toLongOrNull() } .mapNotNull { it.toLongOrNull() }
val disabledSources = sourcePreferences.disabledSources().get() val disabledSources = sourcePreferences.disabledSources().get()
.mapNotNull { it.toLongOrNull() } .mapNotNull { it.toLongOrNull() }
@ -134,6 +132,6 @@ class PreMigrationScreenModel(
?.joinToString("/") { it.source.id.toString() } ?.joinToString("/") { it.source.id.toString() }
.orEmpty() .orEmpty()
prefs.migrationSources().set(listOfSources) sourcePreferences.migrationSources().set(listOfSources)
} }
} }

View file

@ -7,6 +7,7 @@ import cafe.adriel.voyager.core.model.screenModelScope
import eu.kanade.domain.chapter.interactor.SyncChaptersWithSource import eu.kanade.domain.chapter.interactor.SyncChaptersWithSource
import eu.kanade.domain.manga.interactor.UpdateManga import eu.kanade.domain.manga.interactor.UpdateManga
import eu.kanade.domain.manga.model.toSManga import eu.kanade.domain.manga.model.toSManga
import eu.kanade.domain.source.service.SourcePreferences
import eu.kanade.tachiyomi.source.CatalogueSource import eu.kanade.tachiyomi.source.CatalogueSource
import eu.kanade.tachiyomi.source.getNameForMangaInfo import eu.kanade.tachiyomi.source.getNameForMangaInfo
import eu.kanade.tachiyomi.source.online.all.EHentai import eu.kanade.tachiyomi.source.online.all.EHentai
@ -35,7 +36,6 @@ import logcat.LogPriority
import tachiyomi.core.common.util.lang.launchIO import tachiyomi.core.common.util.lang.launchIO
import tachiyomi.core.common.util.lang.withUIContext import tachiyomi.core.common.util.lang.withUIContext
import tachiyomi.core.common.util.system.logcat import tachiyomi.core.common.util.system.logcat
import tachiyomi.domain.UnsortedPreferences
import tachiyomi.domain.chapter.interactor.GetChaptersByMangaId import tachiyomi.domain.chapter.interactor.GetChaptersByMangaId
import tachiyomi.domain.manga.interactor.GetManga import tachiyomi.domain.manga.interactor.GetManga
import tachiyomi.domain.manga.interactor.GetMergedReferencesById import tachiyomi.domain.manga.interactor.GetMergedReferencesById
@ -50,7 +50,7 @@ import java.util.concurrent.atomic.AtomicInteger
class MigrationListScreenModel( class MigrationListScreenModel(
private val config: MigrationProcedureConfig, private val config: MigrationProcedureConfig,
private val preferences: UnsortedPreferences = Injekt.get(), private val preferences: SourcePreferences = Injekt.get(),
private val sourceManager: SourceManager = Injekt.get(), private val sourceManager: SourceManager = Injekt.get(),
private val getManga: GetManga = Injekt.get(), private val getManga: GetManga = Injekt.get(),
private val networkToLocalManga: NetworkToLocalManga = Injekt.get(), private val networkToLocalManga: NetworkToLocalManga = Injekt.get(),
@ -214,7 +214,7 @@ class MigrationListScreenModel(
try { try {
syncChaptersWithSource.await(chapters, localManga, source) syncChaptersWithSource.await(chapters, localManga, source)
} catch (e: Exception) { } catch (_: Exception) {
return@async2 null return@async2 null
} }
manga.progress.value = manga.progress.value =
@ -226,7 +226,7 @@ class MigrationListScreenModel(
} catch (e: CancellationException) { } catch (e: CancellationException) {
// Ignore cancellations // Ignore cancellations
throw e throw e
} catch (e: Exception) { } catch (_: Exception) {
null null
} }
} }
@ -261,7 +261,7 @@ class MigrationListScreenModel(
} catch (e: CancellationException) { } catch (e: CancellationException) {
// Ignore cancellations // Ignore cancellations
throw e throw e
} catch (e: Exception) { } catch (_: Exception) {
null null
} }
manga.progress.value = validSources.size to (index + 1) manga.progress.value = validSources.size to (index + 1)
@ -274,7 +274,7 @@ class MigrationListScreenModel(
// KMK --> // KMK -->
manga.searchingJob?.await() manga.searchingJob?.await()
// KMK <-- // KMK <--
} catch (e: CancellationException) { } catch (_: CancellationException) {
// Ignore canceled migrations // Ignore canceled migrations
continue continue
} }
@ -340,7 +340,7 @@ class MigrationListScreenModel(
val source = sourceManager.get(manga.source)!! val source = sourceManager.get(manga.source)!!
val chapters = source.getChapterList(manga.toSManga()) val chapters = source.getChapterList(manga.toSManga())
syncChaptersWithSource.await(chapters, manga, source) syncChaptersWithSource.await(chapters, manga, source)
} catch (e: Exception) { } catch (_: Exception) {
return@async null return@async null
} }
manga manga

View file

@ -8,13 +8,13 @@ import androidx.compose.ui.platform.LocalContext
import cafe.adriel.voyager.core.model.rememberScreenModel import cafe.adriel.voyager.core.model.rememberScreenModel
import cafe.adriel.voyager.navigator.LocalNavigator import cafe.adriel.voyager.navigator.LocalNavigator
import cafe.adriel.voyager.navigator.currentOrThrow import cafe.adriel.voyager.navigator.currentOrThrow
import eu.kanade.domain.source.service.SourcePreferences
import eu.kanade.presentation.browse.MigrateMangaScreen import eu.kanade.presentation.browse.MigrateMangaScreen
import eu.kanade.presentation.util.Screen import eu.kanade.presentation.util.Screen
import eu.kanade.tachiyomi.ui.browse.migration.advanced.design.PreMigrationScreen import eu.kanade.tachiyomi.ui.browse.migration.advanced.design.PreMigrationScreen
import eu.kanade.tachiyomi.ui.manga.MangaScreen import eu.kanade.tachiyomi.ui.manga.MangaScreen
import eu.kanade.tachiyomi.util.system.toast import eu.kanade.tachiyomi.util.system.toast
import kotlinx.coroutines.flow.collectLatest import kotlinx.coroutines.flow.collectLatest
import tachiyomi.domain.UnsortedPreferences
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.i18n.kmk.KMR import tachiyomi.i18n.kmk.KMR
import tachiyomi.presentation.core.screens.LoadingScreen import tachiyomi.presentation.core.screens.LoadingScreen
@ -45,7 +45,7 @@ data class MigrateMangaScreen(
onClickItem = { onClickItem = {
// SY --> // SY -->
PreMigrationScreen.navigateToMigration( PreMigrationScreen.navigateToMigration(
Injekt.get<UnsortedPreferences>().skipPreMigration().get(), Injekt.get<SourcePreferences>().skipPreMigration().get(),
navigator, navigator,
listOf(it.id), listOf(it.id),
) )
@ -56,14 +56,14 @@ data class MigrateMangaScreen(
onMultiMigrateClicked = { onMultiMigrateClicked = {
if (state.selectionMode) { if (state.selectionMode) {
PreMigrationScreen.navigateToMigration( PreMigrationScreen.navigateToMigration(
Injekt.get<UnsortedPreferences>().skipPreMigration().get(), Injekt.get<SourcePreferences>().skipPreMigration().get(),
navigator, navigator,
state.selected.map { it.manga.id }, state.selected.map { it.manga.id },
) )
} else { } else {
context.toast(KMR.strings.migrating_all_entries) context.toast(KMR.strings.migrating_all_entries)
PreMigrationScreen.navigateToMigration( PreMigrationScreen.navigateToMigration(
Injekt.get<UnsortedPreferences>().skipPreMigration().get(), Injekt.get<SourcePreferences>().skipPreMigration().get(),
navigator, navigator,
state.titles.map { it.manga.id }, state.titles.map { it.manga.id },
) )

View file

@ -24,6 +24,7 @@ import eu.kanade.domain.chapter.interactor.SyncChaptersWithSource
import eu.kanade.domain.manga.interactor.UpdateManga import eu.kanade.domain.manga.interactor.UpdateManga
import eu.kanade.domain.manga.model.hasCustomCover import eu.kanade.domain.manga.model.hasCustomCover
import eu.kanade.domain.manga.model.toSManga import eu.kanade.domain.manga.model.toSManga
import eu.kanade.domain.source.service.SourcePreferences
import eu.kanade.tachiyomi.data.cache.CoverCache import eu.kanade.tachiyomi.data.cache.CoverCache
import eu.kanade.tachiyomi.data.download.DownloadManager import eu.kanade.tachiyomi.data.download.DownloadManager
import eu.kanade.tachiyomi.data.track.EnhancedTracker import eu.kanade.tachiyomi.data.track.EnhancedTracker
@ -37,13 +38,12 @@ import kotlinx.coroutines.flow.update
import tachiyomi.core.common.preference.Preference import tachiyomi.core.common.preference.Preference
import tachiyomi.core.common.util.lang.launchIO import tachiyomi.core.common.util.lang.launchIO
import tachiyomi.core.common.util.lang.withUIContext import tachiyomi.core.common.util.lang.withUIContext
import tachiyomi.domain.UnsortedPreferences
import tachiyomi.domain.category.interactor.GetCategories import tachiyomi.domain.category.interactor.GetCategories
import tachiyomi.domain.category.interactor.SetMangaCategories import tachiyomi.domain.category.interactor.SetMangaCategories
import tachiyomi.domain.chapter.interactor.GetChaptersByMangaId import tachiyomi.domain.chapter.interactor.GetChaptersByMangaId
import tachiyomi.domain.chapter.interactor.UpdateChapter import tachiyomi.domain.chapter.interactor.UpdateChapter
import tachiyomi.domain.chapter.model.ChapterUpdate import tachiyomi.domain.chapter.model.ChapterUpdate
import tachiyomi.domain.history.interactor.GetHistoryByMangaId import tachiyomi.domain.history.interactor.GetHistory
import tachiyomi.domain.history.interactor.UpsertHistory import tachiyomi.domain.history.interactor.UpsertHistory
import tachiyomi.domain.history.model.HistoryUpdate import tachiyomi.domain.history.model.HistoryUpdate
import tachiyomi.domain.manga.model.Manga import tachiyomi.domain.manga.model.Manga
@ -151,13 +151,13 @@ internal fun MigrateDialog(
internal class MigrateDialogScreenModel( internal class MigrateDialogScreenModel(
private val sourceManager: SourceManager = Injekt.get(), private val sourceManager: SourceManager = Injekt.get(),
// KMK --> // KMK -->
preferences: UnsortedPreferences = Injekt.get(), sourcePreferences: SourcePreferences = Injekt.get(),
// KMK <-- // KMK <--
) : StateScreenModel<MigrateDialogScreenModel.State>(State()) { ) : StateScreenModel<MigrateDialogScreenModel.State>(State()) {
val migrateFlags: Preference<Int> by lazy { val migrateFlags: Preference<Int> by lazy {
// KMK --> // KMK -->
preferences.migrateFlags() sourcePreferences.migrateFlags()
// KMK <-- // KMK <--
} }
@ -210,14 +210,14 @@ internal class MigrateDialogScreenModel(
// KMK --> // KMK -->
if (oldManga.id == newManga.id) return // Nothing to migrate if (oldManga.id == newManga.id) return // Nothing to migrate
val preferences: UnsortedPreferences = Injekt.get() val sourcePreferences: SourcePreferences = Injekt.get()
val downloadManager: DownloadManager = Injekt.get() val downloadManager: DownloadManager = Injekt.get()
val coverCache: CoverCache = Injekt.get() val coverCache: CoverCache = Injekt.get()
val updateManga: UpdateManga = Injekt.get() val updateManga: UpdateManga = Injekt.get()
val syncChaptersWithSource: SyncChaptersWithSource = Injekt.get() val syncChaptersWithSource: SyncChaptersWithSource = Injekt.get()
val updateChapter: UpdateChapter = Injekt.get() val updateChapter: UpdateChapter = Injekt.get()
val getChaptersByMangaId: GetChaptersByMangaId = Injekt.get() val getChaptersByMangaId: GetChaptersByMangaId = Injekt.get()
val getHistoryByMangaId: GetHistoryByMangaId = Injekt.get() val getHistory: GetHistory = Injekt.get()
val upsertHistory: UpsertHistory = Injekt.get() val upsertHistory: UpsertHistory = Injekt.get()
val getCategories: GetCategories = Injekt.get() val getCategories: GetCategories = Injekt.get()
val setMangaCategories: SetMangaCategories = Injekt.get() val setMangaCategories: SetMangaCategories = Injekt.get()
@ -227,7 +227,7 @@ internal class MigrateDialogScreenModel(
Injekt.get<TrackerManager>().trackers.filterIsInstance<EnhancedTracker>() Injekt.get<TrackerManager>().trackers.filterIsInstance<EnhancedTracker>()
} }
val flags = presetFlags ?: preferences.migrateFlags().get() val flags = presetFlags ?: sourcePreferences.migrateFlags().get()
// KMK <-- // KMK <--
val migrateChapters = MigrationFlags.hasChapters(flags) val migrateChapters = MigrationFlags.hasChapters(flags)
@ -256,7 +256,7 @@ internal class MigrateDialogScreenModel(
.maxOfOrNull { it.chapterNumber } .maxOfOrNull { it.chapterNumber }
// SY --> // SY -->
val prevHistoryList = getHistoryByMangaId.await(oldManga.id) val prevHistoryList = getHistory.await(oldManga.id)
// KMK --> // KMK -->
.associateBy { it.chapterId } .associateBy { it.chapterId }
// KMK <-- // KMK <--

View file

@ -65,6 +65,7 @@ import eu.kanade.tachiyomi.ui.manga.MangaScreen
import eu.kanade.tachiyomi.ui.webview.WebViewScreen import eu.kanade.tachiyomi.ui.webview.WebViewScreen
import eu.kanade.tachiyomi.util.system.toast import eu.kanade.tachiyomi.util.system.toast
import exh.md.follows.MangaDexFollowsScreen import exh.md.follows.MangaDexFollowsScreen
import exh.source.ExhPreferences
import exh.source.anyIs import exh.source.anyIs
import exh.source.isEhBasedSource import exh.source.isEhBasedSource
import exh.source.isMdBasedSource import exh.source.isMdBasedSource
@ -75,7 +76,6 @@ import kotlinx.coroutines.flow.receiveAsFlow
import mihon.presentation.core.util.collectAsLazyPagingItems import mihon.presentation.core.util.collectAsLazyPagingItems
import tachiyomi.core.common.Constants import tachiyomi.core.common.Constants
import tachiyomi.core.common.util.lang.launchIO import tachiyomi.core.common.util.lang.launchIO
import tachiyomi.domain.UnsortedPreferences
import tachiyomi.domain.source.model.StubSource import tachiyomi.domain.source.model.StubSource
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.i18n.kmk.KMR import tachiyomi.i18n.kmk.KMR
@ -179,7 +179,7 @@ data class BrowseSourceScreen(
// KMK --> // KMK -->
val mangaList = screenModel.mangaPagerFlowFlow.collectAsLazyPagingItems() val mangaList = screenModel.mangaPagerFlowFlow.collectAsLazyPagingItems()
val isHentaiEnabled: Boolean = Injekt.get<UnsortedPreferences>().isHentaiEnabled().get() val isHentaiEnabled: Boolean = Injekt.get<ExhPreferences>().isHentaiEnabled().get()
val isConfigurableSource = screenModel.source.anyIs<ConfigurableSource>() || val isConfigurableSource = screenModel.source.anyIs<ConfigurableSource>() ||
(screenModel.source.isEhBasedSource() && isHentaiEnabled) (screenModel.source.isEhBasedSource() && isHentaiEnabled)
// KMK <-- // KMK <--

View file

@ -33,6 +33,7 @@ import eu.kanade.tachiyomi.source.online.all.MangaDex
import eu.kanade.tachiyomi.util.removeCovers import eu.kanade.tachiyomi.util.removeCovers
import exh.metadata.metadata.RaisedSearchMetadata import exh.metadata.metadata.RaisedSearchMetadata
import exh.source.EH_PACKAGE import exh.source.EH_PACKAGE
import exh.source.ExhPreferences
import exh.source.LOCAL_SOURCE_PACKAGE import exh.source.LOCAL_SOURCE_PACKAGE
import exh.source.getMainSource import exh.source.getMainSource
import exh.source.isEhBasedSource import exh.source.isEhBasedSource
@ -61,7 +62,6 @@ import tachiyomi.core.common.preference.mapAsCheckboxState
import tachiyomi.core.common.util.lang.launchIO import tachiyomi.core.common.util.lang.launchIO
import tachiyomi.core.common.util.lang.launchNonCancellable import tachiyomi.core.common.util.lang.launchNonCancellable
import tachiyomi.core.common.util.lang.withUIContext import tachiyomi.core.common.util.lang.withUIContext
import tachiyomi.domain.UnsortedPreferences
import tachiyomi.domain.category.interactor.GetCategories import tachiyomi.domain.category.interactor.GetCategories
import tachiyomi.domain.category.interactor.SetMangaCategories import tachiyomi.domain.category.interactor.SetMangaCategories
import tachiyomi.domain.category.model.Category import tachiyomi.domain.category.model.Category
@ -116,7 +116,7 @@ open class BrowseSourceScreenModel(
// KMK <-- // KMK <--
// SY --> // SY -->
unsortedPreferences: UnsortedPreferences = Injekt.get(), exhPreferences: ExhPreferences = Injekt.get(),
uiPreferences: UiPreferences = Injekt.get(), uiPreferences: UiPreferences = Injekt.get(),
private val getFlatMetadataById: GetFlatMetadataById = Injekt.get(), private val getFlatMetadataById: GetFlatMetadataById = Injekt.get(),
private val deleteSavedSearchById: DeleteSavedSearchById = Injekt.get(), private val deleteSavedSearchById: DeleteSavedSearchById = Injekt.get(),
@ -130,7 +130,7 @@ open class BrowseSourceScreenModel(
var source = sourceManager.getOrStub(sourceId) var source = sourceManager.getOrStub(sourceId)
// SY --> // SY -->
val ehentaiBrowseDisplayMode by unsortedPreferences.enhancedEHentaiView().asState(screenModelScope) val ehentaiBrowseDisplayMode by exhPreferences.enhancedEHentaiView().asState(screenModelScope)
val startExpanded by uiPreferences.expandFilters().asState(screenModelScope) val startExpanded by uiPreferences.expandFilters().asState(screenModelScope)

View file

@ -36,10 +36,10 @@ import eu.kanade.tachiyomi.ui.manga.MangaScreen
import eu.kanade.tachiyomi.ui.webview.WebViewScreen import eu.kanade.tachiyomi.ui.webview.WebViewScreen
import eu.kanade.tachiyomi.util.system.toast import eu.kanade.tachiyomi.util.system.toast
import exh.md.follows.MangaDexFollowsScreen import exh.md.follows.MangaDexFollowsScreen
import exh.source.ExhPreferences
import exh.source.anyIs import exh.source.anyIs
import exh.source.isEhBasedSource import exh.source.isEhBasedSource
import exh.util.nullIfBlank import exh.util.nullIfBlank
import tachiyomi.domain.UnsortedPreferences
import tachiyomi.domain.manga.model.Manga import tachiyomi.domain.manga.model.Manga
import tachiyomi.domain.source.interactor.GetRemoteManga import tachiyomi.domain.source.interactor.GetRemoteManga
import tachiyomi.domain.source.model.SavedSearch import tachiyomi.domain.source.model.SavedSearch
@ -84,7 +84,7 @@ class SourceFeedScreen(val sourceId: Long) : Screen() {
val bulkFavoriteState by bulkFavoriteScreenModel.state.collectAsState() val bulkFavoriteState by bulkFavoriteScreenModel.state.collectAsState()
val showingFeedOrderScreen = rememberSaveable { mutableStateOf(false) } val showingFeedOrderScreen = rememberSaveable { mutableStateOf(false) }
val isHentaiEnabled: Boolean = Injekt.get<UnsortedPreferences>().isHentaiEnabled().get() val isHentaiEnabled: Boolean = Injekt.get<ExhPreferences>().isHentaiEnabled().get()
val isConfigurableSource = screenModel.source.anyIs<ConfigurableSource>() || val isConfigurableSource = screenModel.source.anyIs<ConfigurableSource>() ||
(screenModel.source.isEhBasedSource() && isHentaiEnabled) (screenModel.source.isEhBasedSource() && isHentaiEnabled)

View file

@ -47,6 +47,7 @@ import exh.search.QueryComponent
import exh.search.SearchEngine import exh.search.SearchEngine
import exh.search.Text import exh.search.Text
import exh.source.EH_SOURCE_ID import exh.source.EH_SOURCE_ID
import exh.source.ExhPreferences
import exh.source.MANGADEX_IDS import exh.source.MANGADEX_IDS
import exh.source.MERGED_SOURCE_ID import exh.source.MERGED_SOURCE_ID
import exh.source.isEhBasedManga import exh.source.isEhBasedManga
@ -89,7 +90,6 @@ import tachiyomi.core.common.util.lang.compareToWithCollator
import tachiyomi.core.common.util.lang.launchIO import tachiyomi.core.common.util.lang.launchIO
import tachiyomi.core.common.util.lang.launchNonCancellable import tachiyomi.core.common.util.lang.launchNonCancellable
import tachiyomi.core.common.util.lang.withIOContext import tachiyomi.core.common.util.lang.withIOContext
import tachiyomi.domain.UnsortedPreferences
import tachiyomi.domain.category.interactor.GetCategories import tachiyomi.domain.category.interactor.GetCategories
import tachiyomi.domain.category.interactor.SetMangaCategories import tachiyomi.domain.category.interactor.SetMangaCategories
import tachiyomi.domain.category.model.Category import tachiyomi.domain.category.model.Category
@ -145,7 +145,7 @@ class LibraryScreenModel(
private val downloadCache: DownloadCache = Injekt.get(), private val downloadCache: DownloadCache = Injekt.get(),
private val trackerManager: TrackerManager = Injekt.get(), private val trackerManager: TrackerManager = Injekt.get(),
// SY --> // SY -->
private val unsortedPreferences: UnsortedPreferences = Injekt.get(), private val exhPreferences: ExhPreferences = Injekt.get(),
private val sourcePreferences: SourcePreferences = Injekt.get(), private val sourcePreferences: SourcePreferences = Injekt.get(),
private val getMergedMangaById: GetMergedMangaById = Injekt.get(), private val getMergedMangaById: GetMergedMangaById = Injekt.get(),
private val getTracks: GetTracks = Injekt.get(), private val getTracks: GetTracks = Injekt.get(),
@ -359,9 +359,9 @@ class LibraryScreenModel(
// SY --> // SY -->
combine( combine(
unsortedPreferences.isHentaiEnabled().changes(), exhPreferences.isHentaiEnabled().changes(),
sourcePreferences.disabledSources().changes(), sourcePreferences.disabledSources().changes(),
unsortedPreferences.enableExhentai().changes(), exhPreferences.enableExhentai().changes(),
) { isHentaiEnabled, disabledSources, enableExhentai -> ) { isHentaiEnabled, disabledSources, enableExhentai ->
isHentaiEnabled && (EH_SOURCE_ID.toString() !in disabledSources || enableExhentai) isHentaiEnabled && (EH_SOURCE_ID.toString() !in disabledSources || enableExhentai)
} }
@ -1000,7 +1000,7 @@ class LibraryScreenModel(
@OptIn(DelicateCoroutinesApi::class) @OptIn(DelicateCoroutinesApi::class)
fun syncMangaToDex() { fun syncMangaToDex() {
launchIO { launchIO {
MdUtil.getEnabledMangaDex(unsortedPreferences, sourcePreferences, sourceManager)?.let { mdex -> MdUtil.getEnabledMangaDex(sourcePreferences, sourceManager)?.let { mdex ->
state.value.selectedManga.fastFilter { it.source in mangaDexSourceIds }.fastForEach { manga -> state.value.selectedManga.fastFilter { it.source in mangaDexSourceIds }.fastForEach { manga ->
mdex.updateFollowStatus(MdUtil.getMangaId(manga.url), FollowStatus.READING) mdex.updateFollowStatus(MdUtil.getMangaId(manga.url), FollowStatus.READING)
} }
@ -1574,13 +1574,13 @@ class LibraryScreenModel(
} }
fun onAcceptSyncWarning() { fun onAcceptSyncWarning() {
unsortedPreferences.exhShowSyncIntro().set(false) exhPreferences.exhShowSyncIntro().set(false)
} }
fun openFavoritesSyncDialog() { fun openFavoritesSyncDialog() {
mutableState.update { mutableState.update {
it.copy( it.copy(
dialog = if (unsortedPreferences.exhShowSyncIntro().get()) { dialog = if (exhPreferences.exhShowSyncIntro().get()) {
Dialog.SyncFavoritesWarning Dialog.SyncFavoritesWarning
} else { } else {
Dialog.SyncFavoritesConfirm Dialog.SyncFavoritesConfirm

View file

@ -29,6 +29,7 @@ import cafe.adriel.voyager.navigator.Navigator
import cafe.adriel.voyager.navigator.currentOrThrow import cafe.adriel.voyager.navigator.currentOrThrow
import cafe.adriel.voyager.navigator.tab.LocalTabNavigator import cafe.adriel.voyager.navigator.tab.LocalTabNavigator
import cafe.adriel.voyager.navigator.tab.TabOptions import cafe.adriel.voyager.navigator.tab.TabOptions
import eu.kanade.domain.source.service.SourcePreferences
import eu.kanade.presentation.category.components.ChangeCategoryDialog import eu.kanade.presentation.category.components.ChangeCategoryDialog
import eu.kanade.presentation.library.DeleteLibraryMangaDialog import eu.kanade.presentation.library.DeleteLibraryMangaDialog
import eu.kanade.presentation.library.LibrarySettingsDialog import eu.kanade.presentation.library.LibrarySettingsDialog
@ -69,7 +70,6 @@ import kotlinx.coroutines.flow.receiveAsFlow
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import tachiyomi.core.common.i18n.stringResource import tachiyomi.core.common.i18n.stringResource
import tachiyomi.core.common.util.lang.launchIO import tachiyomi.core.common.util.lang.launchIO
import tachiyomi.domain.UnsortedPreferences
import tachiyomi.domain.category.model.Category import tachiyomi.domain.category.model.Category
import tachiyomi.domain.library.model.LibraryGroup import tachiyomi.domain.library.model.LibraryGroup
import tachiyomi.domain.library.model.LibraryManga import tachiyomi.domain.library.model.LibraryManga
@ -211,7 +211,7 @@ data object LibraryTab : Tab {
screenModel.clearSelection() screenModel.clearSelection()
if (selectedMangaIds.isNotEmpty()) { if (selectedMangaIds.isNotEmpty()) {
PreMigrationScreen.navigateToMigration( PreMigrationScreen.navigateToMigration(
Injekt.get<UnsortedPreferences>().skipPreMigration().get(), Injekt.get<SourcePreferences>().skipPreMigration().get(),
navigator, navigator,
selectedMangaIds, selectedMangaIds,
) )

View file

@ -6,11 +6,11 @@ import androidx.compose.runtime.getValue
import cafe.adriel.voyager.core.model.rememberScreenModel import cafe.adriel.voyager.core.model.rememberScreenModel
import cafe.adriel.voyager.navigator.LocalNavigator import cafe.adriel.voyager.navigator.LocalNavigator
import cafe.adriel.voyager.navigator.currentOrThrow import cafe.adriel.voyager.navigator.currentOrThrow
import eu.kanade.domain.source.service.SourcePreferences
import eu.kanade.presentation.libraryUpdateError.LibraryUpdateErrorScreen import eu.kanade.presentation.libraryUpdateError.LibraryUpdateErrorScreen
import eu.kanade.presentation.util.Screen import eu.kanade.presentation.util.Screen
import eu.kanade.tachiyomi.ui.browse.migration.advanced.design.PreMigrationScreen import eu.kanade.tachiyomi.ui.browse.migration.advanced.design.PreMigrationScreen
import eu.kanade.tachiyomi.ui.manga.MangaScreen import eu.kanade.tachiyomi.ui.manga.MangaScreen
import tachiyomi.domain.UnsortedPreferences
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
@ -26,7 +26,7 @@ class LibraryUpdateErrorScreen : Screen() {
state = state, state = state,
onClick = { item -> onClick = { item ->
PreMigrationScreen.navigateToMigration( PreMigrationScreen.navigateToMigration(
Injekt.get<UnsortedPreferences>().skipPreMigration().get(), Injekt.get<SourcePreferences>().skipPreMigration().get(),
navigator, navigator,
listOf(item.error.mangaId), listOf(item.error.mangaId),
) )
@ -34,7 +34,7 @@ class LibraryUpdateErrorScreen : Screen() {
onClickCover = { item -> navigator.push(MangaScreen(item.error.mangaId)) }, onClickCover = { item -> navigator.push(MangaScreen(item.error.mangaId)) },
onMultiMigrateClicked = { onMultiMigrateClicked = {
PreMigrationScreen.navigateToMigration( PreMigrationScreen.navigateToMigration(
Injekt.get<UnsortedPreferences>().skipPreMigration().get(), Injekt.get<SourcePreferences>().skipPreMigration().get(),
navigator, navigator,
state.selected.map { it.error.mangaId }, state.selected.map { it.error.mangaId },
) )

View file

@ -104,6 +104,7 @@ import eu.kanade.tachiyomi.util.view.setComposeContent
import exh.debug.DebugToggles import exh.debug.DebugToggles
import exh.eh.EHentaiUpdateWorker import exh.eh.EHentaiUpdateWorker
import exh.log.DebugModeOverlay import exh.log.DebugModeOverlay
import exh.source.ExhPreferences
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.channels.awaitClose import kotlinx.coroutines.channels.awaitClose
import kotlinx.coroutines.flow.callbackFlow import kotlinx.coroutines.flow.callbackFlow
@ -123,7 +124,6 @@ import tachiyomi.core.common.preference.Preference
import tachiyomi.core.common.preference.PreferenceStore import tachiyomi.core.common.preference.PreferenceStore
import tachiyomi.core.common.util.lang.launchIO import tachiyomi.core.common.util.lang.launchIO
import tachiyomi.core.common.util.system.logcat import tachiyomi.core.common.util.system.logcat
import tachiyomi.domain.UnsortedPreferences
import tachiyomi.domain.backup.service.BackupPreferences import tachiyomi.domain.backup.service.BackupPreferences
import tachiyomi.domain.library.service.LibraryPreferences import tachiyomi.domain.library.service.LibraryPreferences
import tachiyomi.domain.release.interactor.GetApplicationRelease import tachiyomi.domain.release.interactor.GetApplicationRelease
@ -142,7 +142,7 @@ class MainActivity : BaseActivity() {
private val preferences: BasePreferences by injectLazy() private val preferences: BasePreferences by injectLazy()
// SY --> // SY -->
private val unsortedPreferences: UnsortedPreferences by injectLazy() private val exhPreferences: ExhPreferences by injectLazy()
// SY <-- // SY <--
// KMK --> // KMK -->
@ -277,8 +277,8 @@ class MainActivity : BaseActivity() {
// SY --> // SY -->
initWhenIdle { initWhenIdle {
// Upload settings // Upload settings
if (unsortedPreferences.enableExhentai().get() && if (exhPreferences.enableExhentai().get() &&
unsortedPreferences.exhShowSettingsUploadWarning().get() exhPreferences.exhShowSettingsUploadWarning().get()
) { ) {
runExhConfigureDialog = true runExhConfigureDialog = true
} }

View file

@ -45,6 +45,7 @@ import dev.icerock.moko.resources.StringResource
import eu.kanade.core.util.ifSourcesLoaded import eu.kanade.core.util.ifSourcesLoaded
import eu.kanade.domain.manga.model.hasCustomCover import eu.kanade.domain.manga.model.hasCustomCover
import eu.kanade.domain.manga.model.toSManga import eu.kanade.domain.manga.model.toSManga
import eu.kanade.domain.source.service.SourcePreferences
import eu.kanade.presentation.browse.components.BulkFavoriteDialogs import eu.kanade.presentation.browse.components.BulkFavoriteDialogs
import eu.kanade.presentation.category.components.ChangeCategoryDialog import eu.kanade.presentation.category.components.ChangeCategoryDialog
import eu.kanade.presentation.components.NavigatorAdaptiveSheet import eu.kanade.presentation.components.NavigatorAdaptiveSheet
@ -89,6 +90,7 @@ import eu.kanade.tachiyomi.util.system.toShareIntent
import eu.kanade.tachiyomi.util.system.toast import eu.kanade.tachiyomi.util.system.toast
import exh.pagepreview.PagePreviewScreen import exh.pagepreview.PagePreviewScreen
import exh.recs.RecommendsScreen import exh.recs.RecommendsScreen
import exh.source.ExhPreferences
import exh.source.MERGED_SOURCE_ID import exh.source.MERGED_SOURCE_ID
import exh.source.anyIs import exh.source.anyIs
import exh.source.getMainSource import exh.source.getMainSource
@ -109,7 +111,6 @@ import tachiyomi.core.common.util.lang.launchUI
import tachiyomi.core.common.util.lang.withIOContext import tachiyomi.core.common.util.lang.withIOContext
import tachiyomi.core.common.util.lang.withNonCancellableContext import tachiyomi.core.common.util.lang.withNonCancellableContext
import tachiyomi.core.common.util.system.logcat import tachiyomi.core.common.util.system.logcat
import tachiyomi.domain.UnsortedPreferences
import tachiyomi.domain.chapter.model.Chapter import tachiyomi.domain.chapter.model.Chapter
import tachiyomi.domain.manga.model.Manga import tachiyomi.domain.manga.model.Manga
import tachiyomi.domain.source.interactor.GetRemoteManga import tachiyomi.domain.source.interactor.GetRemoteManga
@ -264,7 +265,7 @@ class MangaScreen(
val hazeState = remember { HazeState() } val hazeState = remember { HazeState() }
val fullCoverBackground = MaterialTheme.colorScheme.surfaceTint.blend(MaterialTheme.colorScheme.surface) val fullCoverBackground = MaterialTheme.colorScheme.surfaceTint.blend(MaterialTheme.colorScheme.surface)
val isHentaiEnabled: Boolean = Injekt.get<UnsortedPreferences>().isHentaiEnabled().get() val isHentaiEnabled: Boolean = Injekt.get<ExhPreferences>().isHentaiEnabled().get()
val isConfigurableSource = successState.source.anyIs<ConfigurableSource>() || val isConfigurableSource = successState.source.anyIs<ConfigurableSource>() ||
(successState.source.isEhBasedSource() && isHentaiEnabled) (successState.source.isEhBasedSource() && isHentaiEnabled)
// KMK <-- // KMK <--
@ -368,7 +369,7 @@ class MangaScreen(
onMigrateClicked = { onMigrateClicked = {
// SY --> // SY -->
PreMigrationScreen.navigateToMigration( PreMigrationScreen.navigateToMigration(
Injekt.get<UnsortedPreferences>().skipPreMigration().get(), Injekt.get<SourcePreferences>().skipPreMigration().get(),
navigator, navigator,
listOfNotNull(successState.manga.id), listOfNotNull(successState.manga.id),
) )

View file

@ -13,7 +13,7 @@ import tachiyomi.domain.chapter.interactor.GetChaptersByMangaId
import tachiyomi.domain.chapter.model.Chapter import tachiyomi.domain.chapter.model.Chapter
import tachiyomi.domain.chapter.model.ChapterUpdate import tachiyomi.domain.chapter.model.ChapterUpdate
import tachiyomi.domain.chapter.repository.ChapterRepository import tachiyomi.domain.chapter.repository.ChapterRepository
import tachiyomi.domain.history.interactor.GetHistoryByMangaId import tachiyomi.domain.history.interactor.GetHistory
import tachiyomi.domain.history.interactor.RemoveHistory import tachiyomi.domain.history.interactor.RemoveHistory
import tachiyomi.domain.history.interactor.UpsertHistory import tachiyomi.domain.history.interactor.UpsertHistory
import tachiyomi.domain.history.model.History import tachiyomi.domain.history.model.History
@ -43,7 +43,7 @@ class EHentaiUpdateHelper(context: Context) {
private val chapterRepository: ChapterRepository by injectLazy() private val chapterRepository: ChapterRepository by injectLazy()
private val upsertHistory: UpsertHistory by injectLazy() private val upsertHistory: UpsertHistory by injectLazy()
private val removeHistory: RemoveHistory by injectLazy() private val removeHistory: RemoveHistory by injectLazy()
private val getHistoryByMangaId: GetHistoryByMangaId by injectLazy() private val getHistory: GetHistory by injectLazy()
private val insertFavoriteEntryAlternative: InsertFavoriteEntryAlternative by injectLazy() private val insertFavoriteEntryAlternative: InsertFavoriteEntryAlternative by injectLazy()
/** /**
@ -70,7 +70,7 @@ class EHentaiUpdateHelper(context: Context) {
getChaptersByMangaId.await(mangaId) getChaptersByMangaId.await(mangaId)
} }
val history = async(Dispatchers.IO) { val history = async(Dispatchers.IO) {
getHistoryByMangaId.await(mangaId) getHistory.await(mangaId)
} }
ChapterChain( ChapterChain(
manga.await() ?: return@coroutineScope null, manga.await() ?: return@coroutineScope null,

View file

@ -29,14 +29,13 @@ import exh.debug.DebugToggles
import exh.eh.EHentaiUpdateWorkerConstants.UPDATES_PER_ITERATION import exh.eh.EHentaiUpdateWorkerConstants.UPDATES_PER_ITERATION
import exh.log.xLog import exh.log.xLog
import exh.metadata.metadata.EHentaiSearchMetadata import exh.metadata.metadata.EHentaiSearchMetadata
import exh.source.ExhPreferences
import exh.util.cancellable import exh.util.cancellable
import kotlinx.coroutines.flow.asFlow import kotlinx.coroutines.flow.asFlow
import kotlinx.coroutines.flow.mapNotNull import kotlinx.coroutines.flow.mapNotNull
import kotlinx.coroutines.flow.toList import kotlinx.coroutines.flow.toList
import kotlinx.serialization.encodeToString
import kotlinx.serialization.json.Json import kotlinx.serialization.json.Json
import tachiyomi.core.common.preference.getAndSet import tachiyomi.core.common.preference.getAndSet
import tachiyomi.domain.UnsortedPreferences
import tachiyomi.domain.chapter.interactor.GetChaptersByMangaId import tachiyomi.domain.chapter.interactor.GetChaptersByMangaId
import tachiyomi.domain.chapter.model.Chapter import tachiyomi.domain.chapter.model.Chapter
import tachiyomi.domain.library.service.LibraryPreferences import tachiyomi.domain.library.service.LibraryPreferences
@ -55,7 +54,7 @@ import kotlin.time.Duration.Companion.days
class EHentaiUpdateWorker(private val context: Context, workerParams: WorkerParameters) : class EHentaiUpdateWorker(private val context: Context, workerParams: WorkerParameters) :
CoroutineWorker(context, workerParams) { CoroutineWorker(context, workerParams) {
private val preferences: UnsortedPreferences by injectLazy() private val exhPreferences: ExhPreferences by injectLazy()
private val libraryPreferences: LibraryPreferences by injectLazy() private val libraryPreferences: LibraryPreferences by injectLazy()
private val sourceManager: SourceManager by injectLazy() private val sourceManager: SourceManager by injectLazy()
private val updateHelper: EHentaiUpdateHelper by injectLazy() private val updateHelper: EHentaiUpdateHelper by injectLazy()
@ -73,10 +72,11 @@ class EHentaiUpdateWorker(private val context: Context, workerParams: WorkerPara
override suspend fun doWork(): Result { override suspend fun doWork(): Result {
return try { return try {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P && if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P &&
requiresWifiConnection(preferences) && requiresWifiConnection(exhPreferences) &&
!context.isConnectedToWifi() !context.isConnectedToWifi()
) { ) {
Result.retry() // retry again later logger.d("Retry again later in next periodic run due to missing Wi-Fi connection...")
Result.success() // retry again later in next periodic run
} else { } else {
setForegroundSafely() setForegroundSafely()
startUpdating() startUpdating()
@ -84,7 +84,8 @@ class EHentaiUpdateWorker(private val context: Context, workerParams: WorkerPara
Result.success() Result.success()
} }
} catch (e: Exception) { } catch (e: Exception) {
Result.retry() // retry again later logger.d("Retry again later in next periodic run!", e)
Result.success() // retry again later in next periodic run
} finally { } finally {
updateNotifier.cancelProgressNotification() updateNotifier.cancelProgressNotification()
} }
@ -220,7 +221,7 @@ class EHentaiUpdateWorker(private val context: Context, workerParams: WorkerPara
updatedThisIteration++ updatedThisIteration++
} }
} finally { } finally {
preferences.exhAutoUpdateStats().set( exhPreferences.exhAutoUpdateStats().set(
Json.encodeToString( Json.encodeToString(
EHentaiUpdaterStats( EHentaiUpdaterStats(
startTime, startTime,
@ -284,10 +285,10 @@ class EHentaiUpdateWorker(private val context: Context, workerParams: WorkerPara
} }
fun scheduleBackground(context: Context, prefInterval: Int? = null, prefRestrictions: Set<String>? = null) { fun scheduleBackground(context: Context, prefInterval: Int? = null, prefRestrictions: Set<String>? = null) {
val preferences = Injekt.get<UnsortedPreferences>() val exhPreferences = Injekt.get<ExhPreferences>()
val interval = prefInterval ?: preferences.exhAutoUpdateFrequency().get() val interval = prefInterval ?: exhPreferences.exhAutoUpdateFrequency().get()
if (interval > 0) { if (interval > 0) {
val restrictions = prefRestrictions ?: preferences.exhAutoUpdateRequirements().get() val restrictions = prefRestrictions ?: exhPreferences.exhAutoUpdateRequirements().get()
val acRestriction = DEVICE_CHARGING in restrictions val acRestriction = DEVICE_CHARGING in restrictions
val networkRequestBuilder = NetworkRequest.Builder() val networkRequestBuilder = NetworkRequest.Builder()
@ -323,8 +324,8 @@ class EHentaiUpdateWorker(private val context: Context, workerParams: WorkerPara
} }
} }
private fun requiresWifiConnection(preferences: UnsortedPreferences): Boolean { private fun requiresWifiConnection(exhPreferences: ExhPreferences): Boolean {
val restrictions = preferences.exhAutoUpdateRequirements().get() val restrictions = exhPreferences.exhAutoUpdateRequirements().get()
return DEVICE_ONLY_ON_WIFI in restrictions return DEVICE_ONLY_ON_WIFI in restrictions
} }
} }

View file

@ -14,6 +14,7 @@ import exh.eh.EHentaiUpdateWorker
import exh.log.xLog import exh.log.xLog
import exh.source.EH_SOURCE_ID import exh.source.EH_SOURCE_ID
import exh.source.EXH_SOURCE_ID import exh.source.EXH_SOURCE_ID
import exh.source.ExhPreferences
import exh.source.isEhBasedManga import exh.source.isEhBasedManga
import exh.util.ThrottleManager import exh.util.ThrottleManager
import exh.util.createPartialWakeLock import exh.util.createPartialWakeLock
@ -29,7 +30,6 @@ import okhttp3.Request
import tachiyomi.core.common.i18n.stringResource import tachiyomi.core.common.i18n.stringResource
import tachiyomi.core.common.util.lang.withIOContext import tachiyomi.core.common.util.lang.withIOContext
import tachiyomi.core.common.util.lang.withUIContext import tachiyomi.core.common.util.lang.withUIContext
import tachiyomi.domain.UnsortedPreferences
import tachiyomi.domain.category.interactor.CreateCategoryWithName import tachiyomi.domain.category.interactor.CreateCategoryWithName
import tachiyomi.domain.category.interactor.GetCategories import tachiyomi.domain.category.interactor.GetCategories
import tachiyomi.domain.category.interactor.SetMangaCategories import tachiyomi.domain.category.interactor.SetMangaCategories
@ -57,7 +57,7 @@ class FavoritesSyncHelper(val context: Context) {
private val createCategoryWithName: CreateCategoryWithName by injectLazy() private val createCategoryWithName: CreateCategoryWithName by injectLazy()
private val updateCategory: UpdateCategory by injectLazy() private val updateCategory: UpdateCategory by injectLazy()
private val prefs: UnsortedPreferences by injectLazy() private val exhPreferences: ExhPreferences by injectLazy()
private val exh by lazy { private val exh by lazy {
Injekt.get<SourceManager>().get(EXH_SOURCE_ID) as? EHentai Injekt.get<SourceManager>().get(EXH_SOURCE_ID) as? EHentai
@ -90,7 +90,7 @@ class FavoritesSyncHelper(val context: Context) {
private suspend fun beginSync() { private suspend fun beginSync() {
// Check if logged in // Check if logged in
if (!prefs.enableExhentai().get()) { if (!exhPreferences.enableExhentai().get()) {
status.value = FavoritesSyncStatus.SyncError.NotLoggedInSyncError status.value = FavoritesSyncStatus.SyncError.NotLoggedInSyncError
return return
} }
@ -138,7 +138,7 @@ class FavoritesSyncHelper(val context: Context) {
status.value = FavoritesSyncStatus.Processing.CalculatingRemoteChanges status.value = FavoritesSyncStatus.Processing.CalculatingRemoteChanges
val remoteChanges = storage.getChangedRemoteEntries(favorites.first) val remoteChanges = storage.getChangedRemoteEntries(favorites.first)
val localChanges = if (prefs.exhReadOnlySync().get()) { val localChanges = if (exhPreferences.exhReadOnlySync().get()) {
null // Do not build local changes if they are not going to be applied null // Do not build local changes if they are not going to be applied
} else { } else {
status.value = FavoritesSyncStatus.Processing.CalculatingLocalChanges status.value = FavoritesSyncStatus.Processing.CalculatingLocalChanges
@ -238,7 +238,7 @@ class FavoritesSyncHelper(val context: Context) {
gallery.gid, gallery.gid,
) )
if (prefs.exhLenientSync().get()) { if (exhPreferences.exhLenientSync().get()) {
errorList += error errorList += error
} else { } else {
status.value = error status.value = error
@ -289,7 +289,7 @@ class FavoritesSyncHelper(val context: Context) {
) )
if (!explicitlyRetryExhRequest(10, request)) { if (!explicitlyRetryExhRequest(10, request)) {
if (prefs.exhLenientSync().get()) { if (exhPreferences.exhLenientSync().get()) {
errorList += FavoritesSyncStatus.SyncError.GallerySyncError.UnableToDeleteFromRemote errorList += FavoritesSyncStatus.SyncError.GallerySyncError.UnableToDeleteFromRemote
} else { } else {
status.value = FavoritesSyncStatus.SyncError.GallerySyncError.UnableToDeleteFromRemote status.value = FavoritesSyncStatus.SyncError.GallerySyncError.UnableToDeleteFromRemote
@ -386,7 +386,7 @@ class FavoritesSyncHelper(val context: Context) {
is GalleryAddEvent.Fail.UnknownSource -> FavoritesSyncStatus.SyncError.GallerySyncError.InvalidGalleryFail(it.title, result.galleryUrl) is GalleryAddEvent.Fail.UnknownSource -> FavoritesSyncStatus.SyncError.GallerySyncError.InvalidGalleryFail(it.title, result.galleryUrl)
} }
if (prefs.exhLenientSync().get()) { if (exhPreferences.exhLenientSync().get()) {
errorList += error errorList += error
} else { } else {
status.value = error status.value = error

View file

@ -16,14 +16,16 @@ class MangaDexLoginActivity : BaseOAuthLoginActivity() {
val code = uri.getQueryParameter("code") val code = uri.getQueryParameter("code")
if (code != null) { if (code != null) {
lifecycleScope.launchIO { lifecycleScope.launchIO {
Injekt.get<SourceManager>().isInitialized.first { it } val sourceManager = Injekt.get<SourceManager>()
MdUtil.getEnabledMangaDex(Injekt.get())?.login(code) sourceManager.isInitialized.first { it }
MdUtil.getEnabledMangaDex(sourceManager = sourceManager)?.login(code)
returnToSettings() returnToSettings()
} }
} else { } else {
lifecycleScope.launchIO { lifecycleScope.launchIO {
Injekt.get<SourceManager>().isInitialized.first { it } val sourceManager = Injekt.get<SourceManager>()
MdUtil.getEnabledMangaDex(Injekt.get())?.logout() sourceManager.isInitialized.first { it }
MdUtil.getEnabledMangaDex(sourceManager = sourceManager)?.logout()
returnToSettings() returnToSettings()
} }
} }

View file

@ -19,7 +19,6 @@ import exh.source.getMainSource
import exh.util.dropBlank import exh.util.dropBlank
import exh.util.floor import exh.util.floor
import exh.util.nullIfZero import exh.util.nullIfZero
import kotlinx.serialization.encodeToString
import kotlinx.serialization.json.Json import kotlinx.serialization.json.Json
import okhttp3.FormBody import okhttp3.FormBody
import okhttp3.Headers import okhttp3.Headers
@ -28,7 +27,6 @@ import okhttp3.Request
import okhttp3.RequestBody import okhttp3.RequestBody
import okhttp3.RequestBody.Companion.toRequestBody import okhttp3.RequestBody.Companion.toRequestBody
import org.jsoup.parser.Parser import org.jsoup.parser.Parser
import tachiyomi.domain.UnsortedPreferences
import tachiyomi.domain.source.service.SourceManager import tachiyomi.domain.source.service.SourceManager
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
@ -234,9 +232,9 @@ class MdUtil {
return codeVerifier ?: PkceUtil.generateCodeVerifier().also { codeVerifier = it } return codeVerifier ?: PkceUtil.generateCodeVerifier().also { codeVerifier = it }
} }
fun getEnabledMangaDex(preferences: UnsortedPreferences, sourcePreferences: SourcePreferences = Injekt.get(), sourceManager: SourceManager = Injekt.get()): MangaDex? { fun getEnabledMangaDex(sourcePreferences: SourcePreferences = Injekt.get(), sourceManager: SourceManager = Injekt.get()): MangaDex? {
return getEnabledMangaDexs(sourcePreferences, sourceManager).let { mangadexs -> return getEnabledMangaDexs(sourcePreferences, sourceManager).let { mangadexs ->
preferences.preferredMangaDexId().get().toLongOrNull()?.nullIfZero() sourcePreferences.preferredMangaDexId().get().toLongOrNull()?.nullIfZero()
?.let { preferredMangaDexId -> ?.let { preferredMangaDexId ->
mangadexs.firstOrNull { it.id == preferredMangaDexId } mangadexs.firstOrNull { it.id == preferredMangaDexId }
} }

View file

@ -6,9 +6,9 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.viewinterop.AndroidView import androidx.compose.ui.viewinterop.AndroidView
import eu.kanade.domain.source.service.SourcePreferences
import eu.kanade.presentation.components.AdaptiveSheet import eu.kanade.presentation.components.AdaptiveSheet
import eu.kanade.tachiyomi.databinding.RecommendationSearchBottomSheetBinding import eu.kanade.tachiyomi.databinding.RecommendationSearchBottomSheetBinding
import tachiyomi.domain.UnsortedPreferences
import uy.kohesive.injekt.injectLazy import uy.kohesive.injekt.injectLazy
@Composable @Composable
@ -30,7 +30,7 @@ fun RecommendationSearchBottomSheetDialog(
} }
class RecommendationSearchBottomSheetDialogState(private val onSearchRequest: () -> Unit) { class RecommendationSearchBottomSheetDialogState(private val onSearchRequest: () -> Unit) {
private val preferences: UnsortedPreferences by injectLazy() private val preferences: SourcePreferences by injectLazy()
fun initPreferences(binding: RecommendationSearchBottomSheetBinding) { fun initPreferences(binding: RecommendationSearchBottomSheetBinding) {
val flags = preferences.recommendationSearchFlags().get() val flags = preferences.recommendationSearchFlags().get()

View file

@ -6,6 +6,7 @@ import android.os.PowerManager
import androidx.annotation.StringRes import androidx.annotation.StringRes
import androidx.core.net.toUri import androidx.core.net.toUri
import eu.kanade.domain.manga.model.toSManga import eu.kanade.domain.manga.model.toSManga
import eu.kanade.domain.source.service.SourcePreferences
import eu.kanade.tachiyomi.source.model.SManga import eu.kanade.tachiyomi.source.model.SManga
import exh.log.xLog import exh.log.xLog
import exh.recs.sources.RecommendationPagingSource import exh.recs.sources.RecommendationPagingSource
@ -27,7 +28,6 @@ import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import mihon.domain.manga.model.toDomainManga import mihon.domain.manga.model.toDomainManga
import tachiyomi.data.source.NoResultsException import tachiyomi.data.source.NoResultsException
import tachiyomi.domain.UnsortedPreferences
import tachiyomi.domain.library.model.LibraryManga import tachiyomi.domain.library.model.LibraryManga
import tachiyomi.domain.manga.interactor.GetLibraryManga import tachiyomi.domain.manga.interactor.GetLibraryManga
import tachiyomi.domain.manga.interactor.NetworkToLocalManga import tachiyomi.domain.manga.interactor.NetworkToLocalManga
@ -45,7 +45,7 @@ class RecommendationSearchHelper(val context: Context) {
private val getLibraryManga: GetLibraryManga by injectLazy() private val getLibraryManga: GetLibraryManga by injectLazy()
private val getTracks: GetTracks by injectLazy() private val getTracks: GetTracks by injectLazy()
private val networkToLocalManga: NetworkToLocalManga by injectLazy() private val networkToLocalManga: NetworkToLocalManga by injectLazy()
private val prefs: UnsortedPreferences by injectLazy() private val preferences: SourcePreferences by injectLazy()
private var wifiLock: WifiManager.WifiLock? = null private var wifiLock: WifiManager.WifiLock? = null
private var wakeLock: PowerManager.WakeLock? = null private var wakeLock: PowerManager.WakeLock? = null
@ -68,7 +68,7 @@ class RecommendationSearchHelper(val context: Context) {
} }
private suspend fun beginSearch(mangaList: List<Manga>) { private suspend fun beginSearch(mangaList: List<Manga>) {
val flags = prefs.recommendationSearchFlags().get() val flags = preferences.recommendationSearchFlags().get()
val libraryManga = getLibraryManga.await() val libraryManga = getLibraryManga.await()
val tracks = getTracks.await() val tracks = getTracks.await()
@ -192,7 +192,7 @@ class RecommendationSearchHelper(val context: Context) {
libraryManga: List<LibraryManga>, libraryManga: List<LibraryManga>,
tracks: List<Track>, tracks: List<Track>,
): List<SManga> { ): List<SManga> {
val flags = prefs.recommendationSearchFlags().get() val flags = preferences.recommendationSearchFlags().get()
if (!SearchFlags.hasHideLibraryResults(flags)) { if (!SearchFlags.hasHideLibraryResults(flags)) {
return this return this

View file

@ -8,19 +8,19 @@ import exh.log.maybeInjectEHLogger
import exh.log.xLogD import exh.log.xLogD
import exh.source.EH_SOURCE_ID import exh.source.EH_SOURCE_ID
import exh.source.EXH_SOURCE_ID import exh.source.EXH_SOURCE_ID
import exh.source.ExhPreferences
import okhttp3.FormBody import okhttp3.FormBody
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.Request import okhttp3.Request
import tachiyomi.core.common.i18n.stringResource import tachiyomi.core.common.i18n.stringResource
import tachiyomi.domain.UnsortedPreferences
import tachiyomi.domain.source.service.SourceManager import tachiyomi.domain.source.service.SourceManager
import tachiyomi.i18n.sy.SYMR import tachiyomi.i18n.sy.SYMR
import uy.kohesive.injekt.injectLazy import uy.kohesive.injekt.injectLazy
import java.util.Locale import java.util.Locale
class EHConfigurator(val context: Context) { class EHConfigurator(val context: Context) {
private val prefs: UnsortedPreferences by injectLazy() private val exhPreferences: ExhPreferences by injectLazy()
private val sources: SourceManager by injectLazy() private val sourceManager: SourceManager by injectLazy()
private val configuratorClient = OkHttpClient.Builder() private val configuratorClient = OkHttpClient.Builder()
.maybeInjectEHLogger() .maybeInjectEHLogger()
@ -52,8 +52,8 @@ class EHConfigurator(val context: Context) {
private val EHentai.uconfigUrl get() = baseUrl + UCONFIG_URL private val EHentai.uconfigUrl get() = baseUrl + UCONFIG_URL
suspend fun configureAll() { suspend fun configureAll() {
val ehSource = sources.get(EH_SOURCE_ID) as EHentai val ehSource = sourceManager.get(EH_SOURCE_ID) as EHentai
val exhSource = sources.get(EXH_SOURCE_ID) as EHentai val exhSource = sourceManager.get(EXH_SOURCE_ID) as EHentai
// Get hath perks // Get hath perks
val perksPage = configuratorClient.newCall( val perksPage = configuratorClient.newCall(
@ -146,13 +146,13 @@ class EHConfigurator(val context: Context) {
}?.removePrefix("hath_perks=")?.substringBefore(';') }?.removePrefix("hath_perks=")?.substringBefore(';')
if (keyCookie != null) { if (keyCookie != null) {
prefs.exhSettingsKey().set(keyCookie) exhPreferences.exhSettingsKey().set(keyCookie)
} }
if (sessionCookie != null) { if (sessionCookie != null) {
prefs.exhSessionCookie().set(sessionCookie) exhPreferences.exhSessionCookie().set(sessionCookie)
} }
if (hathPerksCookie != null) { if (hathPerksCookie != null) {
prefs.exhHathPerksCookies().set(hathPerksCookie) exhPreferences.exhHathPerksCookies().set(hathPerksCookie)
} }
} }

View file

@ -1,18 +1,18 @@
package exh.uconfig package exh.uconfig
import exh.source.ExhPreferences
import okhttp3.FormBody import okhttp3.FormBody
import tachiyomi.domain.UnsortedPreferences
import uy.kohesive.injekt.injectLazy import uy.kohesive.injekt.injectLazy
import java.util.Locale import java.util.Locale
class EhUConfigBuilder { class EhUConfigBuilder {
private val preferences: UnsortedPreferences by injectLazy() private val exhPreferences: ExhPreferences by injectLazy()
fun build(hathPerks: EHHathPerksResponse): FormBody { fun build(hathPerks: EHHathPerksResponse): FormBody {
val configItems = mutableListOf<ConfigItem>() val configItems = mutableListOf<ConfigItem>()
configItems += when ( configItems += when (
preferences.imageQuality() exhPreferences.imageQuality()
.get() .get()
.lowercase(Locale.getDefault()) .lowercase(Locale.getDefault())
) { ) {
@ -25,19 +25,19 @@ class EhUConfigBuilder {
else -> Entry.ImageSize.AUTO else -> Entry.ImageSize.AUTO
} }
configItems += when (preferences.useHentaiAtHome().get()) { configItems += when (exhPreferences.useHentaiAtHome().get()) {
2 -> Entry.UseHentaiAtHome.NO 2 -> Entry.UseHentaiAtHome.NO
1 -> Entry.UseHentaiAtHome.DEFAULTONLY 1 -> Entry.UseHentaiAtHome.DEFAULTONLY
else -> Entry.UseHentaiAtHome.ANY else -> Entry.UseHentaiAtHome.ANY
} }
configItems += if (preferences.useJapaneseTitle().get()) { configItems += if (exhPreferences.useJapaneseTitle().get()) {
Entry.TitleDisplayLanguage.JAPANESE Entry.TitleDisplayLanguage.JAPANESE
} else { } else {
Entry.TitleDisplayLanguage.DEFAULT Entry.TitleDisplayLanguage.DEFAULT
} }
configItems += if (preferences.exhUseOriginalImages().get()) { configItems += if (exhPreferences.exhUseOriginalImages().get()) {
Entry.UseOriginalImages.YES Entry.UseOriginalImages.YES
} else { } else {
Entry.UseOriginalImages.NO Entry.UseOriginalImages.NO
@ -61,13 +61,13 @@ class EhUConfigBuilder {
configItems += Entry.UseMPV() configItems += Entry.UseMPV()
configItems += Entry.ShowPopularRightNowPane() configItems += Entry.ShowPopularRightNowPane()
configItems += Entry.TagFilteringThreshold(preferences.ehTagFilterValue().get()) configItems += Entry.TagFilteringThreshold(exhPreferences.ehTagFilterValue().get())
configItems += Entry.TagWatchingThreshold(preferences.ehTagWatchingValue().get()) configItems += Entry.TagWatchingThreshold(exhPreferences.ehTagWatchingValue().get())
configItems += Entry.LanguageSystem().getLanguages(preferences.exhSettingsLanguages().get().split("\n")) configItems += Entry.LanguageSystem().getLanguages(exhPreferences.exhSettingsLanguages().get().split("\n"))
configItems += Entry.Categories().categoryConfigs( configItems += Entry.Categories().categoryConfigs(
preferences.exhEnabledCategories().get().split(",").map { exhPreferences.exhEnabledCategories().get().split(",").map {
it.toBoolean() it.toBoolean()
}, },
) )

View file

@ -8,6 +8,7 @@ import eu.kanade.core.preference.asState
import exh.GalleryAddEvent import exh.GalleryAddEvent
import exh.GalleryAdder import exh.GalleryAdder
import exh.log.xLogE import exh.log.xLogE
import exh.source.ExhPreferences
import exh.util.trimOrNull import exh.util.trimOrNull
import kotlinx.coroutines.CoroutineExceptionHandler import kotlinx.coroutines.CoroutineExceptionHandler
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
@ -16,18 +17,17 @@ import kotlinx.coroutines.flow.update
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import tachiyomi.core.common.i18n.stringResource import tachiyomi.core.common.i18n.stringResource
import tachiyomi.core.common.util.lang.withIOContext import tachiyomi.core.common.util.lang.withIOContext
import tachiyomi.domain.UnsortedPreferences
import tachiyomi.i18n.sy.SYMR import tachiyomi.i18n.sy.SYMR
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
class BatchAddScreenModel( class BatchAddScreenModel(
private val unsortedPreferences: UnsortedPreferences = Injekt.get(), private val exhPreferences: ExhPreferences = Injekt.get(),
) : StateScreenModel<BatchAddState>(BatchAddState()) { ) : StateScreenModel<BatchAddState>(BatchAddState()) {
private val galleryAdder by lazy { GalleryAdder() } private val galleryAdder by lazy { GalleryAdder() }
// KMK --> // KMK -->
val isHentaiEnabled by Injekt.get<UnsortedPreferences>().isHentaiEnabled().asState(screenModelScope) val isHentaiEnabled by Injekt.get<ExhPreferences>().isHentaiEnabled().asState(screenModelScope)
// KMK <-- // KMK <--
fun addGalleries(context: Context) { fun addGalleries(context: Context) {
@ -43,7 +43,7 @@ class BatchAddScreenModel(
private fun addGalleries(context: Context, galleries: String) { private fun addGalleries(context: Context, galleries: String) {
val splitGalleries = if (ehVisitedRegex.containsMatchIn(galleries)) { val splitGalleries = if (ehVisitedRegex.containsMatchIn(galleries)) {
val url = if (unsortedPreferences.enableExhentai().get()) { val url = if (exhPreferences.enableExhentai().get()) {
"https://exhentai.org/g/" "https://exhentai.org/g/"
} else { } else {
"https://e-hentai.org/g/" "https://e-hentai.org/g/"
@ -137,7 +137,7 @@ class BatchAddScreenModel(
} }
sealed class Dialog { sealed class Dialog {
object NoGalleriesSpecified : Dialog() data object NoGalleriesSpecified : Dialog()
} }
companion object { companion object {

View file

@ -1,9 +1,7 @@
package exh.ui.login package exh.ui.login
import android.app.Activity
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.net.Uri
import android.os.Build import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.webkit.CookieManager import android.webkit.CookieManager
@ -13,6 +11,7 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue import androidx.compose.runtime.setValue
import androidx.core.net.toUri
import eu.kanade.presentation.webview.EhLoginWebViewScreen import eu.kanade.presentation.webview.EhLoginWebViewScreen
import eu.kanade.presentation.webview.components.IgneousDialog import eu.kanade.presentation.webview.components.IgneousDialog
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
@ -21,7 +20,7 @@ import eu.kanade.tachiyomi.util.system.WebViewUtil
import eu.kanade.tachiyomi.util.system.toast import eu.kanade.tachiyomi.util.system.toast
import eu.kanade.tachiyomi.util.view.setComposeContent import eu.kanade.tachiyomi.util.view.setComposeContent
import exh.log.xLogD import exh.log.xLogD
import tachiyomi.domain.UnsortedPreferences import exh.source.ExhPreferences
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import uy.kohesive.injekt.injectLazy import uy.kohesive.injekt.injectLazy
import java.net.HttpCookie import java.net.HttpCookie
@ -31,12 +30,12 @@ import java.util.Locale
* LoginController * LoginController
*/ */
class EhLoginActivity : BaseActivity() { class EhLoginActivity : BaseActivity() {
private val preferenceManager: UnsortedPreferences by injectLazy() private val exhPreferences: ExhPreferences by injectLazy()
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
overrideActivityTransition( overrideActivityTransition(
Activity.OVERRIDE_TRANSITION_OPEN, OVERRIDE_TRANSITION_OPEN,
R.anim.shared_axis_x_push_enter, R.anim.shared_axis_x_push_enter,
R.anim.shared_axis_x_push_exit, R.anim.shared_axis_x_push_exit,
) )
@ -92,7 +91,7 @@ class EhLoginActivity : BaseActivity() {
private fun onPageFinished(view: WebView, url: String, customIgneous: String?) { private fun onPageFinished(view: WebView, url: String, customIgneous: String?) {
xLogD(url) xLogD(url)
val parsedUrl = Uri.parse(url) val parsedUrl = url.toUri()
if (parsedUrl.host.equals("forums.e-hentai.org", ignoreCase = true)) { if (parsedUrl.host.equals("forums.e-hentai.org", ignoreCase = true)) {
// Hide distracting content // Hide distracting content
if (!parsedUrl.queryParameterNames.contains(PARAM_SKIP_INJECT)) { if (!parsedUrl.queryParameterNames.contains(PARAM_SKIP_INJECT)) {
@ -106,7 +105,7 @@ class EhLoginActivity : BaseActivity() {
} else if (parsedUrl.host.equals("exhentai.org", ignoreCase = true)) { } else if (parsedUrl.host.equals("exhentai.org", ignoreCase = true)) {
// At ExHentai, check that everything worked out... // At ExHentai, check that everything worked out...
if (applyExHentaiCookies(url, customIgneous)) { if (applyExHentaiCookies(url, customIgneous)) {
preferenceManager.enableExhentai().set(true) exhPreferences.enableExhentai().set(true)
setResult(RESULT_OK) setResult(RESULT_OK)
finish() finish()
} }
@ -155,9 +154,9 @@ class EhLoginActivity : BaseActivity() {
if (memberId == null || passHash == null || igneous == null) return false if (memberId == null || passHash == null || igneous == null) return false
// Update prefs // Update prefs
preferenceManager.memberIdVal().set(memberId!!) exhPreferences.memberIdVal().set(memberId)
preferenceManager.passHashVal().set(passHash!!) exhPreferences.passHashVal().set(passHash)
preferenceManager.igneousVal().set(igneous!!) exhPreferences.igneousVal().set(igneous)
return true return true
} }
@ -175,7 +174,7 @@ class EhLoginActivity : BaseActivity() {
super.finish() super.finish()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
overrideActivityTransition( overrideActivityTransition(
Activity.OVERRIDE_TRANSITION_CLOSE, OVERRIDE_TRANSITION_CLOSE,
R.anim.shared_axis_x_pop_enter, R.anim.shared_axis_x_pop_enter,
R.anim.shared_axis_x_pop_exit, R.anim.shared_axis_x_pop_exit,
) )

View file

@ -1,15 +1,15 @@
package mihon.core.migration.migrations package mihon.core.migration.migrations
import exh.source.ExhPreferences
import mihon.core.migration.Migration import mihon.core.migration.Migration
import mihon.core.migration.MigrationContext import mihon.core.migration.MigrationContext
import tachiyomi.core.common.util.lang.withIOContext import tachiyomi.core.common.util.lang.withIOContext
import tachiyomi.domain.UnsortedPreferences
class IntegratedHentaiMigration : Migration { class IntegratedHentaiMigration : Migration {
override val version: Float = 71f override val version: Float = 71f
override suspend fun invoke(migrationContext: MigrationContext): Boolean = withIOContext { override suspend fun invoke(migrationContext: MigrationContext): Boolean = withIOContext {
val isHentaiEnabled = migrationContext.get<UnsortedPreferences>()?.isHentaiEnabled() val isHentaiEnabled = migrationContext.get<ExhPreferences>()?.isHentaiEnabled()
?: return@withIOContext false ?: return@withIOContext false
if (!isHentaiEnabled.isSet() || isHentaiEnabled.get()) { if (!isHentaiEnabled.isSet() || isHentaiEnabled.get()) {
isHentaiEnabled.set(true) isHentaiEnabled.set(true)

View file

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?attr/colorControlHighlight">
<item>
<selector>
<item android:state_selected="true">
<color android:color="?attr/colorControlHighlight" />
</item>
<item android:state_activated="true">
<color android:color="?attr/colorControlHighlight" />
</item>
<item>
<color android:color="?android:attr/colorBackground" />
</item>
</selector>
</item>
</ripple>

View file

@ -1,47 +1,53 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout <com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/container"
android:backgroundTint="@android:color/transparent" android:backgroundTint="@android:color/transparent"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/list_item_selector_background"> app:cardBackgroundColor="?android:attr/colorBackground"
app:cardElevation="0dp"
app:cardForegroundColor="@color/draggable_card_foreground">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView <ImageView
android:id="@+id/image" android:id="@+id/image"
android:layout_width="60dp" android:layout_width="60dp"
android:layout_height="60dp" android:layout_height="60dp"
android:paddingStart="8dp" android:paddingStart="8dp"
android:paddingEnd="8dp" android:paddingEnd="8dp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@mipmap/ic_launcher" /> app:srcCompat="@drawable/anim_browse_enter" />
<TextView <TextView
android:id="@+id/title" android:id="@+id/title"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
android:ellipsize="end" android:ellipsize="end"
android:gravity="center_vertical" android:gravity="center_vertical"
android:maxLines="1" android:maxLines="1"
android:paddingStart="8dp" android:paddingStart="8dp"
android:text="Title" android:text="Title"
android:textAppearance="?attr/textAppearanceTitleSmall" android:textAppearance="?attr/textAppearanceTitleSmall"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/reorder" app:layout_constraintEnd_toStartOf="@+id/reorder"
app:layout_constraintStart_toEndOf="@+id/image" app:layout_constraintStart_toEndOf="@+id/image"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<ImageView <ImageView
android:id="@+id/reorder" android:id="@+id/reorder"
android:layout_width="60dp" android:layout_width="60dp"
android:layout_height="60dp" android:layout_height="60dp"
android:scaleType="center" android:scaleType="center"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_drag_handle_24dp" app:srcCompat="@drawable/ic_drag_handle_24dp"
app:tint="?android:attr/textColorHint" /> app:tint="?android:attr/textColorHint" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>

View file

@ -99,9 +99,5 @@ class HistoryRepositoryImpl(
logcat(LogPriority.ERROR, throwable = e) logcat(LogPriority.ERROR, throwable = e)
} }
} }
override suspend fun getByMangaId(mangaId: Long): List<History> {
return handler.awaitList { historyQueries.getHistoryByMangaId(mangaId, HistoryMapper::mapHistory) }
}
// SY <-- // SY <--
} }

View file

@ -1,10 +1,10 @@
package tachiyomi.domain package exh.source
import tachiyomi.core.common.preference.Preference import tachiyomi.core.common.preference.Preference
import tachiyomi.core.common.preference.PreferenceStore import tachiyomi.core.common.preference.PreferenceStore
import tachiyomi.domain.release.service.AppUpdatePolicy import tachiyomi.domain.release.service.AppUpdatePolicy
class UnsortedPreferences( class ExhPreferences(
private val preferenceStore: PreferenceStore, private val preferenceStore: PreferenceStore,
) { ) {
// KMK --> // KMK -->
@ -17,32 +17,13 @@ class UnsortedPreferences(
// KMK <-- // KMK <--
// SY --> // SY -->
fun migrateFlags() = preferenceStore.getInt("migrate_flags", Int.MAX_VALUE)
fun defaultMangaOrder() = preferenceStore.getString("default_manga_order", "")
fun migrationSources() = preferenceStore.getString("migrate_sources", "")
fun smartMigration() = preferenceStore.getBoolean("smart_migrate", false)
fun useSourceWithMost() = preferenceStore.getBoolean("use_source_with_most", false)
fun skipPreMigration() = preferenceStore.getBoolean(Preference.appStateKey("skip_pre_migration"), false)
fun hideNotFoundMigration() = preferenceStore.getBoolean("hide_not_found_migration", false)
fun showOnlyUpdatesMigration() = preferenceStore.getBoolean("show_only_updates_migration", false)
fun recommendationSearchFlags() = preferenceStore.getInt("rec_search_flags", Int.MAX_VALUE)
fun isHentaiEnabled() = preferenceStore.getBoolean("eh_is_hentai_enabled", false) fun isHentaiEnabled() = preferenceStore.getBoolean("eh_is_hentai_enabled", false)
// KMK --> // KMK -->
fun ehIncognitoMode() = preferenceStore.getBoolean("eh_incognito_mode", false) fun ehIncognitoMode() = preferenceStore.getBoolean("eh_incognito_mode", false)
// KMK <-- // KMK <--
fun enableExhentai() = preferenceStore.getBoolean(Preference.privateKey("enable_exhentai"), false) fun enableExhentai() = preferenceStore.getBoolean(Preference.Companion.privateKey("enable_exhentai"), false)
fun imageQuality() = preferenceStore.getString("ehentai_quality", "auto") fun imageQuality() = preferenceStore.getString("ehentai_quality", "auto")
@ -57,15 +38,15 @@ class UnsortedPreferences(
fun ehTagWatchingValue() = preferenceStore.getInt("eh_tag_watching_value", 0) fun ehTagWatchingValue() = preferenceStore.getInt("eh_tag_watching_value", 0)
// EH Cookies // EH Cookies
fun memberIdVal() = preferenceStore.getString(Preference.privateKey("eh_ipb_member_id"), "") fun memberIdVal() = preferenceStore.getString(Preference.Companion.privateKey("eh_ipb_member_id"), "")
fun passHashVal() = preferenceStore.getString(Preference.privateKey("eh_ipb_pass_hash"), "") fun passHashVal() = preferenceStore.getString(Preference.Companion.privateKey("eh_ipb_pass_hash"), "")
fun igneousVal() = preferenceStore.getString(Preference.privateKey("eh_igneous"), "") fun igneousVal() = preferenceStore.getString(Preference.Companion.privateKey("eh_igneous"), "")
fun ehSettingsProfile() = preferenceStore.getInt(Preference.privateKey("eh_ehSettingsProfile"), -1) fun ehSettingsProfile() = preferenceStore.getInt(Preference.Companion.privateKey("eh_ehSettingsProfile"), -1)
fun exhSettingsProfile() = preferenceStore.getInt(Preference.privateKey("eh_exhSettingsProfile"), -1) fun exhSettingsProfile() = preferenceStore.getInt(Preference.Companion.privateKey("eh_exhSettingsProfile"), -1)
fun exhSettingsKey() = preferenceStore.getString(Preference.privateKey("eh_settingsKey"), "") fun exhSettingsKey() = preferenceStore.getString(Preference.Companion.privateKey("eh_settingsKey"), "")
fun exhSessionCookie() = preferenceStore.getString(Preference.privateKey("eh_sessionCookie"), "") fun exhSessionCookie() = preferenceStore.getString(Preference.Companion.privateKey("eh_sessionCookie"), "")
fun exhHathPerksCookies() = preferenceStore.getString(Preference.privateKey("eh_hathPerksCookie"), "") fun exhHathPerksCookies() = preferenceStore.getString(Preference.Companion.privateKey("eh_hathPerksCookie"), "")
fun exhShowSyncIntro() = preferenceStore.getBoolean("eh_show_sync_intro", true) fun exhShowSyncIntro() = preferenceStore.getBoolean("eh_show_sync_intro", true)
@ -81,7 +62,7 @@ class UnsortedPreferences(
fun exhAutoUpdateRequirements() = preferenceStore.getStringSet("eh_auto_update_restrictions", emptySet()) fun exhAutoUpdateRequirements() = preferenceStore.getStringSet("eh_auto_update_restrictions", emptySet())
fun exhAutoUpdateStats() = preferenceStore.getString(Preference.appStateKey("eh_auto_update_stats"), "") fun exhAutoUpdateStats() = preferenceStore.getString(Preference.Companion.appStateKey("eh_auto_update_stats"), "")
fun exhWatchedListDefaultState() = preferenceStore.getBoolean("eh_watched_list_default_state", false) fun exhWatchedListDefaultState() = preferenceStore.getBoolean("eh_watched_list_default_state", false)
@ -99,13 +80,4 @@ class UnsortedPreferences(
) )
fun enhancedEHentaiView() = preferenceStore.getBoolean("enhanced_e_hentai_view", true) fun enhancedEHentaiView() = preferenceStore.getBoolean("enhanced_e_hentai_view", true)
fun preferredMangaDexId() = preferenceStore.getString("preferred_mangaDex_id", "0")
fun mangadexSyncToLibraryIndexes() = preferenceStore.getStringSet(
"pref_mangadex_sync_to_library_indexes",
emptySet(),
)
fun allowLocalSourceHiddenFolders() = preferenceStore.getBoolean("allow_local_source_hidden_folders", false)
} }

View file

@ -1,13 +0,0 @@
package tachiyomi.domain.history.interactor
import tachiyomi.domain.history.model.History
import tachiyomi.domain.history.repository.HistoryRepository
class GetHistoryByMangaId(
private val repository: HistoryRepository,
) {
suspend fun await(mangaId: Long): List<History> {
return repository.getByMangaId(mangaId)
}
}

View file

@ -25,7 +25,5 @@ interface HistoryRepository {
// SY --> // SY -->
suspend fun upsertHistory(historyUpdates: List<HistoryUpdate>) suspend fun upsertHistory(historyUpdates: List<HistoryUpdate>)
suspend fun getByMangaId(mangaId: Long): List<History>
// SY <-- // SY <--
} }