From bebd4be43d73617de2cfbc1ff4289e81f535a8e6 Mon Sep 17 00:00:00 2001 From: arkon Date: Tue, 7 Mar 2023 22:38:02 -0500 Subject: [PATCH] Move more things to domain/data modules --- .../java/eu/kanade/domain/DomainModule.kt | 20 +++++----- .../source/interactor/GetEnabledSources.kt | 2 +- .../interactor/GetLanguagesWithSources.kt | 2 +- .../interactor/GetSourcesWithFavoriteCount.kt | 2 +- .../settings/screen/ClearDatabaseScreen.kt | 2 +- .../settings/screen/SettingsAdvancedScreen.kt | 2 +- .../settings/screen/SettingsGeneralScreen.kt | 2 +- .../settings/screen/SettingsLibraryScreen.kt | 18 ++++----- .../java/eu/kanade/tachiyomi/AppModule.kt | 2 +- .../java/eu/kanade/tachiyomi/Migrations.kt | 4 +- .../tachiyomi/data/backup/BackupManager.kt | 2 +- .../data/library/LibraryUpdateJob.kt | 16 ++++---- .../data/preference/PreferenceValues.kt | 9 ----- .../source/browse/BrowseSourceScreenModel.kt | 6 +-- .../ui/category/CategoryScreenModel.kt | 2 +- .../ui/history/HistoryScreenModel.kt | 2 +- .../eu/kanade/tachiyomi/ui/home/HomeScreen.kt | 2 +- .../ui/library/LibraryScreenModel.kt | 4 +- .../ui/library/LibrarySettingsScreenModel.kt | 6 +-- .../kanade/tachiyomi/ui/main/MainActivity.kt | 2 +- .../tachiyomi/ui/manga/MangaScreenModel.kt | 4 +- .../tachiyomi/ui/reader/ReaderViewModel.kt | 2 +- .../tachiyomi/ui/stats/StatsScreenModel.kt | 8 ++-- .../ui/updates/UpdatesScreenModel.kt | 2 +- .../data/source/SourcePagingSource.kt | 38 +++++++++---------- .../data/source/SourceRepositoryImpl.kt | 10 ++--- domain/build.gradle.kts | 2 + .../interactor/CreateCategoryWithName.kt | 4 +- .../category/interactor/ResetCategoryFlags.kt | 4 +- .../interactor/SetDisplayModeForCategory.kt | 4 +- .../interactor/SetSortModeForCategory.kt | 4 +- .../interactor/SetDefaultChapterSettings.kt | 4 +- .../history/interactor/GetNextChapters.kt | 2 +- .../library/service/LibraryPreferences.kt | 33 ++++++++++++---- .../source/interactor/GetRemoteManga.kt | 6 +-- .../GetSourcesWithNonLibraryManga.kt | 4 +- .../source/repository/SourceRepository.kt | 7 +++- 37 files changed, 127 insertions(+), 118 deletions(-) rename {app/src/main/java/eu/kanade => data/src/main/java/tachiyomi}/data/source/SourceRepositoryImpl.kt (89%) rename {app/src/main/java/eu/kanade => domain/src/main/java/tachiyomi}/domain/category/interactor/CreateCategoryWithName.kt (92%) rename {app/src/main/java/eu/kanade => domain/src/main/java/tachiyomi}/domain/category/interactor/ResetCategoryFlags.kt (82%) rename {app/src/main/java/eu/kanade => domain/src/main/java/tachiyomi}/domain/category/interactor/SetDisplayModeForCategory.kt (91%) rename {app/src/main/java/eu/kanade => domain/src/main/java/tachiyomi}/domain/category/interactor/SetSortModeForCategory.kt (91%) rename {app/src/main/java/eu/kanade => domain/src/main/java/tachiyomi}/domain/chapter/interactor/SetDefaultChapterSettings.kt (92%) rename {app/src/main/java/eu/kanade => domain/src/main/java/tachiyomi}/domain/history/interactor/GetNextChapters.kt (97%) rename {app/src/main/java/eu/kanade => domain/src/main/java/tachiyomi}/domain/library/service/LibraryPreferences.kt (86%) rename {app/src/main/java/eu/kanade => domain/src/main/java/tachiyomi}/domain/source/interactor/GetRemoteManga.kt (79%) rename {app/src/main/java/eu/kanade => domain/src/main/java/tachiyomi}/domain/source/interactor/GetSourcesWithNonLibraryManga.kt (74%) rename {app/src/main/java/eu/kanade => domain/src/main/java/tachiyomi}/domain/source/repository/SourceRepository.kt (77%) diff --git a/app/src/main/java/eu/kanade/domain/DomainModule.kt b/app/src/main/java/eu/kanade/domain/DomainModule.kt index e4c39c452..571104cd3 100644 --- a/app/src/main/java/eu/kanade/domain/DomainModule.kt +++ b/app/src/main/java/eu/kanade/domain/DomainModule.kt @@ -1,11 +1,5 @@ package eu.kanade.domain -import eu.kanade.data.source.SourceRepositoryImpl -import eu.kanade.domain.category.interactor.CreateCategoryWithName -import eu.kanade.domain.category.interactor.ResetCategoryFlags -import eu.kanade.domain.category.interactor.SetDisplayModeForCategory -import eu.kanade.domain.category.interactor.SetSortModeForCategory -import eu.kanade.domain.chapter.interactor.SetMangaDefaultChapterFlags import eu.kanade.domain.chapter.interactor.SetReadStatus import eu.kanade.domain.chapter.interactor.SyncChaptersWithSource import eu.kanade.domain.chapter.interactor.SyncChaptersWithTrackServiceTwoWay @@ -13,39 +7,42 @@ import eu.kanade.domain.download.interactor.DeleteDownload import eu.kanade.domain.extension.interactor.GetExtensionLanguages import eu.kanade.domain.extension.interactor.GetExtensionSources import eu.kanade.domain.extension.interactor.GetExtensionsByType -import eu.kanade.domain.history.interactor.GetNextChapters import eu.kanade.domain.manga.interactor.SetMangaViewerFlags import eu.kanade.domain.manga.interactor.UpdateManga import eu.kanade.domain.source.interactor.GetEnabledSources import eu.kanade.domain.source.interactor.GetLanguagesWithSources -import eu.kanade.domain.source.interactor.GetRemoteManga import eu.kanade.domain.source.interactor.GetSourcesWithFavoriteCount -import eu.kanade.domain.source.interactor.GetSourcesWithNonLibraryManga import eu.kanade.domain.source.interactor.SetMigrateSorting import eu.kanade.domain.source.interactor.ToggleLanguage import eu.kanade.domain.source.interactor.ToggleSource import eu.kanade.domain.source.interactor.ToggleSourcePin -import eu.kanade.domain.source.repository.SourceRepository import tachiyomi.data.category.CategoryRepositoryImpl import tachiyomi.data.chapter.ChapterRepositoryImpl import tachiyomi.data.history.HistoryRepositoryImpl import tachiyomi.data.manga.MangaRepositoryImpl import tachiyomi.data.source.SourceDataRepositoryImpl +import tachiyomi.data.source.SourceRepositoryImpl import tachiyomi.data.track.TrackRepositoryImpl import tachiyomi.data.updates.UpdatesRepositoryImpl +import tachiyomi.domain.category.interactor.CreateCategoryWithName import tachiyomi.domain.category.interactor.DeleteCategory import tachiyomi.domain.category.interactor.GetCategories import tachiyomi.domain.category.interactor.RenameCategory import tachiyomi.domain.category.interactor.ReorderCategory +import tachiyomi.domain.category.interactor.ResetCategoryFlags +import tachiyomi.domain.category.interactor.SetDisplayModeForCategory import tachiyomi.domain.category.interactor.SetMangaCategories +import tachiyomi.domain.category.interactor.SetSortModeForCategory import tachiyomi.domain.category.interactor.UpdateCategory import tachiyomi.domain.category.repository.CategoryRepository import tachiyomi.domain.chapter.interactor.GetChapter import tachiyomi.domain.chapter.interactor.GetChapterByMangaId +import tachiyomi.domain.chapter.interactor.SetMangaDefaultChapterFlags import tachiyomi.domain.chapter.interactor.ShouldUpdateDbChapter import tachiyomi.domain.chapter.interactor.UpdateChapter import tachiyomi.domain.chapter.repository.ChapterRepository import tachiyomi.domain.history.interactor.GetHistory +import tachiyomi.domain.history.interactor.GetNextChapters import tachiyomi.domain.history.interactor.GetTotalReadDuration import tachiyomi.domain.history.interactor.RemoveHistory import tachiyomi.domain.history.interactor.UpsertHistory @@ -59,7 +56,10 @@ import tachiyomi.domain.manga.interactor.NetworkToLocalManga import tachiyomi.domain.manga.interactor.ResetViewerFlags import tachiyomi.domain.manga.interactor.SetMangaChapterFlags import tachiyomi.domain.manga.repository.MangaRepository +import tachiyomi.domain.source.interactor.GetRemoteManga +import tachiyomi.domain.source.interactor.GetSourcesWithNonLibraryManga import tachiyomi.domain.source.repository.SourceDataRepository +import tachiyomi.domain.source.repository.SourceRepository import tachiyomi.domain.track.interactor.DeleteTrack import tachiyomi.domain.track.interactor.GetTracks import tachiyomi.domain.track.interactor.GetTracksPerManga diff --git a/app/src/main/java/eu/kanade/domain/source/interactor/GetEnabledSources.kt b/app/src/main/java/eu/kanade/domain/source/interactor/GetEnabledSources.kt index a6fc330af..a595e0c0f 100644 --- a/app/src/main/java/eu/kanade/domain/source/interactor/GetEnabledSources.kt +++ b/app/src/main/java/eu/kanade/domain/source/interactor/GetEnabledSources.kt @@ -1,6 +1,5 @@ package eu.kanade.domain.source.interactor -import eu.kanade.domain.source.repository.SourceRepository import eu.kanade.domain.source.service.SourcePreferences import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.combine @@ -8,6 +7,7 @@ import kotlinx.coroutines.flow.distinctUntilChanged import tachiyomi.domain.source.model.Pin import tachiyomi.domain.source.model.Pins import tachiyomi.domain.source.model.Source +import tachiyomi.domain.source.repository.SourceRepository import tachiyomi.source.local.LocalSource class GetEnabledSources( diff --git a/app/src/main/java/eu/kanade/domain/source/interactor/GetLanguagesWithSources.kt b/app/src/main/java/eu/kanade/domain/source/interactor/GetLanguagesWithSources.kt index fe623f9c8..79b771f18 100644 --- a/app/src/main/java/eu/kanade/domain/source/interactor/GetLanguagesWithSources.kt +++ b/app/src/main/java/eu/kanade/domain/source/interactor/GetLanguagesWithSources.kt @@ -1,11 +1,11 @@ package eu.kanade.domain.source.interactor -import eu.kanade.domain.source.repository.SourceRepository import eu.kanade.domain.source.service.SourcePreferences import eu.kanade.tachiyomi.util.system.LocaleHelper import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.combine import tachiyomi.domain.source.model.Source +import tachiyomi.domain.source.repository.SourceRepository class GetLanguagesWithSources( private val repository: SourceRepository, diff --git a/app/src/main/java/eu/kanade/domain/source/interactor/GetSourcesWithFavoriteCount.kt b/app/src/main/java/eu/kanade/domain/source/interactor/GetSourcesWithFavoriteCount.kt index 8076795c4..0083f0a6c 100644 --- a/app/src/main/java/eu/kanade/domain/source/interactor/GetSourcesWithFavoriteCount.kt +++ b/app/src/main/java/eu/kanade/domain/source/interactor/GetSourcesWithFavoriteCount.kt @@ -1,10 +1,10 @@ package eu.kanade.domain.source.interactor -import eu.kanade.domain.source.repository.SourceRepository import eu.kanade.domain.source.service.SourcePreferences import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.combine import tachiyomi.domain.source.model.Source +import tachiyomi.domain.source.repository.SourceRepository import tachiyomi.source.local.LocalSource import java.text.Collator import java.util.Collections diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/ClearDatabaseScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/ClearDatabaseScreen.kt index 2d8bd1def..a295a5f85 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/ClearDatabaseScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/ClearDatabaseScreen.kt @@ -32,7 +32,6 @@ import cafe.adriel.voyager.core.model.coroutineScope import cafe.adriel.voyager.core.model.rememberScreenModel import cafe.adriel.voyager.navigator.LocalNavigator import cafe.adriel.voyager.navigator.currentOrThrow -import eu.kanade.domain.source.interactor.GetSourcesWithNonLibraryManga import eu.kanade.presentation.browse.components.SourceIcon import eu.kanade.presentation.components.AppBar import eu.kanade.presentation.components.AppBarActions @@ -45,6 +44,7 @@ import tachiyomi.core.util.lang.launchIO import tachiyomi.core.util.lang.launchUI import tachiyomi.core.util.lang.withNonCancellableContext import tachiyomi.data.Database +import tachiyomi.domain.source.interactor.GetSourcesWithNonLibraryManga import tachiyomi.domain.source.model.Source import tachiyomi.domain.source.model.SourceWithCount import tachiyomi.presentation.core.components.FastScrollLazyColumn diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsAdvancedScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsAdvancedScreen.kt index 2afc3f59d..304f8fd9a 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsAdvancedScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsAdvancedScreen.kt @@ -25,7 +25,6 @@ import androidx.core.net.toUri import cafe.adriel.voyager.navigator.LocalNavigator import cafe.adriel.voyager.navigator.currentOrThrow import eu.kanade.domain.base.BasePreferences -import eu.kanade.domain.library.service.LibraryPreferences import eu.kanade.presentation.more.settings.Preference import eu.kanade.presentation.util.collectAsState import eu.kanade.tachiyomi.R @@ -61,6 +60,7 @@ import okhttp3.Headers import tachiyomi.core.util.lang.launchNonCancellable import tachiyomi.core.util.lang.withUIContext import tachiyomi.core.util.system.logcat +import tachiyomi.domain.library.service.LibraryPreferences import tachiyomi.domain.manga.repository.MangaRepository import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsGeneralScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsGeneralScreen.kt index ea761d958..1feac3156 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsGeneralScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsGeneralScreen.kt @@ -17,11 +17,11 @@ import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource import androidx.core.os.LocaleListCompat import eu.kanade.domain.base.BasePreferences -import eu.kanade.domain.library.service.LibraryPreferences import eu.kanade.presentation.more.settings.Preference import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.util.system.LocaleHelper import org.xmlpull.v1.XmlPullParser +import tachiyomi.domain.library.service.LibraryPreferences import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsLibraryScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsLibraryScreen.kt index 206531860..cc7277e3c 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsLibraryScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsLibraryScreen.kt @@ -31,27 +31,27 @@ import androidx.core.content.ContextCompat import cafe.adriel.voyager.navigator.LocalNavigator import cafe.adriel.voyager.navigator.Navigator import cafe.adriel.voyager.navigator.currentOrThrow -import eu.kanade.domain.category.interactor.ResetCategoryFlags -import eu.kanade.domain.library.service.LibraryPreferences import eu.kanade.presentation.category.visualName import eu.kanade.presentation.more.settings.Preference import eu.kanade.presentation.more.settings.widget.TriStateListDialog import eu.kanade.presentation.util.collectAsState import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.library.LibraryUpdateJob -import eu.kanade.tachiyomi.data.preference.DEVICE_BATTERY_NOT_LOW -import eu.kanade.tachiyomi.data.preference.DEVICE_CHARGING -import eu.kanade.tachiyomi.data.preference.DEVICE_NETWORK_NOT_METERED -import eu.kanade.tachiyomi.data.preference.DEVICE_ONLY_ON_WIFI -import eu.kanade.tachiyomi.data.preference.MANGA_HAS_UNREAD -import eu.kanade.tachiyomi.data.preference.MANGA_NON_COMPLETED -import eu.kanade.tachiyomi.data.preference.MANGA_NON_READ import eu.kanade.tachiyomi.data.track.TrackManager import eu.kanade.tachiyomi.ui.category.CategoryScreen import kotlinx.coroutines.launch import kotlinx.coroutines.runBlocking import tachiyomi.domain.category.interactor.GetCategories +import tachiyomi.domain.category.interactor.ResetCategoryFlags import tachiyomi.domain.category.model.Category +import tachiyomi.domain.library.service.LibraryPreferences +import tachiyomi.domain.library.service.LibraryPreferences.Companion.DEVICE_BATTERY_NOT_LOW +import tachiyomi.domain.library.service.LibraryPreferences.Companion.DEVICE_CHARGING +import tachiyomi.domain.library.service.LibraryPreferences.Companion.DEVICE_NETWORK_NOT_METERED +import tachiyomi.domain.library.service.LibraryPreferences.Companion.DEVICE_ONLY_ON_WIFI +import tachiyomi.domain.library.service.LibraryPreferences.Companion.MANGA_HAS_UNREAD +import tachiyomi.domain.library.service.LibraryPreferences.Companion.MANGA_NON_COMPLETED +import tachiyomi.domain.library.service.LibraryPreferences.Companion.MANGA_NON_READ import tachiyomi.presentation.core.components.WheelPicker import tachiyomi.presentation.core.components.WheelPickerDefaults import uy.kohesive.injekt.Injekt diff --git a/app/src/main/java/eu/kanade/tachiyomi/AppModule.kt b/app/src/main/java/eu/kanade/tachiyomi/AppModule.kt index 3d3abd80f..86a5bb6dc 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/AppModule.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/AppModule.kt @@ -8,7 +8,6 @@ import androidx.sqlite.db.framework.FrameworkSQLiteOpenHelperFactory import com.squareup.sqldelight.android.AndroidSqliteDriver import com.squareup.sqldelight.db.SqlDriver import eu.kanade.domain.base.BasePreferences -import eu.kanade.domain.library.service.LibraryPreferences import eu.kanade.domain.source.service.SourcePreferences import eu.kanade.domain.track.service.TrackPreferences import eu.kanade.domain.track.store.DelayedTrackingStore @@ -48,6 +47,7 @@ import tachiyomi.data.listOfStringsAdapter import tachiyomi.data.updateStrategyAdapter import tachiyomi.domain.backup.service.BackupPreferences import tachiyomi.domain.download.service.DownloadPreferences +import tachiyomi.domain.library.service.LibraryPreferences import tachiyomi.domain.source.service.SourceManager import tachiyomi.source.local.image.LocalCoverManager import tachiyomi.source.local.io.LocalSourceFileSystem diff --git a/app/src/main/java/eu/kanade/tachiyomi/Migrations.kt b/app/src/main/java/eu/kanade/tachiyomi/Migrations.kt index d6de9c11d..08447b980 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/Migrations.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/Migrations.kt @@ -5,13 +5,11 @@ import androidx.core.content.edit import androidx.preference.PreferenceManager import androidx.work.WorkManager import eu.kanade.domain.base.BasePreferences -import eu.kanade.domain.library.service.LibraryPreferences import eu.kanade.domain.source.service.SourcePreferences import eu.kanade.domain.ui.UiPreferences import eu.kanade.tachiyomi.core.security.SecurityPreferences import eu.kanade.tachiyomi.data.backup.BackupCreatorJob import eu.kanade.tachiyomi.data.library.LibraryUpdateJob -import eu.kanade.tachiyomi.data.preference.MANGA_NON_COMPLETED import eu.kanade.tachiyomi.data.preference.PreferenceValues import eu.kanade.tachiyomi.data.track.TrackManager import eu.kanade.tachiyomi.network.NetworkPreferences @@ -25,6 +23,8 @@ import eu.kanade.tachiyomi.util.system.toast import tachiyomi.core.preference.PreferenceStore import tachiyomi.core.preference.getEnum import tachiyomi.domain.backup.service.BackupPreferences +import tachiyomi.domain.library.service.LibraryPreferences +import tachiyomi.domain.library.service.LibraryPreferences.Companion.MANGA_NON_COMPLETED import tachiyomi.domain.manga.model.TriStateFilter import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupManager.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupManager.kt index ed068556e..0422c7b2a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupManager.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupManager.kt @@ -4,7 +4,6 @@ import android.Manifest import android.content.Context import android.net.Uri import com.hippo.unifile.UniFile -import eu.kanade.domain.library.service.LibraryPreferences import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.backup.BackupConst.BACKUP_CATEGORY import eu.kanade.tachiyomi.data.backup.BackupConst.BACKUP_CATEGORY_MASK @@ -43,6 +42,7 @@ import tachiyomi.domain.backup.service.BackupPreferences import tachiyomi.domain.category.interactor.GetCategories import tachiyomi.domain.category.model.Category import tachiyomi.domain.history.model.HistoryUpdate +import tachiyomi.domain.library.service.LibraryPreferences import tachiyomi.domain.manga.interactor.GetFavorites import tachiyomi.domain.source.service.SourceManager import uy.kohesive.injekt.Injekt diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateJob.kt b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateJob.kt index 07060e385..cc74569a3 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateJob.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateJob.kt @@ -17,7 +17,6 @@ import androidx.work.WorkerParameters import androidx.work.workDataOf import eu.kanade.domain.chapter.interactor.SyncChaptersWithSource import eu.kanade.domain.chapter.interactor.SyncChaptersWithTrackServiceTwoWay -import eu.kanade.domain.library.service.LibraryPreferences import eu.kanade.domain.manga.interactor.UpdateManga import eu.kanade.domain.manga.model.copyFrom import eu.kanade.domain.manga.model.toSManga @@ -27,13 +26,6 @@ import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.cache.CoverCache import eu.kanade.tachiyomi.data.download.DownloadManager import eu.kanade.tachiyomi.data.notification.Notifications -import eu.kanade.tachiyomi.data.preference.DEVICE_BATTERY_NOT_LOW -import eu.kanade.tachiyomi.data.preference.DEVICE_CHARGING -import eu.kanade.tachiyomi.data.preference.DEVICE_NETWORK_NOT_METERED -import eu.kanade.tachiyomi.data.preference.DEVICE_ONLY_ON_WIFI -import eu.kanade.tachiyomi.data.preference.MANGA_HAS_UNREAD -import eu.kanade.tachiyomi.data.preference.MANGA_NON_COMPLETED -import eu.kanade.tachiyomi.data.preference.MANGA_NON_READ import eu.kanade.tachiyomi.data.track.EnhancedTrackService import eu.kanade.tachiyomi.data.track.TrackManager import eu.kanade.tachiyomi.data.track.TrackService @@ -67,6 +59,14 @@ import tachiyomi.domain.chapter.model.Chapter import tachiyomi.domain.chapter.model.NoChaptersException import tachiyomi.domain.download.service.DownloadPreferences import tachiyomi.domain.library.model.LibraryManga +import tachiyomi.domain.library.service.LibraryPreferences +import tachiyomi.domain.library.service.LibraryPreferences.Companion.DEVICE_BATTERY_NOT_LOW +import tachiyomi.domain.library.service.LibraryPreferences.Companion.DEVICE_CHARGING +import tachiyomi.domain.library.service.LibraryPreferences.Companion.DEVICE_NETWORK_NOT_METERED +import tachiyomi.domain.library.service.LibraryPreferences.Companion.DEVICE_ONLY_ON_WIFI +import tachiyomi.domain.library.service.LibraryPreferences.Companion.MANGA_HAS_UNREAD +import tachiyomi.domain.library.service.LibraryPreferences.Companion.MANGA_NON_COMPLETED +import tachiyomi.domain.library.service.LibraryPreferences.Companion.MANGA_NON_READ import tachiyomi.domain.manga.interactor.GetLibraryManga import tachiyomi.domain.manga.interactor.GetManga import tachiyomi.domain.manga.model.Manga diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceValues.kt b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceValues.kt index d451bd7f8..e4d8ef06a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceValues.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceValues.kt @@ -2,15 +2,6 @@ package eu.kanade.tachiyomi.data.preference import eu.kanade.tachiyomi.R -const val DEVICE_ONLY_ON_WIFI = "wifi" -const val DEVICE_NETWORK_NOT_METERED = "network_not_metered" -const val DEVICE_CHARGING = "ac" -const val DEVICE_BATTERY_NOT_LOW = "battery_not_low" - -const val MANGA_NON_COMPLETED = "manga_ongoing" -const val MANGA_HAS_UNREAD = "manga_fully_read" -const val MANGA_NON_READ = "manga_started" - /** * This class stores the values for the preferences in the application. */ diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourceScreenModel.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourceScreenModel.kt index c5622aced..a7d3b35fd 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourceScreenModel.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourceScreenModel.kt @@ -14,14 +14,11 @@ import androidx.paging.map import cafe.adriel.voyager.core.model.StateScreenModel import cafe.adriel.voyager.core.model.coroutineScope import eu.kanade.core.preference.asState -import eu.kanade.domain.chapter.interactor.SetMangaDefaultChapterFlags import eu.kanade.domain.chapter.interactor.SyncChaptersWithTrackServiceTwoWay -import eu.kanade.domain.library.service.LibraryPreferences import eu.kanade.domain.manga.interactor.UpdateManga import eu.kanade.domain.manga.model.copyFrom import eu.kanade.domain.manga.model.toDomainManga import eu.kanade.domain.manga.model.toSManga -import eu.kanade.domain.source.interactor.GetRemoteManga import eu.kanade.domain.source.service.SourcePreferences import eu.kanade.domain.track.model.toDomainTrack import eu.kanade.tachiyomi.data.cache.CoverCache @@ -52,11 +49,14 @@ import tachiyomi.domain.category.interactor.GetCategories import tachiyomi.domain.category.interactor.SetMangaCategories import tachiyomi.domain.category.model.Category import tachiyomi.domain.chapter.interactor.GetChapterByMangaId +import tachiyomi.domain.chapter.interactor.SetMangaDefaultChapterFlags +import tachiyomi.domain.library.service.LibraryPreferences import tachiyomi.domain.manga.interactor.GetDuplicateLibraryManga import tachiyomi.domain.manga.interactor.GetManga import tachiyomi.domain.manga.interactor.NetworkToLocalManga import tachiyomi.domain.manga.model.Manga import tachiyomi.domain.manga.model.toMangaUpdate +import tachiyomi.domain.source.interactor.GetRemoteManga import tachiyomi.domain.source.service.SourceManager import tachiyomi.domain.track.interactor.InsertTrack import uy.kohesive.injekt.Injekt diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryScreenModel.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryScreenModel.kt index 50b217025..ae8186b51 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryScreenModel.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryScreenModel.kt @@ -4,13 +4,13 @@ import androidx.annotation.StringRes import androidx.compose.runtime.Immutable import cafe.adriel.voyager.core.model.StateScreenModel import cafe.adriel.voyager.core.model.coroutineScope -import eu.kanade.domain.category.interactor.CreateCategoryWithName import eu.kanade.tachiyomi.R import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.flow.collectLatest import kotlinx.coroutines.flow.receiveAsFlow import kotlinx.coroutines.flow.update import kotlinx.coroutines.launch +import tachiyomi.domain.category.interactor.CreateCategoryWithName import tachiyomi.domain.category.interactor.DeleteCategory import tachiyomi.domain.category.interactor.GetCategories import tachiyomi.domain.category.interactor.RenameCategory diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/history/HistoryScreenModel.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/history/HistoryScreenModel.kt index e38f790d1..32590052f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/history/HistoryScreenModel.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/history/HistoryScreenModel.kt @@ -4,7 +4,6 @@ import androidx.compose.runtime.Immutable import cafe.adriel.voyager.core.model.StateScreenModel import cafe.adriel.voyager.core.model.coroutineScope import eu.kanade.core.util.insertSeparators -import eu.kanade.domain.history.interactor.GetNextChapters import eu.kanade.presentation.history.HistoryUiModel import eu.kanade.tachiyomi.util.lang.toDateKey import kotlinx.coroutines.Dispatchers @@ -24,6 +23,7 @@ import tachiyomi.core.util.lang.withIOContext import tachiyomi.core.util.system.logcat import tachiyomi.domain.chapter.model.Chapter import tachiyomi.domain.history.interactor.GetHistory +import tachiyomi.domain.history.interactor.GetNextChapters import tachiyomi.domain.history.interactor.RemoveHistory import tachiyomi.domain.history.model.HistoryWithRelations import uy.kohesive.injekt.Injekt diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/home/HomeScreen.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/home/HomeScreen.kt index 30af8215a..981b3a8ba 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/home/HomeScreen.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/home/HomeScreen.kt @@ -33,7 +33,6 @@ import cafe.adriel.voyager.navigator.LocalNavigator import cafe.adriel.voyager.navigator.currentOrThrow import cafe.adriel.voyager.navigator.tab.LocalTabNavigator import cafe.adriel.voyager.navigator.tab.TabNavigator -import eu.kanade.domain.library.service.LibraryPreferences import eu.kanade.domain.source.service.SourcePreferences import eu.kanade.presentation.util.Screen import eu.kanade.presentation.util.isTabletUi @@ -52,6 +51,7 @@ import kotlinx.coroutines.flow.receiveAsFlow import kotlinx.coroutines.launch import soup.compose.material.motion.animation.materialFadeThroughIn import soup.compose.material.motion.animation.materialFadeThroughOut +import tachiyomi.domain.library.service.LibraryPreferences import tachiyomi.presentation.core.components.material.NavigationBar import tachiyomi.presentation.core.components.material.NavigationRail import tachiyomi.presentation.core.components.material.Scaffold diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryScreenModel.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryScreenModel.kt index 0d2b59b32..221621ae3 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryScreenModel.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryScreenModel.kt @@ -16,8 +16,6 @@ import eu.kanade.core.util.fastMapNotNull import eu.kanade.core.util.fastPartition import eu.kanade.domain.base.BasePreferences import eu.kanade.domain.chapter.interactor.SetReadStatus -import eu.kanade.domain.history.interactor.GetNextChapters -import eu.kanade.domain.library.service.LibraryPreferences import eu.kanade.domain.manga.interactor.UpdateManga import eu.kanade.domain.manga.model.isLocal import eu.kanade.presentation.components.SEARCH_DEBOUNCE_MILLIS @@ -51,9 +49,11 @@ import tachiyomi.domain.category.interactor.SetMangaCategories import tachiyomi.domain.category.model.Category import tachiyomi.domain.chapter.interactor.GetChapterByMangaId import tachiyomi.domain.chapter.model.Chapter +import tachiyomi.domain.history.interactor.GetNextChapters import tachiyomi.domain.library.model.LibraryManga import tachiyomi.domain.library.model.LibrarySort import tachiyomi.domain.library.model.sort +import tachiyomi.domain.library.service.LibraryPreferences import tachiyomi.domain.manga.interactor.GetLibraryManga import tachiyomi.domain.manga.model.Manga import tachiyomi.domain.manga.model.MangaUpdate diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibrarySettingsScreenModel.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibrarySettingsScreenModel.kt index cfda4895f..031f36ed7 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibrarySettingsScreenModel.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibrarySettingsScreenModel.kt @@ -3,17 +3,17 @@ package eu.kanade.tachiyomi.ui.library import cafe.adriel.voyager.core.model.ScreenModel import cafe.adriel.voyager.core.model.coroutineScope import eu.kanade.domain.base.BasePreferences -import eu.kanade.domain.category.interactor.SetDisplayModeForCategory -import eu.kanade.domain.category.interactor.SetSortModeForCategory -import eu.kanade.domain.library.service.LibraryPreferences import eu.kanade.tachiyomi.data.track.TrackManager import eu.kanade.tachiyomi.util.preference.toggle import tachiyomi.core.preference.Preference import tachiyomi.core.preference.getAndSet import tachiyomi.core.util.lang.launchIO +import tachiyomi.domain.category.interactor.SetDisplayModeForCategory +import tachiyomi.domain.category.interactor.SetSortModeForCategory import tachiyomi.domain.category.model.Category import tachiyomi.domain.library.model.LibraryDisplayMode import tachiyomi.domain.library.model.LibrarySort +import tachiyomi.domain.library.service.LibraryPreferences import tachiyomi.domain.manga.model.TriStateFilter import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt index 9eede468c..6deefde84 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt @@ -53,7 +53,6 @@ import cafe.adriel.voyager.navigator.NavigatorDisposeBehavior import cafe.adriel.voyager.navigator.currentOrThrow import com.google.accompanist.systemuicontroller.rememberSystemUiController import eu.kanade.domain.base.BasePreferences -import eu.kanade.domain.library.service.LibraryPreferences import eu.kanade.domain.source.service.SourcePreferences import eu.kanade.domain.ui.UiPreferences import eu.kanade.presentation.components.AppStateBanners @@ -96,6 +95,7 @@ import kotlinx.coroutines.launch import logcat.LogPriority import tachiyomi.core.Constants import tachiyomi.core.util.system.logcat +import tachiyomi.domain.library.service.LibraryPreferences import tachiyomi.presentation.core.components.material.Scaffold import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt index 6e8572d0e..bbf9f6e22 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt @@ -10,10 +10,8 @@ import cafe.adriel.voyager.core.model.StateScreenModel import cafe.adriel.voyager.core.model.coroutineScope import eu.kanade.core.preference.asState import eu.kanade.core.util.addOrRemove -import eu.kanade.domain.chapter.interactor.SetMangaDefaultChapterFlags import eu.kanade.domain.chapter.interactor.SetReadStatus import eu.kanade.domain.chapter.interactor.SyncChaptersWithSource -import eu.kanade.domain.library.service.LibraryPreferences import eu.kanade.domain.manga.interactor.UpdateManga import eu.kanade.domain.manga.model.downloadedFilter import eu.kanade.domain.manga.model.isLocal @@ -58,12 +56,14 @@ import tachiyomi.core.util.system.logcat import tachiyomi.domain.category.interactor.GetCategories import tachiyomi.domain.category.interactor.SetMangaCategories import tachiyomi.domain.category.model.Category +import tachiyomi.domain.chapter.interactor.SetMangaDefaultChapterFlags import tachiyomi.domain.chapter.interactor.UpdateChapter import tachiyomi.domain.chapter.model.Chapter import tachiyomi.domain.chapter.model.ChapterUpdate import tachiyomi.domain.chapter.model.NoChaptersException import tachiyomi.domain.chapter.service.getChapterSort import tachiyomi.domain.download.service.DownloadPreferences +import tachiyomi.domain.library.service.LibraryPreferences import tachiyomi.domain.manga.interactor.GetDuplicateLibraryManga import tachiyomi.domain.manga.interactor.GetMangaWithChapters import tachiyomi.domain.manga.interactor.SetMangaChapterFlags diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderViewModel.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderViewModel.kt index 8b22b26f3..0f36c8945 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderViewModel.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderViewModel.kt @@ -8,7 +8,6 @@ import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import eu.kanade.domain.base.BasePreferences import eu.kanade.domain.chapter.model.toDbChapter -import eu.kanade.domain.history.interactor.GetNextChapters import eu.kanade.domain.manga.interactor.SetMangaViewerFlags import eu.kanade.domain.manga.model.isLocal import eu.kanade.domain.manga.model.orientationType @@ -71,6 +70,7 @@ import tachiyomi.domain.chapter.interactor.UpdateChapter import tachiyomi.domain.chapter.model.ChapterUpdate import tachiyomi.domain.chapter.service.getChapterSort import tachiyomi.domain.download.service.DownloadPreferences +import tachiyomi.domain.history.interactor.GetNextChapters import tachiyomi.domain.history.interactor.UpsertHistory import tachiyomi.domain.history.model.HistoryUpdate import tachiyomi.domain.manga.interactor.GetManga diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/stats/StatsScreenModel.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/stats/StatsScreenModel.kt index fc1b8b6c2..3870bc780 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/stats/StatsScreenModel.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/stats/StatsScreenModel.kt @@ -7,20 +7,20 @@ import eu.kanade.core.util.fastDistinctBy import eu.kanade.core.util.fastFilter import eu.kanade.core.util.fastFilterNot import eu.kanade.core.util.fastMapNotNull -import eu.kanade.domain.library.service.LibraryPreferences import eu.kanade.domain.manga.model.isLocal import eu.kanade.presentation.more.stats.StatsScreenState import eu.kanade.presentation.more.stats.data.StatsData import eu.kanade.tachiyomi.data.download.DownloadManager -import eu.kanade.tachiyomi.data.preference.MANGA_HAS_UNREAD -import eu.kanade.tachiyomi.data.preference.MANGA_NON_COMPLETED -import eu.kanade.tachiyomi.data.preference.MANGA_NON_READ import eu.kanade.tachiyomi.data.track.TrackManager import eu.kanade.tachiyomi.source.model.SManga import kotlinx.coroutines.flow.update import tachiyomi.core.util.lang.launchIO import tachiyomi.domain.history.interactor.GetTotalReadDuration import tachiyomi.domain.library.model.LibraryManga +import tachiyomi.domain.library.service.LibraryPreferences +import tachiyomi.domain.library.service.LibraryPreferences.Companion.MANGA_HAS_UNREAD +import tachiyomi.domain.library.service.LibraryPreferences.Companion.MANGA_NON_COMPLETED +import tachiyomi.domain.library.service.LibraryPreferences.Companion.MANGA_NON_READ import tachiyomi.domain.manga.interactor.GetLibraryManga import tachiyomi.domain.track.interactor.GetTracks import tachiyomi.domain.track.model.Track diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/updates/UpdatesScreenModel.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/updates/UpdatesScreenModel.kt index cffee3458..f1c05de55 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/updates/UpdatesScreenModel.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/updates/UpdatesScreenModel.kt @@ -12,7 +12,6 @@ import eu.kanade.core.preference.asState import eu.kanade.core.util.addOrRemove import eu.kanade.core.util.insertSeparators import eu.kanade.domain.chapter.interactor.SetReadStatus -import eu.kanade.domain.library.service.LibraryPreferences import eu.kanade.domain.ui.UiPreferences import eu.kanade.presentation.manga.components.ChapterDownloadAction import eu.kanade.presentation.updates.UpdatesUiModel @@ -39,6 +38,7 @@ import tachiyomi.core.util.system.logcat import tachiyomi.domain.chapter.interactor.GetChapter import tachiyomi.domain.chapter.interactor.UpdateChapter import tachiyomi.domain.chapter.model.ChapterUpdate +import tachiyomi.domain.library.service.LibraryPreferences import tachiyomi.domain.manga.interactor.GetManga import tachiyomi.domain.source.service.SourceManager import tachiyomi.domain.updates.interactor.GetUpdates diff --git a/data/src/main/java/tachiyomi/data/source/SourcePagingSource.kt b/data/src/main/java/tachiyomi/data/source/SourcePagingSource.kt index 8b4fb0341..032ae0ab5 100644 --- a/data/src/main/java/tachiyomi/data/source/SourcePagingSource.kt +++ b/data/src/main/java/tachiyomi/data/source/SourcePagingSource.kt @@ -1,6 +1,5 @@ package tachiyomi.data.source -import androidx.paging.PagingSource import androidx.paging.PagingState import eu.kanade.tachiyomi.source.CatalogueSource import eu.kanade.tachiyomi.source.model.FilterList @@ -8,8 +7,25 @@ import eu.kanade.tachiyomi.source.model.MangasPage import eu.kanade.tachiyomi.source.model.SManga import tachiyomi.core.util.lang.awaitSingle import tachiyomi.core.util.lang.withIOContext +import tachiyomi.domain.source.repository.SourcePagingSourceType -typealias SourcePagingSourceType = PagingSource +class SourceSearchPagingSource(source: CatalogueSource, val query: String, val filters: FilterList) : SourcePagingSource(source) { + override suspend fun requestNextPage(currentPage: Int): MangasPage { + return source.fetchSearchManga(currentPage, query, filters).awaitSingle() + } +} + +class SourcePopularPagingSource(source: CatalogueSource) : SourcePagingSource(source) { + override suspend fun requestNextPage(currentPage: Int): MangasPage { + return source.fetchPopularManga(currentPage).awaitSingle() + } +} + +class SourceLatestPagingSource(source: CatalogueSource) : SourcePagingSource(source) { + override suspend fun requestNextPage(currentPage: Int): MangasPage { + return source.fetchLatestUpdates(currentPage).awaitSingle() + } +} abstract class SourcePagingSource( protected val source: CatalogueSource, @@ -45,22 +61,4 @@ abstract class SourcePagingSource( } } -class SourceSearchPagingSource(source: CatalogueSource, val query: String, val filters: FilterList) : SourcePagingSource(source) { - override suspend fun requestNextPage(currentPage: Int): MangasPage { - return source.fetchSearchManga(currentPage, query, filters).awaitSingle() - } -} - -class SourcePopularPagingSource(source: CatalogueSource) : SourcePagingSource(source) { - override suspend fun requestNextPage(currentPage: Int): MangasPage { - return source.fetchPopularManga(currentPage).awaitSingle() - } -} - -class SourceLatestPagingSource(source: CatalogueSource) : SourcePagingSource(source) { - override suspend fun requestNextPage(currentPage: Int): MangasPage { - return source.fetchLatestUpdates(currentPage).awaitSingle() - } -} - class NoResultsException : Exception() diff --git a/app/src/main/java/eu/kanade/data/source/SourceRepositoryImpl.kt b/data/src/main/java/tachiyomi/data/source/SourceRepositoryImpl.kt similarity index 89% rename from app/src/main/java/eu/kanade/data/source/SourceRepositoryImpl.kt rename to data/src/main/java/tachiyomi/data/source/SourceRepositoryImpl.kt index 50f693d83..c5f1ee608 100644 --- a/app/src/main/java/eu/kanade/data/source/SourceRepositoryImpl.kt +++ b/data/src/main/java/tachiyomi/data/source/SourceRepositoryImpl.kt @@ -1,20 +1,16 @@ -package eu.kanade.data.source +package tachiyomi.data.source -import eu.kanade.domain.source.repository.SourceRepository import eu.kanade.tachiyomi.source.CatalogueSource import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.online.HttpSource import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.map import tachiyomi.data.DatabaseHandler -import tachiyomi.data.source.SourceLatestPagingSource -import tachiyomi.data.source.SourcePagingSourceType -import tachiyomi.data.source.SourcePopularPagingSource -import tachiyomi.data.source.SourceSearchPagingSource -import tachiyomi.data.source.sourceMapper import tachiyomi.domain.source.model.Source import tachiyomi.domain.source.model.SourceWithCount import tachiyomi.domain.source.model.StubSource +import tachiyomi.domain.source.repository.SourcePagingSourceType +import tachiyomi.domain.source.repository.SourceRepository import tachiyomi.domain.source.service.SourceManager class SourceRepositoryImpl( diff --git a/domain/build.gradle.kts b/domain/build.gradle.kts index f51488f72..4236ec7b8 100644 --- a/domain/build.gradle.kts +++ b/domain/build.gradle.kts @@ -19,5 +19,7 @@ dependencies { implementation(platform(kotlinx.coroutines.bom)) implementation(kotlinx.bundles.coroutines) + api(libs.sqldelight.android.paging) + testImplementation(libs.junit) } diff --git a/app/src/main/java/eu/kanade/domain/category/interactor/CreateCategoryWithName.kt b/domain/src/main/java/tachiyomi/domain/category/interactor/CreateCategoryWithName.kt similarity index 92% rename from app/src/main/java/eu/kanade/domain/category/interactor/CreateCategoryWithName.kt rename to domain/src/main/java/tachiyomi/domain/category/interactor/CreateCategoryWithName.kt index b71911ceb..a9f215590 100644 --- a/app/src/main/java/eu/kanade/domain/category/interactor/CreateCategoryWithName.kt +++ b/domain/src/main/java/tachiyomi/domain/category/interactor/CreateCategoryWithName.kt @@ -1,11 +1,11 @@ -package eu.kanade.domain.category.interactor +package tachiyomi.domain.category.interactor -import eu.kanade.domain.library.service.LibraryPreferences import logcat.LogPriority import tachiyomi.core.util.lang.withNonCancellableContext import tachiyomi.core.util.system.logcat import tachiyomi.domain.category.model.Category import tachiyomi.domain.category.repository.CategoryRepository +import tachiyomi.domain.library.service.LibraryPreferences class CreateCategoryWithName( private val categoryRepository: CategoryRepository, diff --git a/app/src/main/java/eu/kanade/domain/category/interactor/ResetCategoryFlags.kt b/domain/src/main/java/tachiyomi/domain/category/interactor/ResetCategoryFlags.kt similarity index 82% rename from app/src/main/java/eu/kanade/domain/category/interactor/ResetCategoryFlags.kt rename to domain/src/main/java/tachiyomi/domain/category/interactor/ResetCategoryFlags.kt index b5be470dc..6508d9131 100644 --- a/app/src/main/java/eu/kanade/domain/category/interactor/ResetCategoryFlags.kt +++ b/domain/src/main/java/tachiyomi/domain/category/interactor/ResetCategoryFlags.kt @@ -1,8 +1,8 @@ -package eu.kanade.domain.category.interactor +package tachiyomi.domain.category.interactor -import eu.kanade.domain.library.service.LibraryPreferences import tachiyomi.domain.category.repository.CategoryRepository import tachiyomi.domain.library.model.plus +import tachiyomi.domain.library.service.LibraryPreferences class ResetCategoryFlags( private val preferences: LibraryPreferences, diff --git a/app/src/main/java/eu/kanade/domain/category/interactor/SetDisplayModeForCategory.kt b/domain/src/main/java/tachiyomi/domain/category/interactor/SetDisplayModeForCategory.kt similarity index 91% rename from app/src/main/java/eu/kanade/domain/category/interactor/SetDisplayModeForCategory.kt rename to domain/src/main/java/tachiyomi/domain/category/interactor/SetDisplayModeForCategory.kt index 31f127966..ed6c89c17 100644 --- a/app/src/main/java/eu/kanade/domain/category/interactor/SetDisplayModeForCategory.kt +++ b/domain/src/main/java/tachiyomi/domain/category/interactor/SetDisplayModeForCategory.kt @@ -1,11 +1,11 @@ -package eu.kanade.domain.category.interactor +package tachiyomi.domain.category.interactor -import eu.kanade.domain.library.service.LibraryPreferences import tachiyomi.domain.category.model.Category import tachiyomi.domain.category.model.CategoryUpdate import tachiyomi.domain.category.repository.CategoryRepository import tachiyomi.domain.library.model.LibraryDisplayMode import tachiyomi.domain.library.model.plus +import tachiyomi.domain.library.service.LibraryPreferences class SetDisplayModeForCategory( private val preferences: LibraryPreferences, diff --git a/app/src/main/java/eu/kanade/domain/category/interactor/SetSortModeForCategory.kt b/domain/src/main/java/tachiyomi/domain/category/interactor/SetSortModeForCategory.kt similarity index 91% rename from app/src/main/java/eu/kanade/domain/category/interactor/SetSortModeForCategory.kt rename to domain/src/main/java/tachiyomi/domain/category/interactor/SetSortModeForCategory.kt index c179b5509..5502073e1 100644 --- a/app/src/main/java/eu/kanade/domain/category/interactor/SetSortModeForCategory.kt +++ b/domain/src/main/java/tachiyomi/domain/category/interactor/SetSortModeForCategory.kt @@ -1,11 +1,11 @@ -package eu.kanade.domain.category.interactor +package tachiyomi.domain.category.interactor -import eu.kanade.domain.library.service.LibraryPreferences import tachiyomi.domain.category.model.Category import tachiyomi.domain.category.model.CategoryUpdate import tachiyomi.domain.category.repository.CategoryRepository import tachiyomi.domain.library.model.LibrarySort import tachiyomi.domain.library.model.plus +import tachiyomi.domain.library.service.LibraryPreferences class SetSortModeForCategory( private val preferences: LibraryPreferences, diff --git a/app/src/main/java/eu/kanade/domain/chapter/interactor/SetDefaultChapterSettings.kt b/domain/src/main/java/tachiyomi/domain/chapter/interactor/SetDefaultChapterSettings.kt similarity index 92% rename from app/src/main/java/eu/kanade/domain/chapter/interactor/SetDefaultChapterSettings.kt rename to domain/src/main/java/tachiyomi/domain/chapter/interactor/SetDefaultChapterSettings.kt index e5d60fe05..ab8eaaa55 100644 --- a/app/src/main/java/eu/kanade/domain/chapter/interactor/SetDefaultChapterSettings.kt +++ b/domain/src/main/java/tachiyomi/domain/chapter/interactor/SetDefaultChapterSettings.kt @@ -1,7 +1,7 @@ -package eu.kanade.domain.chapter.interactor +package tachiyomi.domain.chapter.interactor -import eu.kanade.domain.library.service.LibraryPreferences import tachiyomi.core.util.lang.withNonCancellableContext +import tachiyomi.domain.library.service.LibraryPreferences import tachiyomi.domain.manga.interactor.GetFavorites import tachiyomi.domain.manga.interactor.SetMangaChapterFlags import tachiyomi.domain.manga.model.Manga diff --git a/app/src/main/java/eu/kanade/domain/history/interactor/GetNextChapters.kt b/domain/src/main/java/tachiyomi/domain/history/interactor/GetNextChapters.kt similarity index 97% rename from app/src/main/java/eu/kanade/domain/history/interactor/GetNextChapters.kt rename to domain/src/main/java/tachiyomi/domain/history/interactor/GetNextChapters.kt index db1a0fc14..ebe6fa83e 100644 --- a/app/src/main/java/eu/kanade/domain/history/interactor/GetNextChapters.kt +++ b/domain/src/main/java/tachiyomi/domain/history/interactor/GetNextChapters.kt @@ -1,4 +1,4 @@ -package eu.kanade.domain.history.interactor +package tachiyomi.domain.history.interactor import tachiyomi.domain.chapter.interactor.GetChapterByMangaId import tachiyomi.domain.chapter.model.Chapter diff --git a/app/src/main/java/eu/kanade/domain/library/service/LibraryPreferences.kt b/domain/src/main/java/tachiyomi/domain/library/service/LibraryPreferences.kt similarity index 86% rename from app/src/main/java/eu/kanade/domain/library/service/LibraryPreferences.kt rename to domain/src/main/java/tachiyomi/domain/library/service/LibraryPreferences.kt index ec6fbad0b..b6dc346df 100644 --- a/app/src/main/java/eu/kanade/domain/library/service/LibraryPreferences.kt +++ b/domain/src/main/java/tachiyomi/domain/library/service/LibraryPreferences.kt @@ -1,9 +1,5 @@ -package eu.kanade.domain.library.service +package tachiyomi.domain.library.service -import eu.kanade.tachiyomi.data.preference.DEVICE_ONLY_ON_WIFI -import eu.kanade.tachiyomi.data.preference.MANGA_HAS_UNREAD -import eu.kanade.tachiyomi.data.preference.MANGA_NON_COMPLETED -import eu.kanade.tachiyomi.data.preference.MANGA_NON_READ import tachiyomi.core.preference.PreferenceStore import tachiyomi.core.preference.getEnum import tachiyomi.domain.library.model.LibraryDisplayMode @@ -26,8 +22,20 @@ class LibraryPreferences( fun libraryUpdateInterval() = preferenceStore.getInt("pref_library_update_interval_key", 24) fun libraryUpdateLastTimestamp() = preferenceStore.getLong("library_update_last_timestamp", 0L) - fun libraryUpdateDeviceRestriction() = preferenceStore.getStringSet("library_update_restriction", setOf(DEVICE_ONLY_ON_WIFI)) - fun libraryUpdateMangaRestriction() = preferenceStore.getStringSet("library_update_manga_restriction", setOf(MANGA_HAS_UNREAD, MANGA_NON_COMPLETED, MANGA_NON_READ)) + fun libraryUpdateDeviceRestriction() = preferenceStore.getStringSet( + "library_update_restriction", + setOf( + DEVICE_ONLY_ON_WIFI, + ), + ) + fun libraryUpdateMangaRestriction() = preferenceStore.getStringSet( + "library_update_manga_restriction", + setOf( + MANGA_HAS_UNREAD, + MANGA_NON_COMPLETED, + MANGA_NON_READ, + ), + ) fun autoUpdateMetadata() = preferenceStore.getBoolean("auto_update_metadata", false) @@ -109,4 +117,15 @@ class LibraryPreferences( fun autoClearChapterCache() = preferenceStore.getBoolean("auto_clear_chapter_cache", false) // endregion + + companion object { + const val DEVICE_ONLY_ON_WIFI = "wifi" + const val DEVICE_NETWORK_NOT_METERED = "network_not_metered" + const val DEVICE_CHARGING = "ac" + const val DEVICE_BATTERY_NOT_LOW = "battery_not_low" + + const val MANGA_NON_COMPLETED = "manga_ongoing" + const val MANGA_HAS_UNREAD = "manga_fully_read" + const val MANGA_NON_READ = "manga_started" + } } diff --git a/app/src/main/java/eu/kanade/domain/source/interactor/GetRemoteManga.kt b/domain/src/main/java/tachiyomi/domain/source/interactor/GetRemoteManga.kt similarity index 79% rename from app/src/main/java/eu/kanade/domain/source/interactor/GetRemoteManga.kt rename to domain/src/main/java/tachiyomi/domain/source/interactor/GetRemoteManga.kt index 3a2574b81..61e5e513e 100644 --- a/app/src/main/java/eu/kanade/domain/source/interactor/GetRemoteManga.kt +++ b/domain/src/main/java/tachiyomi/domain/source/interactor/GetRemoteManga.kt @@ -1,8 +1,8 @@ -package eu.kanade.domain.source.interactor +package tachiyomi.domain.source.interactor -import eu.kanade.domain.source.repository.SourceRepository import eu.kanade.tachiyomi.source.model.FilterList -import tachiyomi.data.source.SourcePagingSourceType +import tachiyomi.domain.source.repository.SourcePagingSourceType +import tachiyomi.domain.source.repository.SourceRepository class GetRemoteManga( private val repository: SourceRepository, diff --git a/app/src/main/java/eu/kanade/domain/source/interactor/GetSourcesWithNonLibraryManga.kt b/domain/src/main/java/tachiyomi/domain/source/interactor/GetSourcesWithNonLibraryManga.kt similarity index 74% rename from app/src/main/java/eu/kanade/domain/source/interactor/GetSourcesWithNonLibraryManga.kt rename to domain/src/main/java/tachiyomi/domain/source/interactor/GetSourcesWithNonLibraryManga.kt index 604e9119c..d53445d0c 100644 --- a/app/src/main/java/eu/kanade/domain/source/interactor/GetSourcesWithNonLibraryManga.kt +++ b/domain/src/main/java/tachiyomi/domain/source/interactor/GetSourcesWithNonLibraryManga.kt @@ -1,8 +1,8 @@ -package eu.kanade.domain.source.interactor +package tachiyomi.domain.source.interactor -import eu.kanade.domain.source.repository.SourceRepository import kotlinx.coroutines.flow.Flow import tachiyomi.domain.source.model.SourceWithCount +import tachiyomi.domain.source.repository.SourceRepository class GetSourcesWithNonLibraryManga( private val repository: SourceRepository, diff --git a/app/src/main/java/eu/kanade/domain/source/repository/SourceRepository.kt b/domain/src/main/java/tachiyomi/domain/source/repository/SourceRepository.kt similarity index 77% rename from app/src/main/java/eu/kanade/domain/source/repository/SourceRepository.kt rename to domain/src/main/java/tachiyomi/domain/source/repository/SourceRepository.kt index 0783815bb..f5550c2f0 100644 --- a/app/src/main/java/eu/kanade/domain/source/repository/SourceRepository.kt +++ b/domain/src/main/java/tachiyomi/domain/source/repository/SourceRepository.kt @@ -1,11 +1,14 @@ -package eu.kanade.domain.source.repository +package tachiyomi.domain.source.repository +import androidx.paging.PagingSource import eu.kanade.tachiyomi.source.model.FilterList +import eu.kanade.tachiyomi.source.model.SManga import kotlinx.coroutines.flow.Flow -import tachiyomi.data.source.SourcePagingSourceType import tachiyomi.domain.source.model.Source import tachiyomi.domain.source.model.SourceWithCount +typealias SourcePagingSourceType = PagingSource + interface SourceRepository { fun getSources(): Flow>