From 345e9c2a9a61f1f3b814db52eddbb42681499854 Mon Sep 17 00:00:00 2001 From: arkon Date: Sun, 22 Jan 2023 10:54:28 -0500 Subject: [PATCH] Move more models to domain module --- .../eu/kanade/data/chapter/ChapterMapper.kt | 2 +- .../data/chapter/ChapterRepositoryImpl.kt | 4 +- .../java/eu/kanade/data/manga/MangaMapper.kt | 2 +- .../kanade/data/manga/MangaRepositoryImpl.kt | 2 +- .../domain/chapter/interactor/GetChapter.kt | 2 +- .../chapter/interactor/GetChapterByMangaId.kt | 2 +- .../interactor/SetDefaultChapterSettings.kt | 2 +- .../chapter/interactor/SetReadStatus.kt | 6 +- .../interactor/ShouldUpdateDbChapter.kt | 2 +- .../interactor/SyncChaptersWithSource.kt | 9 +- .../SyncChaptersWithTrackServiceTwoWay.kt | 4 +- .../chapter/interactor/UpdateChapter.kt | 2 +- .../eu/kanade/domain/chapter/model/Chapter.kt | 72 ++---- .../domain/chapter/model/ChapterFilter.kt | 6 +- .../chapter/repository/ChapterRepository.kt | 4 +- .../download/interactor/DeleteDownload.kt | 4 +- .../history/interactor/GetNextChapters.kt | 2 +- .../domain/library/model/LibraryManga.kt | 2 +- .../library/service/LibraryPreferences.kt | 2 +- .../interactor/GetDuplicateLibraryManga.kt | 2 +- .../domain/manga/interactor/GetFavorites.kt | 2 +- .../domain/manga/interactor/GetManga.kt | 2 +- .../manga/interactor/GetMangaWithChapters.kt | 4 +- .../manga/interactor/NetworkToLocalManga.kt | 2 +- .../manga/interactor/SetMangaChapterFlags.kt | 2 +- .../domain/manga/interactor/UpdateManga.kt | 2 +- .../eu/kanade/domain/manga/model/ComicInfo.kt | 3 +- .../eu/kanade/domain/manga/model/Manga.kt | 236 ++++-------------- .../kanade/domain/manga/model/MangaCover.kt | 13 - .../manga/repository/MangaRepository.kt | 2 +- .../presentation/browse/BrowseSourceScreen.kt | 2 +- .../presentation/browse/GlobalSearchScreen.kt | 2 +- .../presentation/browse/MigrateMangaScreen.kt | 2 +- .../browse/MigrateSearchScreen.kt | 2 +- .../components/BrowseSourceComfortableGrid.kt | 2 +- .../components/BrowseSourceCompactGrid.kt | 2 +- .../browse/components/BrowseSourceDialogs.kt | 2 +- .../browse/components/BrowseSourceList.kt | 2 +- .../browse/components/GlobalSearchCardRow.kt | 4 +- .../presentation/components/SettingsItems.kt | 2 +- .../manga/ChapterSettingsDialog.kt | 6 +- .../kanade/presentation/manga/MangaScreen.kt | 5 +- .../manga/components/BaseMangaListItem.kt | 2 +- .../manga/components/MangaCoverDialog.kt | 2 +- .../manga/components/MangaInfoHeader.kt | 2 +- .../tachiyomi/data/backup/BackupManager.kt | 2 +- .../data/backup/models/BackupManga.kt | 2 +- .../tachiyomi/data/cache/ChapterCache.kt | 2 +- .../kanade/tachiyomi/data/cache/CoverCache.kt | 2 +- .../tachiyomi/data/coil/MangaCoverFetcher.kt | 2 +- .../tachiyomi/data/coil/MangaCoverKeyer.kt | 2 +- .../tachiyomi/data/database/models/Chapter.kt | 2 +- .../tachiyomi/data/database/models/Manga.kt | 2 +- .../tachiyomi/data/download/DownloadCache.kt | 4 +- .../data/download/DownloadManager.kt | 4 +- .../data/download/DownloadPendingDeleter.kt | 4 +- .../data/download/DownloadProvider.kt | 4 +- .../tachiyomi/data/download/DownloadStore.kt | 2 +- .../tachiyomi/data/download/Downloader.kt | 5 +- .../tachiyomi/data/download/model/Download.kt | 4 +- .../data/download/model/DownloadQueue.kt | 4 +- .../data/library/LibraryUpdateNotifier.kt | 4 +- .../data/library/LibraryUpdateService.kt | 8 +- .../data/notification/NotificationReceiver.kt | 6 +- .../data/track/EnhancedTrackService.kt | 2 +- .../tachiyomi/data/track/kavita/Kavita.kt | 2 +- .../tachiyomi/data/track/komga/Komga.kt | 2 +- .../tachiyomi/data/track/suwayomi/Suwayomi.kt | 2 +- .../ui/browse/migration/MigrationFlags.kt | 2 +- .../manga/MigrationMangaScreenModel.kt | 2 +- .../browse/migration/search/MigrateDialog.kt | 5 +- .../search/MigrateSearchScreenModel.kt | 2 +- .../migration/search/SourceSearchScreen.kt | 2 +- .../source/browse/BrowseSourceScreenModel.kt | 6 +- .../source/globalsearch/SearchScreenModel.kt | 6 +- .../ui/history/HistoryScreenModel.kt | 2 +- .../kanade/tachiyomi/ui/history/HistoryTab.kt | 2 +- .../ui/library/LibraryScreenModel.kt | 4 +- .../kanade/tachiyomi/ui/library/LibraryTab.kt | 2 +- .../ui/manga/MangaCoverScreenModel.kt | 2 +- .../kanade/tachiyomi/ui/manga/MangaScreen.kt | 5 +- .../tachiyomi/ui/manga/MangaScreenModel.kt | 10 +- .../tachiyomi/ui/reader/ReaderActivity.kt | 3 +- .../tachiyomi/ui/reader/ReaderViewModel.kt | 6 +- .../ui/reader/loader/ChapterLoader.kt | 2 +- .../ui/reader/loader/DownloadPageLoader.kt | 2 +- .../setting/ReaderReadingModeSettings.kt | 2 + .../ui/reader/viewer/MissingChapters.kt | 2 +- .../ui/reader/viewer/ReaderTransitionView.kt | 2 +- .../ui/updates/UpdatesScreenModel.kt | 2 +- .../kanade/tachiyomi/util/MangaExtensions.kt | 3 +- .../util/chapter/ChapterGetNextUnread.kt | 4 +- .../tachiyomi/util/chapter/ChapterSorter.kt | 4 +- .../tachiyomi/domain/chapter/model/Chapter.kt | 36 +++ .../domain/chapter/model/ChapterUpdate.kt | 2 +- .../tachiyomi/domain/manga/model/Manga.kt | 110 ++++++++ .../domain/manga/model/MangaCover.kt | 10 + .../domain/manga/model/MangaUpdate.kt | 23 ++ .../domain/manga/model/TriStateFilter.kt | 7 + 99 files changed, 402 insertions(+), 383 deletions(-) delete mode 100644 app/src/main/java/eu/kanade/domain/manga/model/MangaCover.kt create mode 100644 domain/src/main/java/tachiyomi/domain/chapter/model/Chapter.kt rename {app/src/main/java/eu/kanade => domain/src/main/java/tachiyomi}/domain/chapter/model/ChapterUpdate.kt (93%) create mode 100644 domain/src/main/java/tachiyomi/domain/manga/model/Manga.kt create mode 100644 domain/src/main/java/tachiyomi/domain/manga/model/TriStateFilter.kt diff --git a/app/src/main/java/eu/kanade/data/chapter/ChapterMapper.kt b/app/src/main/java/eu/kanade/data/chapter/ChapterMapper.kt index 05de96ef2..037275243 100644 --- a/app/src/main/java/eu/kanade/data/chapter/ChapterMapper.kt +++ b/app/src/main/java/eu/kanade/data/chapter/ChapterMapper.kt @@ -1,6 +1,6 @@ package eu.kanade.data.chapter -import eu.kanade.domain.chapter.model.Chapter +import tachiyomi.domain.chapter.model.Chapter val chapterMapper: (Long, Long, String, String, String?, Boolean, Boolean, Long, Float, Long, Long, Long) -> Chapter = { id, mangaId, url, name, scanlator, read, bookmark, lastPageRead, chapterNumber, sourceOrder, dateFetch, dateUpload -> diff --git a/app/src/main/java/eu/kanade/data/chapter/ChapterRepositoryImpl.kt b/app/src/main/java/eu/kanade/data/chapter/ChapterRepositoryImpl.kt index 0d5592e5a..a5e6734e0 100644 --- a/app/src/main/java/eu/kanade/data/chapter/ChapterRepositoryImpl.kt +++ b/app/src/main/java/eu/kanade/data/chapter/ChapterRepositoryImpl.kt @@ -1,13 +1,13 @@ package eu.kanade.data.chapter -import eu.kanade.domain.chapter.model.Chapter -import eu.kanade.domain.chapter.model.ChapterUpdate import eu.kanade.domain.chapter.repository.ChapterRepository import eu.kanade.tachiyomi.util.system.logcat import eu.kanade.tachiyomi.util.system.toLong import kotlinx.coroutines.flow.Flow import logcat.LogPriority import tachiyomi.data.DatabaseHandler +import tachiyomi.domain.chapter.model.Chapter +import tachiyomi.domain.chapter.model.ChapterUpdate class ChapterRepositoryImpl( private val handler: DatabaseHandler, diff --git a/app/src/main/java/eu/kanade/data/manga/MangaMapper.kt b/app/src/main/java/eu/kanade/data/manga/MangaMapper.kt index 6fb16429d..c43f8dd9a 100644 --- a/app/src/main/java/eu/kanade/data/manga/MangaMapper.kt +++ b/app/src/main/java/eu/kanade/data/manga/MangaMapper.kt @@ -1,8 +1,8 @@ package eu.kanade.data.manga import eu.kanade.domain.library.model.LibraryManga -import eu.kanade.domain.manga.model.Manga import eu.kanade.tachiyomi.source.model.UpdateStrategy +import tachiyomi.domain.manga.model.Manga val mangaMapper: (Long, Long, String, String?, String?, String?, List?, String, Long, String?, Boolean, Long?, Long?, Boolean, Long, Long, Long, Long, UpdateStrategy) -> Manga = { id, source, url, artist, author, description, genre, title, status, thumbnailUrl, favorite, lastUpdate, _, initialized, viewerFlags, chapterFlags, coverLastModified, dateAdded, updateStrategy -> diff --git a/app/src/main/java/eu/kanade/data/manga/MangaRepositoryImpl.kt b/app/src/main/java/eu/kanade/data/manga/MangaRepositoryImpl.kt index 8da709fd7..9c221a271 100644 --- a/app/src/main/java/eu/kanade/data/manga/MangaRepositoryImpl.kt +++ b/app/src/main/java/eu/kanade/data/manga/MangaRepositoryImpl.kt @@ -1,7 +1,6 @@ package eu.kanade.data.manga import eu.kanade.domain.library.model.LibraryManga -import eu.kanade.domain.manga.model.Manga import eu.kanade.domain.manga.repository.MangaRepository import eu.kanade.tachiyomi.util.system.logcat import eu.kanade.tachiyomi.util.system.toLong @@ -10,6 +9,7 @@ import logcat.LogPriority import tachiyomi.data.DatabaseHandler import tachiyomi.data.listOfStringsAdapter import tachiyomi.data.updateStrategyAdapter +import tachiyomi.domain.manga.model.Manga import tachiyomi.domain.manga.model.MangaUpdate class MangaRepositoryImpl( diff --git a/app/src/main/java/eu/kanade/domain/chapter/interactor/GetChapter.kt b/app/src/main/java/eu/kanade/domain/chapter/interactor/GetChapter.kt index 8d4be8a77..45236a1eb 100644 --- a/app/src/main/java/eu/kanade/domain/chapter/interactor/GetChapter.kt +++ b/app/src/main/java/eu/kanade/domain/chapter/interactor/GetChapter.kt @@ -1,9 +1,9 @@ package eu.kanade.domain.chapter.interactor -import eu.kanade.domain.chapter.model.Chapter import eu.kanade.domain.chapter.repository.ChapterRepository import eu.kanade.tachiyomi.util.system.logcat import logcat.LogPriority +import tachiyomi.domain.chapter.model.Chapter class GetChapter( private val chapterRepository: ChapterRepository, diff --git a/app/src/main/java/eu/kanade/domain/chapter/interactor/GetChapterByMangaId.kt b/app/src/main/java/eu/kanade/domain/chapter/interactor/GetChapterByMangaId.kt index b695388e7..7554a0437 100644 --- a/app/src/main/java/eu/kanade/domain/chapter/interactor/GetChapterByMangaId.kt +++ b/app/src/main/java/eu/kanade/domain/chapter/interactor/GetChapterByMangaId.kt @@ -1,9 +1,9 @@ package eu.kanade.domain.chapter.interactor -import eu.kanade.domain.chapter.model.Chapter import eu.kanade.domain.chapter.repository.ChapterRepository import eu.kanade.tachiyomi.util.system.logcat import logcat.LogPriority +import tachiyomi.domain.chapter.model.Chapter class GetChapterByMangaId( private val chapterRepository: ChapterRepository, diff --git a/app/src/main/java/eu/kanade/domain/chapter/interactor/SetDefaultChapterSettings.kt b/app/src/main/java/eu/kanade/domain/chapter/interactor/SetDefaultChapterSettings.kt index 45432c5d5..0e9ea9518 100644 --- a/app/src/main/java/eu/kanade/domain/chapter/interactor/SetDefaultChapterSettings.kt +++ b/app/src/main/java/eu/kanade/domain/chapter/interactor/SetDefaultChapterSettings.kt @@ -3,8 +3,8 @@ package eu.kanade.domain.chapter.interactor import eu.kanade.domain.library.service.LibraryPreferences import eu.kanade.domain.manga.interactor.GetFavorites import eu.kanade.domain.manga.interactor.SetMangaChapterFlags -import eu.kanade.domain.manga.model.Manga import eu.kanade.tachiyomi.util.lang.withNonCancellableContext +import tachiyomi.domain.manga.model.Manga class SetMangaDefaultChapterFlags( private val libraryPreferences: LibraryPreferences, diff --git a/app/src/main/java/eu/kanade/domain/chapter/interactor/SetReadStatus.kt b/app/src/main/java/eu/kanade/domain/chapter/interactor/SetReadStatus.kt index 21199cf3b..dbd1fff57 100644 --- a/app/src/main/java/eu/kanade/domain/chapter/interactor/SetReadStatus.kt +++ b/app/src/main/java/eu/kanade/domain/chapter/interactor/SetReadStatus.kt @@ -1,15 +1,15 @@ package eu.kanade.domain.chapter.interactor -import eu.kanade.domain.chapter.model.Chapter -import eu.kanade.domain.chapter.model.ChapterUpdate import eu.kanade.domain.chapter.repository.ChapterRepository import eu.kanade.domain.download.interactor.DeleteDownload import eu.kanade.domain.download.service.DownloadPreferences -import eu.kanade.domain.manga.model.Manga import eu.kanade.domain.manga.repository.MangaRepository import eu.kanade.tachiyomi.util.lang.withNonCancellableContext import eu.kanade.tachiyomi.util.system.logcat import logcat.LogPriority +import tachiyomi.domain.chapter.model.Chapter +import tachiyomi.domain.chapter.model.ChapterUpdate +import tachiyomi.domain.manga.model.Manga class SetReadStatus( private val downloadPreferences: DownloadPreferences, diff --git a/app/src/main/java/eu/kanade/domain/chapter/interactor/ShouldUpdateDbChapter.kt b/app/src/main/java/eu/kanade/domain/chapter/interactor/ShouldUpdateDbChapter.kt index e0d455feb..32ce3ec6d 100644 --- a/app/src/main/java/eu/kanade/domain/chapter/interactor/ShouldUpdateDbChapter.kt +++ b/app/src/main/java/eu/kanade/domain/chapter/interactor/ShouldUpdateDbChapter.kt @@ -1,6 +1,6 @@ package eu.kanade.domain.chapter.interactor -import eu.kanade.domain.chapter.model.Chapter +import tachiyomi.domain.chapter.model.Chapter class ShouldUpdateDbChapter { diff --git a/app/src/main/java/eu/kanade/domain/chapter/interactor/SyncChaptersWithSource.kt b/app/src/main/java/eu/kanade/domain/chapter/interactor/SyncChaptersWithSource.kt index 0026c7580..061fd4fc5 100644 --- a/app/src/main/java/eu/kanade/domain/chapter/interactor/SyncChaptersWithSource.kt +++ b/app/src/main/java/eu/kanade/domain/chapter/interactor/SyncChaptersWithSource.kt @@ -2,11 +2,11 @@ package eu.kanade.domain.chapter.interactor import eu.kanade.data.chapter.CleanupChapterName import eu.kanade.data.chapter.NoChaptersException -import eu.kanade.domain.chapter.model.Chapter -import eu.kanade.domain.chapter.model.toChapterUpdate +import eu.kanade.domain.chapter.model.copyFromSChapter +import eu.kanade.domain.chapter.model.toSChapter import eu.kanade.domain.chapter.repository.ChapterRepository import eu.kanade.domain.manga.interactor.UpdateManga -import eu.kanade.domain.manga.model.Manga +import eu.kanade.domain.manga.model.toSManga import eu.kanade.tachiyomi.data.download.DownloadManager import eu.kanade.tachiyomi.data.download.DownloadProvider import eu.kanade.tachiyomi.source.Source @@ -14,6 +14,9 @@ import eu.kanade.tachiyomi.source.isLocal import eu.kanade.tachiyomi.source.model.SChapter import eu.kanade.tachiyomi.source.online.HttpSource import eu.kanade.tachiyomi.util.chapter.ChapterRecognition +import tachiyomi.domain.chapter.model.Chapter +import tachiyomi.domain.chapter.model.toChapterUpdate +import tachiyomi.domain.manga.model.Manga import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get import java.lang.Long.max diff --git a/app/src/main/java/eu/kanade/domain/chapter/interactor/SyncChaptersWithTrackServiceTwoWay.kt b/app/src/main/java/eu/kanade/domain/chapter/interactor/SyncChaptersWithTrackServiceTwoWay.kt index bf4de3575..449534a14 100644 --- a/app/src/main/java/eu/kanade/domain/chapter/interactor/SyncChaptersWithTrackServiceTwoWay.kt +++ b/app/src/main/java/eu/kanade/domain/chapter/interactor/SyncChaptersWithTrackServiceTwoWay.kt @@ -1,13 +1,13 @@ package eu.kanade.domain.chapter.interactor -import eu.kanade.domain.chapter.model.Chapter -import eu.kanade.domain.chapter.model.toChapterUpdate import eu.kanade.domain.track.interactor.InsertTrack import eu.kanade.domain.track.model.Track import eu.kanade.domain.track.model.toDbTrack import eu.kanade.tachiyomi.data.track.TrackService import eu.kanade.tachiyomi.util.system.logcat import logcat.LogPriority +import tachiyomi.domain.chapter.model.Chapter +import tachiyomi.domain.chapter.model.toChapterUpdate import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get diff --git a/app/src/main/java/eu/kanade/domain/chapter/interactor/UpdateChapter.kt b/app/src/main/java/eu/kanade/domain/chapter/interactor/UpdateChapter.kt index 5dfa7a822..c8e2a1231 100644 --- a/app/src/main/java/eu/kanade/domain/chapter/interactor/UpdateChapter.kt +++ b/app/src/main/java/eu/kanade/domain/chapter/interactor/UpdateChapter.kt @@ -1,9 +1,9 @@ package eu.kanade.domain.chapter.interactor -import eu.kanade.domain.chapter.model.ChapterUpdate import eu.kanade.domain.chapter.repository.ChapterRepository import eu.kanade.tachiyomi.util.system.logcat import logcat.LogPriority +import tachiyomi.domain.chapter.model.ChapterUpdate class UpdateChapter( private val chapterRepository: ChapterRepository, diff --git a/app/src/main/java/eu/kanade/domain/chapter/model/Chapter.kt b/app/src/main/java/eu/kanade/domain/chapter/model/Chapter.kt index 324f9fca1..3492443dd 100644 --- a/app/src/main/java/eu/kanade/domain/chapter/model/Chapter.kt +++ b/app/src/main/java/eu/kanade/domain/chapter/model/Chapter.kt @@ -2,64 +2,30 @@ package eu.kanade.domain.chapter.model import eu.kanade.tachiyomi.data.database.models.ChapterImpl import eu.kanade.tachiyomi.source.model.SChapter +import tachiyomi.domain.chapter.model.Chapter import eu.kanade.tachiyomi.data.database.models.Chapter as DbChapter -data class Chapter( - val id: Long, - val mangaId: Long, - val read: Boolean, - val bookmark: Boolean, - val lastPageRead: Long, - val dateFetch: Long, - val sourceOrder: Long, - val url: String, - val name: String, - val dateUpload: Long, - val chapterNumber: Float, - val scanlator: String?, -) { - val isRecognizedNumber: Boolean - get() = chapterNumber >= 0f - - fun toSChapter(): SChapter { - return SChapter.create().also { - it.url = url - it.name = name - it.date_upload = dateUpload - it.chapter_number = chapterNumber - it.scanlator = scanlator - } - } - - fun copyFromSChapter(sChapter: SChapter): Chapter { - return this.copy( - name = sChapter.name, - url = sChapter.url, - dateUpload = sChapter.date_upload, - chapterNumber = sChapter.chapter_number, - scanlator = sChapter.scanlator?.ifBlank { null }, - ) - } - - companion object { - fun create() = Chapter( - id = -1, - mangaId = -1, - read = false, - bookmark = false, - lastPageRead = 0, - dateFetch = 0, - sourceOrder = 0, - url = "", - name = "", - dateUpload = -1, - chapterNumber = -1f, - scanlator = null, - ) +// TODO: Remove when all deps are migrated +fun Chapter.toSChapter(): SChapter { + return SChapter.create().also { + it.url = url + it.name = name + it.date_upload = dateUpload + it.chapter_number = chapterNumber + it.scanlator = scanlator } } -// TODO: Remove when all deps are migrated +fun Chapter.copyFromSChapter(sChapter: SChapter): Chapter { + return this.copy( + name = sChapter.name, + url = sChapter.url, + dateUpload = sChapter.date_upload, + chapterNumber = sChapter.chapter_number, + scanlator = sChapter.scanlator?.ifBlank { null }, + ) +} + fun Chapter.toDbChapter(): DbChapter = ChapterImpl().also { it.id = id it.manga_id = mangaId diff --git a/app/src/main/java/eu/kanade/domain/chapter/model/ChapterFilter.kt b/app/src/main/java/eu/kanade/domain/chapter/model/ChapterFilter.kt index 753beea5d..24c94c102 100644 --- a/app/src/main/java/eu/kanade/domain/chapter/model/ChapterFilter.kt +++ b/app/src/main/java/eu/kanade/domain/chapter/model/ChapterFilter.kt @@ -1,12 +1,14 @@ package eu.kanade.domain.chapter.model -import eu.kanade.domain.manga.model.Manga -import eu.kanade.domain.manga.model.TriStateFilter +import eu.kanade.domain.manga.model.downloadedFilter import eu.kanade.domain.manga.model.isLocal import eu.kanade.tachiyomi.data.download.DownloadManager import eu.kanade.tachiyomi.data.download.model.Download import eu.kanade.tachiyomi.ui.manga.ChapterItem import eu.kanade.tachiyomi.util.chapter.getChapterSort +import tachiyomi.domain.chapter.model.Chapter +import tachiyomi.domain.manga.model.Manga +import tachiyomi.domain.manga.model.TriStateFilter /** * Applies the view filters to the list of chapters obtained from the database. diff --git a/app/src/main/java/eu/kanade/domain/chapter/repository/ChapterRepository.kt b/app/src/main/java/eu/kanade/domain/chapter/repository/ChapterRepository.kt index 4b16ffadd..84f30b08f 100644 --- a/app/src/main/java/eu/kanade/domain/chapter/repository/ChapterRepository.kt +++ b/app/src/main/java/eu/kanade/domain/chapter/repository/ChapterRepository.kt @@ -1,8 +1,8 @@ package eu.kanade.domain.chapter.repository -import eu.kanade.domain.chapter.model.Chapter -import eu.kanade.domain.chapter.model.ChapterUpdate import kotlinx.coroutines.flow.Flow +import tachiyomi.domain.chapter.model.Chapter +import tachiyomi.domain.chapter.model.ChapterUpdate interface ChapterRepository { diff --git a/app/src/main/java/eu/kanade/domain/download/interactor/DeleteDownload.kt b/app/src/main/java/eu/kanade/domain/download/interactor/DeleteDownload.kt index 80af9deef..95d94f906 100644 --- a/app/src/main/java/eu/kanade/domain/download/interactor/DeleteDownload.kt +++ b/app/src/main/java/eu/kanade/domain/download/interactor/DeleteDownload.kt @@ -1,10 +1,10 @@ package eu.kanade.domain.download.interactor -import eu.kanade.domain.chapter.model.Chapter -import eu.kanade.domain.manga.model.Manga import eu.kanade.tachiyomi.data.download.DownloadManager import eu.kanade.tachiyomi.source.SourceManager import eu.kanade.tachiyomi.util.lang.withNonCancellableContext +import tachiyomi.domain.chapter.model.Chapter +import tachiyomi.domain.manga.model.Manga class DeleteDownload( private val sourceManager: SourceManager, diff --git a/app/src/main/java/eu/kanade/domain/history/interactor/GetNextChapters.kt b/app/src/main/java/eu/kanade/domain/history/interactor/GetNextChapters.kt index dadeb3546..ecd245197 100644 --- a/app/src/main/java/eu/kanade/domain/history/interactor/GetNextChapters.kt +++ b/app/src/main/java/eu/kanade/domain/history/interactor/GetNextChapters.kt @@ -1,10 +1,10 @@ package eu.kanade.domain.history.interactor import eu.kanade.domain.chapter.interactor.GetChapterByMangaId -import eu.kanade.domain.chapter.model.Chapter import eu.kanade.domain.history.repository.HistoryRepository import eu.kanade.domain.manga.interactor.GetManga import eu.kanade.tachiyomi.util.chapter.getChapterSort +import tachiyomi.domain.chapter.model.Chapter import kotlin.math.max class GetNextChapters( diff --git a/app/src/main/java/eu/kanade/domain/library/model/LibraryManga.kt b/app/src/main/java/eu/kanade/domain/library/model/LibraryManga.kt index 085e4096f..85a5728c1 100644 --- a/app/src/main/java/eu/kanade/domain/library/model/LibraryManga.kt +++ b/app/src/main/java/eu/kanade/domain/library/model/LibraryManga.kt @@ -1,6 +1,6 @@ package eu.kanade.domain.library.model -import eu.kanade.domain.manga.model.Manga +import tachiyomi.domain.manga.model.Manga data class LibraryManga( val manga: Manga, diff --git a/app/src/main/java/eu/kanade/domain/library/service/LibraryPreferences.kt b/app/src/main/java/eu/kanade/domain/library/service/LibraryPreferences.kt index 9eda330bd..60d3dd56d 100644 --- a/app/src/main/java/eu/kanade/domain/library/service/LibraryPreferences.kt +++ b/app/src/main/java/eu/kanade/domain/library/service/LibraryPreferences.kt @@ -1,6 +1,5 @@ package eu.kanade.domain.library.service -import eu.kanade.domain.manga.model.Manga import eu.kanade.tachiyomi.core.preference.PreferenceStore import eu.kanade.tachiyomi.data.preference.DEVICE_ONLY_ON_WIFI import eu.kanade.tachiyomi.data.preference.MANGA_HAS_UNREAD @@ -9,6 +8,7 @@ import eu.kanade.tachiyomi.data.preference.MANGA_NON_READ import eu.kanade.tachiyomi.widget.ExtendedNavigationView import tachiyomi.domain.library.model.LibraryDisplayMode import tachiyomi.domain.library.model.LibrarySort +import tachiyomi.domain.manga.model.Manga class LibraryPreferences( private val preferenceStore: PreferenceStore, diff --git a/app/src/main/java/eu/kanade/domain/manga/interactor/GetDuplicateLibraryManga.kt b/app/src/main/java/eu/kanade/domain/manga/interactor/GetDuplicateLibraryManga.kt index 02e7a4fc3..c7dd45b4b 100644 --- a/app/src/main/java/eu/kanade/domain/manga/interactor/GetDuplicateLibraryManga.kt +++ b/app/src/main/java/eu/kanade/domain/manga/interactor/GetDuplicateLibraryManga.kt @@ -1,7 +1,7 @@ package eu.kanade.domain.manga.interactor -import eu.kanade.domain.manga.model.Manga import eu.kanade.domain.manga.repository.MangaRepository +import tachiyomi.domain.manga.model.Manga class GetDuplicateLibraryManga( private val mangaRepository: MangaRepository, diff --git a/app/src/main/java/eu/kanade/domain/manga/interactor/GetFavorites.kt b/app/src/main/java/eu/kanade/domain/manga/interactor/GetFavorites.kt index 6365d86be..b433261a7 100644 --- a/app/src/main/java/eu/kanade/domain/manga/interactor/GetFavorites.kt +++ b/app/src/main/java/eu/kanade/domain/manga/interactor/GetFavorites.kt @@ -1,8 +1,8 @@ package eu.kanade.domain.manga.interactor -import eu.kanade.domain.manga.model.Manga import eu.kanade.domain.manga.repository.MangaRepository import kotlinx.coroutines.flow.Flow +import tachiyomi.domain.manga.model.Manga class GetFavorites( private val mangaRepository: MangaRepository, diff --git a/app/src/main/java/eu/kanade/domain/manga/interactor/GetManga.kt b/app/src/main/java/eu/kanade/domain/manga/interactor/GetManga.kt index 22518acc4..5ed196d0f 100644 --- a/app/src/main/java/eu/kanade/domain/manga/interactor/GetManga.kt +++ b/app/src/main/java/eu/kanade/domain/manga/interactor/GetManga.kt @@ -1,10 +1,10 @@ package eu.kanade.domain.manga.interactor -import eu.kanade.domain.manga.model.Manga import eu.kanade.domain.manga.repository.MangaRepository import eu.kanade.tachiyomi.util.system.logcat import kotlinx.coroutines.flow.Flow import logcat.LogPriority +import tachiyomi.domain.manga.model.Manga class GetManga( private val mangaRepository: MangaRepository, diff --git a/app/src/main/java/eu/kanade/domain/manga/interactor/GetMangaWithChapters.kt b/app/src/main/java/eu/kanade/domain/manga/interactor/GetMangaWithChapters.kt index 5189c42e0..34b0a3363 100644 --- a/app/src/main/java/eu/kanade/domain/manga/interactor/GetMangaWithChapters.kt +++ b/app/src/main/java/eu/kanade/domain/manga/interactor/GetMangaWithChapters.kt @@ -1,11 +1,11 @@ package eu.kanade.domain.manga.interactor -import eu.kanade.domain.chapter.model.Chapter import eu.kanade.domain.chapter.repository.ChapterRepository -import eu.kanade.domain.manga.model.Manga import eu.kanade.domain.manga.repository.MangaRepository import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.combine +import tachiyomi.domain.chapter.model.Chapter +import tachiyomi.domain.manga.model.Manga class GetMangaWithChapters( private val mangaRepository: MangaRepository, diff --git a/app/src/main/java/eu/kanade/domain/manga/interactor/NetworkToLocalManga.kt b/app/src/main/java/eu/kanade/domain/manga/interactor/NetworkToLocalManga.kt index 99f06f88f..71387571a 100644 --- a/app/src/main/java/eu/kanade/domain/manga/interactor/NetworkToLocalManga.kt +++ b/app/src/main/java/eu/kanade/domain/manga/interactor/NetworkToLocalManga.kt @@ -1,7 +1,7 @@ package eu.kanade.domain.manga.interactor -import eu.kanade.domain.manga.model.Manga import eu.kanade.domain.manga.repository.MangaRepository +import tachiyomi.domain.manga.model.Manga class NetworkToLocalManga( private val mangaRepository: MangaRepository, diff --git a/app/src/main/java/eu/kanade/domain/manga/interactor/SetMangaChapterFlags.kt b/app/src/main/java/eu/kanade/domain/manga/interactor/SetMangaChapterFlags.kt index e8eebcdc9..682754183 100644 --- a/app/src/main/java/eu/kanade/domain/manga/interactor/SetMangaChapterFlags.kt +++ b/app/src/main/java/eu/kanade/domain/manga/interactor/SetMangaChapterFlags.kt @@ -1,7 +1,7 @@ package eu.kanade.domain.manga.interactor -import eu.kanade.domain.manga.model.Manga import eu.kanade.domain.manga.repository.MangaRepository +import tachiyomi.domain.manga.model.Manga import tachiyomi.domain.manga.model.MangaUpdate class SetMangaChapterFlags( diff --git a/app/src/main/java/eu/kanade/domain/manga/interactor/UpdateManga.kt b/app/src/main/java/eu/kanade/domain/manga/interactor/UpdateManga.kt index f8cfcf859..cb747afa3 100644 --- a/app/src/main/java/eu/kanade/domain/manga/interactor/UpdateManga.kt +++ b/app/src/main/java/eu/kanade/domain/manga/interactor/UpdateManga.kt @@ -1,11 +1,11 @@ package eu.kanade.domain.manga.interactor -import eu.kanade.domain.manga.model.Manga import eu.kanade.domain.manga.model.hasCustomCover import eu.kanade.domain.manga.model.isLocal import eu.kanade.domain.manga.repository.MangaRepository import eu.kanade.tachiyomi.data.cache.CoverCache import eu.kanade.tachiyomi.source.model.SManga +import tachiyomi.domain.manga.model.Manga import tachiyomi.domain.manga.model.MangaUpdate import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get diff --git a/app/src/main/java/eu/kanade/domain/manga/model/ComicInfo.kt b/app/src/main/java/eu/kanade/domain/manga/model/ComicInfo.kt index 74d288f5a..95987f530 100644 --- a/app/src/main/java/eu/kanade/domain/manga/model/ComicInfo.kt +++ b/app/src/main/java/eu/kanade/domain/manga/model/ComicInfo.kt @@ -1,11 +1,12 @@ package eu.kanade.domain.manga.model -import eu.kanade.domain.chapter.model.Chapter import eu.kanade.tachiyomi.source.model.SManga import kotlinx.serialization.Serializable import nl.adaptivity.xmlutil.serialization.XmlElement import nl.adaptivity.xmlutil.serialization.XmlSerialName import nl.adaptivity.xmlutil.serialization.XmlValue +import tachiyomi.domain.chapter.model.Chapter +import tachiyomi.domain.manga.model.Manga const val COMIC_INFO_FILE = "ComicInfo.xml" diff --git a/app/src/main/java/eu/kanade/domain/manga/model/Manga.kt b/app/src/main/java/eu/kanade/domain/manga/model/Manga.kt index d938e23b5..a12076e77 100644 --- a/app/src/main/java/eu/kanade/domain/manga/model/Manga.kt +++ b/app/src/main/java/eu/kanade/domain/manga/model/Manga.kt @@ -4,215 +4,69 @@ import eu.kanade.domain.base.BasePreferences import eu.kanade.tachiyomi.data.cache.CoverCache import eu.kanade.tachiyomi.source.LocalSource import eu.kanade.tachiyomi.source.model.SManga -import eu.kanade.tachiyomi.source.model.UpdateStrategy import eu.kanade.tachiyomi.ui.reader.setting.OrientationType import eu.kanade.tachiyomi.ui.reader.setting.ReadingModeType -import eu.kanade.tachiyomi.widget.ExtendedNavigationView -import tachiyomi.domain.manga.model.MangaUpdate +import tachiyomi.domain.manga.model.Manga +import tachiyomi.domain.manga.model.TriStateFilter import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get -import java.io.Serializable -data class Manga( - val id: Long, - val source: Long, - val favorite: Boolean, - val lastUpdate: Long, - val dateAdded: Long, - val viewerFlags: Long, - val chapterFlags: Long, - val coverLastModified: Long, - val url: String, - val title: String, - val artist: String?, - val author: String?, - val description: String?, - val genre: List?, - val status: Long, - val thumbnailUrl: String?, - val updateStrategy: UpdateStrategy, - val initialized: Boolean, -) : Serializable { +// TODO: move these into the domain model +val Manga.readingModeType: Long + get() = viewerFlags and ReadingModeType.MASK.toLong() - val sorting: Long - get() = chapterFlags and CHAPTER_SORTING_MASK +val Manga.orientationType: Long + get() = viewerFlags and OrientationType.MASK.toLong() - val displayMode: Long - get() = chapterFlags and CHAPTER_DISPLAY_MASK - - val unreadFilterRaw: Long - get() = chapterFlags and CHAPTER_UNREAD_MASK - - val downloadedFilterRaw: Long - get() = chapterFlags and CHAPTER_DOWNLOADED_MASK - - val bookmarkedFilterRaw: Long - get() = chapterFlags and CHAPTER_BOOKMARKED_MASK - - val readingModeType: Long - get() = viewerFlags and ReadingModeType.MASK.toLong() - - val orientationType: Long - get() = viewerFlags and OrientationType.MASK.toLong() - - val unreadFilter: TriStateFilter - get() = when (unreadFilterRaw) { - CHAPTER_SHOW_UNREAD -> TriStateFilter.ENABLED_IS - CHAPTER_SHOW_READ -> TriStateFilter.ENABLED_NOT +val Manga.downloadedFilter: TriStateFilter + get() { + if (forceDownloaded()) return TriStateFilter.ENABLED_IS + return when (downloadedFilterRaw) { + Manga.CHAPTER_SHOW_DOWNLOADED -> TriStateFilter.ENABLED_IS + Manga.CHAPTER_SHOW_NOT_DOWNLOADED -> TriStateFilter.ENABLED_NOT else -> TriStateFilter.DISABLED } - - val downloadedFilter: TriStateFilter - get() { - if (forceDownloaded()) return TriStateFilter.ENABLED_IS - return when (downloadedFilterRaw) { - CHAPTER_SHOW_DOWNLOADED -> TriStateFilter.ENABLED_IS - CHAPTER_SHOW_NOT_DOWNLOADED -> TriStateFilter.ENABLED_NOT - else -> TriStateFilter.DISABLED - } - } - - val bookmarkedFilter: TriStateFilter - get() = when (bookmarkedFilterRaw) { - CHAPTER_SHOW_BOOKMARKED -> TriStateFilter.ENABLED_IS - CHAPTER_SHOW_NOT_BOOKMARKED -> TriStateFilter.ENABLED_NOT - else -> TriStateFilter.DISABLED - } - - fun chaptersFiltered(): Boolean { - return unreadFilter != TriStateFilter.DISABLED || - downloadedFilter != TriStateFilter.DISABLED || - bookmarkedFilter != TriStateFilter.DISABLED - } - - fun forceDownloaded(): Boolean { - return favorite && Injekt.get().downloadedOnly().get() - } - - fun sortDescending(): Boolean { - return chapterFlags and CHAPTER_SORT_DIR_MASK == CHAPTER_SORT_DESC - } - - fun toSManga(): SManga = SManga.create().also { - it.url = url - it.title = title - it.artist = artist - it.author = author - it.description = description - it.genre = genre.orEmpty().joinToString() - it.status = status.toInt() - it.thumbnail_url = thumbnailUrl - it.initialized = initialized - } - - fun copyFrom(other: SManga): Manga { - val author = other.author ?: author - val artist = other.artist ?: artist - val description = other.description ?: description - val genres = if (other.genre != null) { - other.getGenres() - } else { - genre - } - val thumbnailUrl = other.thumbnail_url ?: thumbnailUrl - return this.copy( - author = author, - artist = artist, - description = description, - genre = genres, - thumbnailUrl = thumbnailUrl, - status = other.status.toLong(), - updateStrategy = other.update_strategy, - initialized = other.initialized && initialized, - ) - } - - companion object { - // Generic filter that does not filter anything - const val SHOW_ALL = 0x00000000L - - const val CHAPTER_SORT_DESC = 0x00000000L - const val CHAPTER_SORT_ASC = 0x00000001L - const val CHAPTER_SORT_DIR_MASK = 0x00000001L - - const val CHAPTER_SHOW_UNREAD = 0x00000002L - const val CHAPTER_SHOW_READ = 0x00000004L - const val CHAPTER_UNREAD_MASK = 0x00000006L - - const val CHAPTER_SHOW_DOWNLOADED = 0x00000008L - const val CHAPTER_SHOW_NOT_DOWNLOADED = 0x00000010L - const val CHAPTER_DOWNLOADED_MASK = 0x00000018L - - const val CHAPTER_SHOW_BOOKMARKED = 0x00000020L - const val CHAPTER_SHOW_NOT_BOOKMARKED = 0x00000040L - const val CHAPTER_BOOKMARKED_MASK = 0x00000060L - - const val CHAPTER_SORTING_SOURCE = 0x00000000L - const val CHAPTER_SORTING_NUMBER = 0x00000100L - const val CHAPTER_SORTING_UPLOAD_DATE = 0x00000200L - const val CHAPTER_SORTING_MASK = 0x00000300L - - const val CHAPTER_DISPLAY_NAME = 0x00000000L - const val CHAPTER_DISPLAY_NUMBER = 0x00100000L - const val CHAPTER_DISPLAY_MASK = 0x00100000L - - fun create() = Manga( - id = -1L, - url = "", - title = "", - source = -1L, - favorite = false, - lastUpdate = 0L, - dateAdded = 0L, - viewerFlags = 0L, - chapterFlags = 0L, - coverLastModified = 0L, - artist = null, - author = null, - description = null, - genre = null, - status = 0L, - thumbnailUrl = null, - updateStrategy = UpdateStrategy.ALWAYS_UPDATE, - initialized = false, - ) } +fun Manga.chaptersFiltered(): Boolean { + return unreadFilter != TriStateFilter.DISABLED || + downloadedFilter != TriStateFilter.DISABLED || + bookmarkedFilter != TriStateFilter.DISABLED +} +fun Manga.forceDownloaded(): Boolean { + return favorite && Injekt.get().downloadedOnly().get() } -enum class TriStateFilter { - DISABLED, // Disable filter - ENABLED_IS, // Enabled with "is" filter - ENABLED_NOT, // Enabled with "not" filter +fun Manga.toSManga(): SManga = SManga.create().also { + it.url = url + it.title = title + it.artist = artist + it.author = author + it.description = description + it.genre = genre.orEmpty().joinToString() + it.status = status.toInt() + it.thumbnail_url = thumbnailUrl + it.initialized = initialized } -fun TriStateFilter.toTriStateGroupState(): ExtendedNavigationView.Item.TriStateGroup.State { - return when (this) { - TriStateFilter.DISABLED -> ExtendedNavigationView.Item.TriStateGroup.State.IGNORE - TriStateFilter.ENABLED_IS -> ExtendedNavigationView.Item.TriStateGroup.State.INCLUDE - TriStateFilter.ENABLED_NOT -> ExtendedNavigationView.Item.TriStateGroup.State.EXCLUDE +fun Manga.copyFrom(other: SManga): Manga { + val author = other.author ?: author + val artist = other.artist ?: artist + val description = other.description ?: description + val genres = if (other.genre != null) { + other.getGenres() + } else { + genre } -} - -fun Manga.toMangaUpdate(): MangaUpdate { - return MangaUpdate( - id = id, - source = source, - favorite = favorite, - lastUpdate = lastUpdate, - dateAdded = dateAdded, - viewerFlags = viewerFlags, - chapterFlags = chapterFlags, - coverLastModified = coverLastModified, - url = url, - title = title, - artist = artist, + val thumbnailUrl = other.thumbnail_url ?: thumbnailUrl + return this.copy( author = author, + artist = artist, description = description, - genre = genre, - status = status, + genre = genres, thumbnailUrl = thumbnailUrl, - updateStrategy = updateStrategy, - initialized = initialized, + status = other.status.toLong(), + updateStrategy = other.update_strategy, + initialized = other.initialized && initialized, ) } diff --git a/app/src/main/java/eu/kanade/domain/manga/model/MangaCover.kt b/app/src/main/java/eu/kanade/domain/manga/model/MangaCover.kt deleted file mode 100644 index d0dec8cee..000000000 --- a/app/src/main/java/eu/kanade/domain/manga/model/MangaCover.kt +++ /dev/null @@ -1,13 +0,0 @@ -package eu.kanade.domain.manga.model - -import tachiyomi.domain.manga.model.MangaCover - -fun Manga.asMangaCover(): MangaCover { - return MangaCover( - mangaId = id, - sourceId = source, - isMangaFavorite = favorite, - url = thumbnailUrl, - lastModified = coverLastModified, - ) -} diff --git a/app/src/main/java/eu/kanade/domain/manga/repository/MangaRepository.kt b/app/src/main/java/eu/kanade/domain/manga/repository/MangaRepository.kt index 911de4191..30511d415 100644 --- a/app/src/main/java/eu/kanade/domain/manga/repository/MangaRepository.kt +++ b/app/src/main/java/eu/kanade/domain/manga/repository/MangaRepository.kt @@ -1,8 +1,8 @@ package eu.kanade.domain.manga.repository import eu.kanade.domain.library.model.LibraryManga -import eu.kanade.domain.manga.model.Manga import kotlinx.coroutines.flow.Flow +import tachiyomi.domain.manga.model.Manga import tachiyomi.domain.manga.model.MangaUpdate interface MangaRepository { diff --git a/app/src/main/java/eu/kanade/presentation/browse/BrowseSourceScreen.kt b/app/src/main/java/eu/kanade/presentation/browse/BrowseSourceScreen.kt index 2d27bae36..8faf02266 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/BrowseSourceScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/BrowseSourceScreen.kt @@ -15,7 +15,6 @@ import androidx.compose.ui.platform.LocalContext import androidx.paging.LoadState import androidx.paging.compose.LazyPagingItems import eu.kanade.data.source.NoResultsException -import eu.kanade.domain.manga.model.Manga import eu.kanade.presentation.browse.components.BrowseSourceComfortableGrid import eu.kanade.presentation.browse.components.BrowseSourceCompactGrid import eu.kanade.presentation.browse.components.BrowseSourceList @@ -27,6 +26,7 @@ import eu.kanade.tachiyomi.source.CatalogueSource import eu.kanade.tachiyomi.source.LocalSource import kotlinx.coroutines.flow.StateFlow import tachiyomi.domain.library.model.LibraryDisplayMode +import tachiyomi.domain.manga.model.Manga @Composable fun BrowseSourceContent( diff --git a/app/src/main/java/eu/kanade/presentation/browse/GlobalSearchScreen.kt b/app/src/main/java/eu/kanade/presentation/browse/GlobalSearchScreen.kt index 89d6f1879..66c537bda 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/GlobalSearchScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/GlobalSearchScreen.kt @@ -8,7 +8,6 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.State import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource -import eu.kanade.domain.manga.model.Manga import eu.kanade.presentation.browse.components.GlobalSearchCardRow import eu.kanade.presentation.browse.components.GlobalSearchErrorResultItem import eu.kanade.presentation.browse.components.GlobalSearchLoadingResultItem @@ -23,6 +22,7 @@ import eu.kanade.tachiyomi.source.CatalogueSource import eu.kanade.tachiyomi.ui.browse.source.globalsearch.GlobalSearchState import eu.kanade.tachiyomi.ui.browse.source.globalsearch.SearchItemResult import eu.kanade.tachiyomi.util.system.LocaleHelper +import tachiyomi.domain.manga.model.Manga @Composable fun GlobalSearchScreen( diff --git a/app/src/main/java/eu/kanade/presentation/browse/MigrateMangaScreen.kt b/app/src/main/java/eu/kanade/presentation/browse/MigrateMangaScreen.kt index ca06c6d46..970d479bd 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/MigrateMangaScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/MigrateMangaScreen.kt @@ -5,7 +5,6 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.items import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier -import eu.kanade.domain.manga.model.Manga import eu.kanade.presentation.components.AppBar import eu.kanade.presentation.components.EmptyScreen import eu.kanade.presentation.components.FastScrollLazyColumn @@ -13,6 +12,7 @@ import eu.kanade.presentation.components.Scaffold import eu.kanade.presentation.manga.components.BaseMangaListItem import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.ui.browse.migration.manga.MigrateMangaState +import tachiyomi.domain.manga.model.Manga @Composable fun MigrateMangaScreen( diff --git a/app/src/main/java/eu/kanade/presentation/browse/MigrateSearchScreen.kt b/app/src/main/java/eu/kanade/presentation/browse/MigrateSearchScreen.kt index 2a3755787..0dd2973d3 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/MigrateSearchScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/MigrateSearchScreen.kt @@ -4,7 +4,6 @@ import androidx.compose.foundation.layout.PaddingValues import androidx.compose.runtime.Composable import androidx.compose.runtime.State import androidx.compose.ui.res.stringResource -import eu.kanade.domain.manga.model.Manga import eu.kanade.presentation.browse.components.GlobalSearchCardRow import eu.kanade.presentation.browse.components.GlobalSearchEmptyResultItem import eu.kanade.presentation.browse.components.GlobalSearchErrorResultItem @@ -19,6 +18,7 @@ import eu.kanade.tachiyomi.source.CatalogueSource import eu.kanade.tachiyomi.ui.browse.migration.search.MigrateSearchState import eu.kanade.tachiyomi.ui.browse.source.globalsearch.SearchItemResult import eu.kanade.tachiyomi.util.system.LocaleHelper +import tachiyomi.domain.manga.model.Manga @Composable fun MigrateSearchScreen( diff --git a/app/src/main/java/eu/kanade/presentation/browse/components/BrowseSourceComfortableGrid.kt b/app/src/main/java/eu/kanade/presentation/browse/components/BrowseSourceComfortableGrid.kt index 976e77d85..86f0eac95 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/components/BrowseSourceComfortableGrid.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/components/BrowseSourceComfortableGrid.kt @@ -11,12 +11,12 @@ import androidx.compose.runtime.getValue import androidx.compose.ui.unit.dp import androidx.paging.LoadState import androidx.paging.compose.LazyPagingItems -import eu.kanade.domain.manga.model.Manga import eu.kanade.presentation.browse.InLibraryBadge import eu.kanade.presentation.components.CommonMangaItemDefaults import eu.kanade.presentation.components.MangaComfortableGridItem import eu.kanade.presentation.util.plus import kotlinx.coroutines.flow.StateFlow +import tachiyomi.domain.manga.model.Manga import tachiyomi.domain.manga.model.MangaCover @Composable diff --git a/app/src/main/java/eu/kanade/presentation/browse/components/BrowseSourceCompactGrid.kt b/app/src/main/java/eu/kanade/presentation/browse/components/BrowseSourceCompactGrid.kt index dd84849d1..afe658e82 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/components/BrowseSourceCompactGrid.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/components/BrowseSourceCompactGrid.kt @@ -11,12 +11,12 @@ import androidx.compose.runtime.getValue import androidx.compose.ui.unit.dp import androidx.paging.LoadState import androidx.paging.compose.LazyPagingItems -import eu.kanade.domain.manga.model.Manga import eu.kanade.presentation.browse.InLibraryBadge import eu.kanade.presentation.components.CommonMangaItemDefaults import eu.kanade.presentation.components.MangaCompactGridItem import eu.kanade.presentation.util.plus import kotlinx.coroutines.flow.StateFlow +import tachiyomi.domain.manga.model.Manga import tachiyomi.domain.manga.model.MangaCover @Composable diff --git a/app/src/main/java/eu/kanade/presentation/browse/components/BrowseSourceDialogs.kt b/app/src/main/java/eu/kanade/presentation/browse/components/BrowseSourceDialogs.kt index 95158cce7..aa349e005 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/components/BrowseSourceDialogs.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/components/BrowseSourceDialogs.kt @@ -7,8 +7,8 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.setValue import androidx.compose.ui.res.stringResource -import eu.kanade.domain.manga.model.Manga import eu.kanade.tachiyomi.R +import tachiyomi.domain.manga.model.Manga @Composable fun RemoveMangaDialog( diff --git a/app/src/main/java/eu/kanade/presentation/browse/components/BrowseSourceList.kt b/app/src/main/java/eu/kanade/presentation/browse/components/BrowseSourceList.kt index b86a95b34..8c755963e 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/components/BrowseSourceList.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/components/BrowseSourceList.kt @@ -8,13 +8,13 @@ import androidx.compose.ui.unit.dp import androidx.paging.LoadState import androidx.paging.compose.LazyPagingItems import androidx.paging.compose.items -import eu.kanade.domain.manga.model.Manga import eu.kanade.presentation.browse.InLibraryBadge import eu.kanade.presentation.components.CommonMangaItemDefaults import eu.kanade.presentation.components.LazyColumn import eu.kanade.presentation.components.MangaListItem import eu.kanade.presentation.util.plus import kotlinx.coroutines.flow.StateFlow +import tachiyomi.domain.manga.model.Manga import tachiyomi.domain.manga.model.MangaCover @Composable diff --git a/app/src/main/java/eu/kanade/presentation/browse/components/GlobalSearchCardRow.kt b/app/src/main/java/eu/kanade/presentation/browse/components/GlobalSearchCardRow.kt index d2f15a29e..0bd25cd23 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/components/GlobalSearchCardRow.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/components/GlobalSearchCardRow.kt @@ -8,9 +8,9 @@ import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.runtime.State import androidx.compose.runtime.getValue -import eu.kanade.domain.manga.model.Manga -import eu.kanade.domain.manga.model.asMangaCover import eu.kanade.presentation.util.padding +import tachiyomi.domain.manga.model.Manga +import tachiyomi.domain.manga.model.asMangaCover @Composable fun GlobalSearchCardRow( diff --git a/app/src/main/java/eu/kanade/presentation/components/SettingsItems.kt b/app/src/main/java/eu/kanade/presentation/components/SettingsItems.kt index ba454cded..e4fa2172a 100644 --- a/app/src/main/java/eu/kanade/presentation/components/SettingsItems.kt +++ b/app/src/main/java/eu/kanade/presentation/components/SettingsItems.kt @@ -22,7 +22,7 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp -import eu.kanade.domain.manga.model.TriStateFilter +import tachiyomi.domain.manga.model.TriStateFilter @Composable fun TriStateItem( diff --git a/app/src/main/java/eu/kanade/presentation/manga/ChapterSettingsDialog.kt b/app/src/main/java/eu/kanade/presentation/manga/ChapterSettingsDialog.kt index c6b9b35da..0a81f834b 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/ChapterSettingsDialog.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/ChapterSettingsDialog.kt @@ -22,14 +22,16 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp -import eu.kanade.domain.manga.model.Manga -import eu.kanade.domain.manga.model.TriStateFilter +import eu.kanade.domain.manga.model.downloadedFilter +import eu.kanade.domain.manga.model.forceDownloaded import eu.kanade.presentation.components.RadioItem import eu.kanade.presentation.components.SortItem import eu.kanade.presentation.components.TabbedDialog import eu.kanade.presentation.components.TabbedDialogPaddings import eu.kanade.presentation.components.TriStateItem import eu.kanade.tachiyomi.R +import tachiyomi.domain.manga.model.Manga +import tachiyomi.domain.manga.model.TriStateFilter @Composable fun ChapterSettingsDialog( diff --git a/app/src/main/java/eu/kanade/presentation/manga/MangaScreen.kt b/app/src/main/java/eu/kanade/presentation/manga/MangaScreen.kt index 850cd89cc..e9bee59c9 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/MangaScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/MangaScreen.kt @@ -47,8 +47,7 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.util.fastAll import androidx.compose.ui.util.fastAny import androidx.compose.ui.util.fastMap -import eu.kanade.domain.chapter.model.Chapter -import eu.kanade.domain.manga.model.Manga +import eu.kanade.domain.manga.model.chaptersFiltered import eu.kanade.presentation.components.ChapterDownloadAction import eu.kanade.presentation.components.ExtendedFloatingActionButton import eu.kanade.presentation.components.LazyColumn @@ -73,6 +72,8 @@ import eu.kanade.tachiyomi.ui.manga.ChapterItem import eu.kanade.tachiyomi.ui.manga.MangaScreenState import eu.kanade.tachiyomi.ui.manga.chapterDecimalFormat import eu.kanade.tachiyomi.util.lang.toRelativeString +import tachiyomi.domain.chapter.model.Chapter +import tachiyomi.domain.manga.model.Manga import java.text.DateFormat import java.util.Date diff --git a/app/src/main/java/eu/kanade/presentation/manga/components/BaseMangaListItem.kt b/app/src/main/java/eu/kanade/presentation/manga/components/BaseMangaListItem.kt index 171ab90fa..b6d8eae23 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/components/BaseMangaListItem.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/components/BaseMangaListItem.kt @@ -14,9 +14,9 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp -import eu.kanade.domain.manga.model.Manga import eu.kanade.presentation.components.MangaCover import eu.kanade.presentation.util.padding +import tachiyomi.domain.manga.model.Manga @Composable fun BaseMangaListItem( diff --git a/app/src/main/java/eu/kanade/presentation/manga/components/MangaCoverDialog.kt b/app/src/main/java/eu/kanade/presentation/manga/components/MangaCoverDialog.kt index 9935fda13..6b3c8c4e2 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/components/MangaCoverDialog.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/components/MangaCoverDialog.kt @@ -42,13 +42,13 @@ import androidx.core.view.updatePadding import coil.imageLoader import coil.request.ImageRequest import coil.size.Size -import eu.kanade.domain.manga.model.Manga import eu.kanade.presentation.components.DropdownMenu import eu.kanade.presentation.components.Scaffold import eu.kanade.presentation.manga.EditCoverAction import eu.kanade.presentation.util.clickableNoIndication import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.ui.reader.viewer.ReaderPageImageView +import tachiyomi.domain.manga.model.Manga @Composable fun MangaCoverDialog( diff --git a/app/src/main/java/eu/kanade/presentation/manga/components/MangaInfoHeader.kt b/app/src/main/java/eu/kanade/presentation/manga/components/MangaInfoHeader.kt index c2e53be16..7bc36cd91 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/components/MangaInfoHeader.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/components/MangaInfoHeader.kt @@ -72,7 +72,6 @@ import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import coil.compose.AsyncImage import com.google.accompanist.flowlayout.FlowRow -import eu.kanade.domain.manga.model.Manga import eu.kanade.presentation.components.MangaCover import eu.kanade.presentation.components.TextButton import eu.kanade.presentation.util.clickableNoIndication @@ -81,6 +80,7 @@ import eu.kanade.presentation.util.secondaryItemAlpha import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.source.model.SManga import eu.kanade.tachiyomi.util.system.copyToClipboard +import tachiyomi.domain.manga.model.Manga import kotlin.math.roundToInt private val whitespaceLineRegex = Regex("[\\r\\n]{2,}", setOf(RegexOption.MULTILINE)) 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 2016af3cd..70d65c183 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 @@ -50,7 +50,7 @@ import uy.kohesive.injekt.api.get import java.io.FileOutputStream import java.util.Date import kotlin.math.max -import eu.kanade.domain.manga.model.Manga as DomainManga +import tachiyomi.domain.manga.model.Manga as DomainManga class BackupManager( private val context: Context, diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupManga.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupManga.kt index 3f6f1d8df..f821f8e45 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupManga.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupManga.kt @@ -1,6 +1,5 @@ package eu.kanade.tachiyomi.data.backup.models -import eu.kanade.domain.manga.model.Manga import eu.kanade.tachiyomi.data.database.models.ChapterImpl import eu.kanade.tachiyomi.data.database.models.MangaImpl import eu.kanade.tachiyomi.data.database.models.TrackImpl @@ -8,6 +7,7 @@ import eu.kanade.tachiyomi.source.model.UpdateStrategy import eu.kanade.tachiyomi.ui.reader.setting.ReadingModeType import kotlinx.serialization.Serializable import kotlinx.serialization.protobuf.ProtoNumber +import tachiyomi.domain.manga.model.Manga @Suppress("DEPRECATION") @Serializable diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/cache/ChapterCache.kt b/app/src/main/java/eu/kanade/tachiyomi/data/cache/ChapterCache.kt index 9842a8ff0..37b7261fd 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/cache/ChapterCache.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/cache/ChapterCache.kt @@ -3,7 +3,6 @@ package eu.kanade.tachiyomi.data.cache import android.content.Context import android.text.format.Formatter import com.jakewharton.disklrucache.DiskLruCache -import eu.kanade.domain.chapter.model.Chapter import eu.kanade.tachiyomi.source.model.Page import eu.kanade.tachiyomi.util.storage.DiskUtil import eu.kanade.tachiyomi.util.storage.saveTo @@ -13,6 +12,7 @@ import kotlinx.serialization.json.Json import okhttp3.Response import okio.buffer import okio.sink +import tachiyomi.domain.chapter.model.Chapter import uy.kohesive.injekt.injectLazy import java.io.File import java.io.IOException diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/cache/CoverCache.kt b/app/src/main/java/eu/kanade/tachiyomi/data/cache/CoverCache.kt index 1195b7531..73d2e0833 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/cache/CoverCache.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/cache/CoverCache.kt @@ -1,8 +1,8 @@ package eu.kanade.tachiyomi.data.cache import android.content.Context -import eu.kanade.domain.manga.model.Manga import eu.kanade.tachiyomi.util.storage.DiskUtil +import tachiyomi.domain.manga.model.Manga import java.io.File import java.io.IOException import java.io.InputStream diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/coil/MangaCoverFetcher.kt b/app/src/main/java/eu/kanade/tachiyomi/data/coil/MangaCoverFetcher.kt index 1a81cf484..f5225bfc2 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/coil/MangaCoverFetcher.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/coil/MangaCoverFetcher.kt @@ -30,7 +30,7 @@ import okio.sink import tachiyomi.domain.manga.model.MangaCover import uy.kohesive.injekt.injectLazy import java.io.File -import eu.kanade.domain.manga.model.Manga as DomainManga +import tachiyomi.domain.manga.model.Manga as DomainManga /** * A [Fetcher] that fetches cover image for [Manga] object. diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/coil/MangaCoverKeyer.kt b/app/src/main/java/eu/kanade/tachiyomi/data/coil/MangaCoverKeyer.kt index 9fa7b95b2..068d88581 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/coil/MangaCoverKeyer.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/coil/MangaCoverKeyer.kt @@ -9,7 +9,7 @@ import eu.kanade.tachiyomi.data.database.models.toDomainManga import tachiyomi.domain.manga.model.MangaCover import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get -import eu.kanade.domain.manga.model.Manga as DomainManga +import tachiyomi.domain.manga.model.Manga as DomainManga class MangaKeyer : Keyer { override fun key(data: Manga, options: Options): String { diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Chapter.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Chapter.kt index 771ebb32a..8ca265d6b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Chapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Chapter.kt @@ -2,7 +2,7 @@ package eu.kanade.tachiyomi.data.database.models import eu.kanade.tachiyomi.source.model.SChapter import java.io.Serializable -import eu.kanade.domain.chapter.model.Chapter as DomainChapter +import tachiyomi.domain.chapter.model.Chapter as DomainChapter interface Chapter : SChapter, Serializable { diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Manga.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Manga.kt index e35612948..d6557894b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Manga.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Manga.kt @@ -3,7 +3,7 @@ package eu.kanade.tachiyomi.data.database.models import eu.kanade.tachiyomi.source.model.SManga import eu.kanade.tachiyomi.ui.reader.setting.OrientationType import eu.kanade.tachiyomi.ui.reader.setting.ReadingModeType -import eu.kanade.domain.manga.model.Manga as DomainManga +import tachiyomi.domain.manga.model.Manga as DomainManga interface Manga : SManga { diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadCache.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadCache.kt index 417b71c3b..842a36651 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadCache.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadCache.kt @@ -4,9 +4,7 @@ import android.content.Context import androidx.core.net.toUri import com.hippo.unifile.UniFile import eu.kanade.core.util.mapNotNullKeys -import eu.kanade.domain.chapter.model.Chapter import eu.kanade.domain.download.service.DownloadPreferences -import eu.kanade.domain.manga.model.Manga import eu.kanade.tachiyomi.extension.ExtensionManager import eu.kanade.tachiyomi.source.Source import eu.kanade.tachiyomi.source.SourceManager @@ -32,6 +30,8 @@ import kotlinx.coroutines.flow.shareIn import kotlinx.coroutines.flow.stateIn import kotlinx.coroutines.withTimeout import logcat.LogPriority +import tachiyomi.domain.chapter.model.Chapter +import tachiyomi.domain.manga.model.Manga import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get import java.util.concurrent.ConcurrentHashMap diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadManager.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadManager.kt index bb9cfcb2a..96164a32f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadManager.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadManager.kt @@ -2,9 +2,7 @@ package eu.kanade.tachiyomi.data.download import android.content.Context import eu.kanade.domain.category.interactor.GetCategories -import eu.kanade.domain.chapter.model.Chapter import eu.kanade.domain.download.service.DownloadPreferences -import eu.kanade.domain.manga.model.Manga import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.download.model.Download import eu.kanade.tachiyomi.data.download.model.DownloadQueue @@ -15,6 +13,8 @@ import eu.kanade.tachiyomi.util.lang.launchIO import eu.kanade.tachiyomi.util.system.logcat import kotlinx.coroutines.runBlocking import logcat.LogPriority +import tachiyomi.domain.chapter.model.Chapter +import tachiyomi.domain.manga.model.Manga import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadPendingDeleter.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadPendingDeleter.kt index 4ac80ac28..00de0e697 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadPendingDeleter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadPendingDeleter.kt @@ -2,12 +2,12 @@ package eu.kanade.tachiyomi.data.download import android.content.Context import androidx.core.content.edit -import eu.kanade.domain.chapter.model.Chapter -import eu.kanade.domain.manga.model.Manga import kotlinx.serialization.Serializable import kotlinx.serialization.decodeFromString import kotlinx.serialization.encodeToString import kotlinx.serialization.json.Json +import tachiyomi.domain.chapter.model.Chapter +import tachiyomi.domain.manga.model.Manga import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadProvider.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadProvider.kt index 1b43ad73e..59864f4a4 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadProvider.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadProvider.kt @@ -3,9 +3,7 @@ package eu.kanade.tachiyomi.data.download import android.content.Context import androidx.core.net.toUri import com.hippo.unifile.UniFile -import eu.kanade.domain.chapter.model.Chapter import eu.kanade.domain.download.service.DownloadPreferences -import eu.kanade.domain.manga.model.Manga import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.source.Source import eu.kanade.tachiyomi.util.storage.DiskUtil @@ -14,6 +12,8 @@ import kotlinx.coroutines.MainScope import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach import logcat.LogPriority +import tachiyomi.domain.chapter.model.Chapter +import tachiyomi.domain.manga.model.Manga import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadStore.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadStore.kt index dd3e87476..08962d280 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadStore.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadStore.kt @@ -4,7 +4,6 @@ import android.content.Context import androidx.core.content.edit import eu.kanade.domain.chapter.interactor.GetChapter import eu.kanade.domain.manga.interactor.GetManga -import eu.kanade.domain.manga.model.Manga import eu.kanade.tachiyomi.data.download.model.Download import eu.kanade.tachiyomi.source.SourceManager import eu.kanade.tachiyomi.source.online.HttpSource @@ -13,6 +12,7 @@ import kotlinx.serialization.Serializable import kotlinx.serialization.decodeFromString import kotlinx.serialization.encodeToString import kotlinx.serialization.json.Json +import tachiyomi.domain.manga.model.Manga import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt index 02fb892ad..98fc4fff2 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt @@ -3,11 +3,10 @@ package eu.kanade.tachiyomi.data.download import android.content.Context import com.hippo.unifile.UniFile import com.jakewharton.rxrelay.PublishRelay -import eu.kanade.domain.chapter.model.Chapter +import eu.kanade.domain.chapter.model.toSChapter import eu.kanade.domain.download.service.DownloadPreferences import eu.kanade.domain.manga.model.COMIC_INFO_FILE import eu.kanade.domain.manga.model.ComicInfo -import eu.kanade.domain.manga.model.Manga import eu.kanade.domain.manga.model.getComicInfo import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.cache.ChapterCache @@ -38,6 +37,8 @@ import rx.Observable import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers import rx.subscriptions.CompositeSubscription +import tachiyomi.domain.chapter.model.Chapter +import tachiyomi.domain.manga.model.Manga import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get import java.io.BufferedOutputStream diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/model/Download.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/model/Download.kt index 045ab8b54..38ddacddb 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/model/Download.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/model/Download.kt @@ -1,13 +1,13 @@ package eu.kanade.tachiyomi.data.download.model import eu.kanade.domain.chapter.interactor.GetChapter -import eu.kanade.domain.chapter.model.Chapter import eu.kanade.domain.manga.interactor.GetManga -import eu.kanade.domain.manga.model.Manga import eu.kanade.tachiyomi.source.SourceManager import eu.kanade.tachiyomi.source.model.Page import eu.kanade.tachiyomi.source.online.HttpSource import rx.subjects.PublishSubject +import tachiyomi.domain.chapter.model.Chapter +import tachiyomi.domain.manga.model.Manga import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/model/DownloadQueue.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/model/DownloadQueue.kt index 678060745..7b3867a7b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/model/DownloadQueue.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/model/DownloadQueue.kt @@ -1,8 +1,6 @@ package eu.kanade.tachiyomi.data.download.model import eu.kanade.core.util.asFlow -import eu.kanade.domain.chapter.model.Chapter -import eu.kanade.domain.manga.model.Manga import eu.kanade.tachiyomi.data.download.DownloadStore import eu.kanade.tachiyomi.source.model.Page import eu.kanade.tachiyomi.util.lang.launchNonCancellable @@ -17,6 +15,8 @@ import kotlinx.coroutines.flow.receiveAsFlow import kotlinx.coroutines.flow.shareIn import rx.Observable import rx.subjects.PublishSubject +import tachiyomi.domain.chapter.model.Chapter +import tachiyomi.domain.manga.model.Manga import java.util.concurrent.CopyOnWriteArrayList class DownloadQueue( diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateNotifier.kt b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateNotifier.kt index e359be465..1c4c95149 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateNotifier.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateNotifier.kt @@ -13,8 +13,6 @@ import androidx.core.app.NotificationManagerCompat import coil.imageLoader import coil.request.ImageRequest import coil.transform.CircleCropTransformation -import eu.kanade.domain.chapter.model.Chapter -import eu.kanade.domain.manga.model.Manga import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.core.security.SecurityPreferences import eu.kanade.tachiyomi.data.download.Downloader @@ -27,6 +25,8 @@ import eu.kanade.tachiyomi.util.lang.launchUI import eu.kanade.tachiyomi.util.system.notification import eu.kanade.tachiyomi.util.system.notificationBuilder import eu.kanade.tachiyomi.util.system.notificationManager +import tachiyomi.domain.chapter.model.Chapter +import tachiyomi.domain.manga.model.Manga import uy.kohesive.injekt.injectLazy import java.text.DecimalFormat import java.text.DecimalFormatSymbols diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt index 059f47c7b..a0c76430f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt @@ -11,15 +11,14 @@ import eu.kanade.domain.category.interactor.GetCategories import eu.kanade.domain.chapter.interactor.GetChapterByMangaId import eu.kanade.domain.chapter.interactor.SyncChaptersWithSource import eu.kanade.domain.chapter.interactor.SyncChaptersWithTrackServiceTwoWay -import eu.kanade.domain.chapter.model.Chapter import eu.kanade.domain.download.service.DownloadPreferences import eu.kanade.domain.library.model.LibraryManga import eu.kanade.domain.library.service.LibraryPreferences import eu.kanade.domain.manga.interactor.GetLibraryManga import eu.kanade.domain.manga.interactor.GetManga import eu.kanade.domain.manga.interactor.UpdateManga -import eu.kanade.domain.manga.model.Manga -import eu.kanade.domain.manga.model.toMangaUpdate +import eu.kanade.domain.manga.model.copyFrom +import eu.kanade.domain.manga.model.toSManga import eu.kanade.domain.track.interactor.GetTracks import eu.kanade.domain.track.interactor.InsertTrack import eu.kanade.domain.track.model.toDbTrack @@ -65,6 +64,9 @@ import kotlinx.coroutines.sync.Semaphore import kotlinx.coroutines.sync.withPermit import logcat.LogPriority import tachiyomi.domain.category.model.Category +import tachiyomi.domain.chapter.model.Chapter +import tachiyomi.domain.manga.model.Manga +import tachiyomi.domain.manga.model.toMangaUpdate import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get import java.io.File diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/notification/NotificationReceiver.kt b/app/src/main/java/eu/kanade/tachiyomi/data/notification/NotificationReceiver.kt index 70873a0f1..eefabb2d4 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/notification/NotificationReceiver.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/notification/NotificationReceiver.kt @@ -10,11 +10,8 @@ import androidx.core.content.ContextCompat import androidx.core.net.toUri import eu.kanade.domain.chapter.interactor.GetChapter import eu.kanade.domain.chapter.interactor.UpdateChapter -import eu.kanade.domain.chapter.model.Chapter -import eu.kanade.domain.chapter.model.toChapterUpdate import eu.kanade.domain.download.service.DownloadPreferences import eu.kanade.domain.manga.interactor.GetManga -import eu.kanade.domain.manga.model.Manga import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.backup.BackupRestoreService import eu.kanade.tachiyomi.data.download.DownloadManager @@ -33,6 +30,9 @@ import eu.kanade.tachiyomi.util.system.notificationManager import eu.kanade.tachiyomi.util.system.toShareIntent import eu.kanade.tachiyomi.util.system.toast import kotlinx.coroutines.runBlocking +import tachiyomi.domain.chapter.model.Chapter +import tachiyomi.domain.chapter.model.toChapterUpdate +import tachiyomi.domain.manga.model.Manga import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get import uy.kohesive.injekt.injectLazy diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/EnhancedTrackService.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/EnhancedTrackService.kt index 1331d45f5..f49fcc530 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/EnhancedTrackService.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/EnhancedTrackService.kt @@ -1,9 +1,9 @@ package eu.kanade.tachiyomi.data.track -import eu.kanade.domain.manga.model.Manga import eu.kanade.domain.track.model.Track import eu.kanade.tachiyomi.data.track.model.TrackSearch import eu.kanade.tachiyomi.source.Source +import tachiyomi.domain.manga.model.Manga /** * An Enhanced Track Service will never prompt the user to match a manga with the remote. diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/kavita/Kavita.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/kavita/Kavita.kt index c381ad2c4..1e029c2b1 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/kavita/Kavita.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/kavita/Kavita.kt @@ -4,13 +4,13 @@ import android.content.Context import android.content.SharedPreferences import android.graphics.Color import androidx.annotation.StringRes -import eu.kanade.domain.manga.model.Manga import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.database.models.Track import eu.kanade.tachiyomi.data.track.EnhancedTrackService import eu.kanade.tachiyomi.data.track.TrackService import eu.kanade.tachiyomi.data.track.model.TrackSearch import eu.kanade.tachiyomi.source.Source +import tachiyomi.domain.manga.model.Manga import java.security.MessageDigest import eu.kanade.domain.track.model.Track as DomainTrack diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/komga/Komga.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/komga/Komga.kt index c2a30d2ee..c9ca49065 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/komga/Komga.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/komga/Komga.kt @@ -3,7 +3,6 @@ package eu.kanade.tachiyomi.data.track.komga import android.content.Context import android.graphics.Color import androidx.annotation.StringRes -import eu.kanade.domain.manga.model.Manga import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.database.models.Track import eu.kanade.tachiyomi.data.track.EnhancedTrackService @@ -12,6 +11,7 @@ import eu.kanade.tachiyomi.data.track.model.TrackSearch import eu.kanade.tachiyomi.source.Source import okhttp3.Dns import okhttp3.OkHttpClient +import tachiyomi.domain.manga.model.Manga import eu.kanade.domain.track.model.Track as DomainTrack class Komga(private val context: Context, id: Long) : TrackService(id), EnhancedTrackService { diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/suwayomi/Suwayomi.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/suwayomi/Suwayomi.kt index 00606b658..bbc9407f4 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/suwayomi/Suwayomi.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/suwayomi/Suwayomi.kt @@ -9,8 +9,8 @@ import eu.kanade.tachiyomi.data.track.EnhancedTrackService import eu.kanade.tachiyomi.data.track.TrackService import eu.kanade.tachiyomi.data.track.model.TrackSearch import eu.kanade.tachiyomi.source.Source -import eu.kanade.domain.manga.model.Manga as DomainManga import eu.kanade.domain.track.model.Track as DomainTrack +import tachiyomi.domain.manga.model.Manga as DomainManga class Suwayomi(private val context: Context, id: Long) : TrackService(id), EnhancedTrackService { val api by lazy { TachideskApi() } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/MigrationFlags.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/MigrationFlags.kt index 21b01f10d..9890a7b38 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/MigrationFlags.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/MigrationFlags.kt @@ -1,11 +1,11 @@ package eu.kanade.tachiyomi.ui.browse.migration -import eu.kanade.domain.manga.model.Manga import eu.kanade.domain.manga.model.hasCustomCover import eu.kanade.domain.track.interactor.GetTracks import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.cache.CoverCache import kotlinx.coroutines.runBlocking +import tachiyomi.domain.manga.model.Manga import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get import uy.kohesive.injekt.injectLazy diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/manga/MigrationMangaScreenModel.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/manga/MigrationMangaScreenModel.kt index 116645a42..7f473c1d0 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/manga/MigrationMangaScreenModel.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/manga/MigrationMangaScreenModel.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.domain.manga.interactor.GetFavorites -import eu.kanade.domain.manga.model.Manga import eu.kanade.tachiyomi.source.Source import eu.kanade.tachiyomi.source.SourceManager import eu.kanade.tachiyomi.util.system.logcat @@ -17,6 +16,7 @@ import kotlinx.coroutines.flow.receiveAsFlow import kotlinx.coroutines.flow.update import kotlinx.coroutines.launch import logcat.LogPriority +import tachiyomi.domain.manga.model.Manga import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/MigrateDialog.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/MigrateDialog.kt index 25b13cb8e..ae5a5e484 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/MigrateDialog.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/MigrateDialog.kt @@ -30,10 +30,9 @@ import eu.kanade.domain.category.interactor.SetMangaCategories import eu.kanade.domain.chapter.interactor.GetChapterByMangaId import eu.kanade.domain.chapter.interactor.SyncChaptersWithSource import eu.kanade.domain.chapter.interactor.UpdateChapter -import eu.kanade.domain.chapter.model.toChapterUpdate import eu.kanade.domain.manga.interactor.UpdateManga -import eu.kanade.domain.manga.model.Manga import eu.kanade.domain.manga.model.hasCustomCover +import eu.kanade.domain.manga.model.toSManga import eu.kanade.domain.track.interactor.GetTracks import eu.kanade.domain.track.interactor.InsertTrack import eu.kanade.presentation.components.LoadingScreen @@ -50,6 +49,8 @@ import eu.kanade.tachiyomi.ui.browse.migration.MigrationFlags import eu.kanade.tachiyomi.util.lang.launchIO import eu.kanade.tachiyomi.util.lang.withUIContext import kotlinx.coroutines.flow.update +import tachiyomi.domain.chapter.model.toChapterUpdate +import tachiyomi.domain.manga.model.Manga import tachiyomi.domain.manga.model.MangaUpdate import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/MigrateSearchScreenModel.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/MigrateSearchScreenModel.kt index c9339c5a3..94a55b740 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/MigrateSearchScreenModel.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/MigrateSearchScreenModel.kt @@ -4,7 +4,6 @@ import androidx.compose.runtime.Immutable import cafe.adriel.voyager.core.model.coroutineScope import eu.kanade.domain.base.BasePreferences import eu.kanade.domain.manga.interactor.GetManga -import eu.kanade.domain.manga.model.Manga import eu.kanade.domain.source.service.SourcePreferences import eu.kanade.tachiyomi.source.CatalogueSource import eu.kanade.tachiyomi.source.SourceManager @@ -12,6 +11,7 @@ import eu.kanade.tachiyomi.ui.browse.source.globalsearch.SearchItemResult import eu.kanade.tachiyomi.ui.browse.source.globalsearch.SearchScreenModel import kotlinx.coroutines.flow.update import kotlinx.coroutines.launch +import tachiyomi.domain.manga.model.Manga import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/SourceSearchScreen.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/SourceSearchScreen.kt index eeeef1d53..a899e0bcb 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/SourceSearchScreen.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/SourceSearchScreen.kt @@ -22,7 +22,6 @@ import cafe.adriel.voyager.core.model.rememberScreenModel import cafe.adriel.voyager.core.screen.Screen import cafe.adriel.voyager.navigator.LocalNavigator import cafe.adriel.voyager.navigator.currentOrThrow -import eu.kanade.domain.manga.model.Manga import eu.kanade.presentation.browse.BrowseSourceContent import eu.kanade.presentation.components.ExtendedFloatingActionButton import eu.kanade.presentation.components.Scaffold @@ -36,6 +35,7 @@ import eu.kanade.tachiyomi.ui.manga.MangaScreen import eu.kanade.tachiyomi.ui.webview.WebViewScreen import eu.kanade.tachiyomi.util.Constants import kotlinx.coroutines.launch +import tachiyomi.domain.manga.model.Manga data class SourceSearchScreen( private val oldManga: Manga, 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 55ca4b9d7..92c515737 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 @@ -27,9 +27,9 @@ import eu.kanade.domain.manga.interactor.GetDuplicateLibraryManga import eu.kanade.domain.manga.interactor.GetManga import eu.kanade.domain.manga.interactor.NetworkToLocalManga import eu.kanade.domain.manga.interactor.UpdateManga -import eu.kanade.domain.manga.model.Manga +import eu.kanade.domain.manga.model.copyFrom import eu.kanade.domain.manga.model.toDomainManga -import eu.kanade.domain.manga.model.toMangaUpdate +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.interactor.InsertTrack @@ -71,6 +71,8 @@ import kotlinx.coroutines.flow.update import kotlinx.coroutines.launch import logcat.LogPriority import tachiyomi.domain.category.model.Category +import tachiyomi.domain.manga.model.Manga +import tachiyomi.domain.manga.model.toMangaUpdate import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get import java.util.Date diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/globalsearch/SearchScreenModel.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/globalsearch/SearchScreenModel.kt index 8304092f7..c91e6599f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/globalsearch/SearchScreenModel.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/globalsearch/SearchScreenModel.kt @@ -8,9 +8,9 @@ import cafe.adriel.voyager.core.model.coroutineScope import eu.kanade.domain.manga.interactor.GetManga import eu.kanade.domain.manga.interactor.NetworkToLocalManga import eu.kanade.domain.manga.interactor.UpdateManga -import eu.kanade.domain.manga.model.Manga +import eu.kanade.domain.manga.model.copyFrom import eu.kanade.domain.manga.model.toDomainManga -import eu.kanade.domain.manga.model.toMangaUpdate +import eu.kanade.domain.manga.model.toSManga import eu.kanade.domain.source.service.SourcePreferences import eu.kanade.tachiyomi.extension.ExtensionManager import eu.kanade.tachiyomi.source.CatalogueSource @@ -25,6 +25,8 @@ import kotlinx.coroutines.flow.collectLatest import kotlinx.coroutines.launch import kotlinx.coroutines.withContext import logcat.LogPriority +import tachiyomi.domain.manga.model.Manga +import tachiyomi.domain.manga.model.toMangaUpdate import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get import java.util.concurrent.Executors 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 94d9dd8df..f2ddb2610 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.chapter.model.Chapter import eu.kanade.domain.history.interactor.GetHistory import eu.kanade.domain.history.interactor.GetNextChapters import eu.kanade.domain.history.interactor.RemoveHistory @@ -25,6 +24,7 @@ import kotlinx.coroutines.flow.receiveAsFlow import kotlinx.coroutines.flow.update import kotlinx.coroutines.launch import logcat.LogPriority +import tachiyomi.domain.chapter.model.Chapter import tachiyomi.domain.history.model.HistoryWithRelations import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/history/HistoryTab.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/history/HistoryTab.kt index 2c1129548..a6a08ff8c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/history/HistoryTab.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/history/HistoryTab.kt @@ -17,7 +17,6 @@ import cafe.adriel.voyager.navigator.Navigator import cafe.adriel.voyager.navigator.currentOrThrow import cafe.adriel.voyager.navigator.tab.LocalTabNavigator import cafe.adriel.voyager.navigator.tab.TabOptions -import eu.kanade.domain.chapter.model.Chapter import eu.kanade.presentation.history.HistoryScreen import eu.kanade.presentation.history.components.HistoryDeleteAllDialog import eu.kanade.presentation.history.components.HistoryDeleteDialog @@ -29,6 +28,7 @@ import eu.kanade.tachiyomi.ui.reader.ReaderActivity import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.flow.collectLatest import kotlinx.coroutines.flow.receiveAsFlow +import tachiyomi.domain.chapter.model.Chapter object HistoryTab : Tab { 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 04130a46b..356008b74 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 @@ -20,13 +20,11 @@ import eu.kanade.domain.category.interactor.GetCategories import eu.kanade.domain.category.interactor.SetMangaCategories import eu.kanade.domain.chapter.interactor.GetChapterByMangaId import eu.kanade.domain.chapter.interactor.SetReadStatus -import eu.kanade.domain.chapter.model.Chapter import eu.kanade.domain.history.interactor.GetNextChapters import eu.kanade.domain.library.model.LibraryManga import eu.kanade.domain.library.service.LibraryPreferences import eu.kanade.domain.manga.interactor.GetLibraryManga import eu.kanade.domain.manga.interactor.UpdateManga -import eu.kanade.domain.manga.model.Manga import eu.kanade.domain.manga.model.isLocal import eu.kanade.domain.track.interactor.GetTracksPerManga import eu.kanade.presentation.library.components.LibraryToolbarTitle @@ -55,8 +53,10 @@ import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.update import tachiyomi.domain.category.model.Category +import tachiyomi.domain.chapter.model.Chapter import tachiyomi.domain.library.model.LibrarySort import tachiyomi.domain.library.model.sort +import tachiyomi.domain.manga.model.Manga import tachiyomi.domain.manga.model.MangaUpdate import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryTab.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryTab.kt index e3f10a0c2..45f0d4a50 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryTab.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryTab.kt @@ -29,7 +29,6 @@ import cafe.adriel.voyager.navigator.currentOrThrow import cafe.adriel.voyager.navigator.tab.LocalTabNavigator import cafe.adriel.voyager.navigator.tab.TabOptions import eu.kanade.domain.library.model.LibraryManga -import eu.kanade.domain.manga.model.Manga import eu.kanade.domain.manga.model.isLocal import eu.kanade.presentation.components.ChangeCategoryDialog import eu.kanade.presentation.components.DeleteLibraryMangaDialog @@ -57,6 +56,7 @@ import kotlinx.coroutines.flow.receiveAsFlow import kotlinx.coroutines.launch import tachiyomi.domain.category.model.Category import tachiyomi.domain.library.model.display +import tachiyomi.domain.manga.model.Manga object LibraryTab : Tab { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaCoverScreenModel.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaCoverScreenModel.kt index f14d72116..c50ba7d38 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaCoverScreenModel.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaCoverScreenModel.kt @@ -11,7 +11,6 @@ import coil.request.ImageRequest import coil.size.Size import eu.kanade.domain.manga.interactor.GetManga import eu.kanade.domain.manga.interactor.UpdateManga -import eu.kanade.domain.manga.model.Manga import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.cache.CoverCache import eu.kanade.tachiyomi.data.saver.Image @@ -26,6 +25,7 @@ import eu.kanade.tachiyomi.util.system.toShareIntent import kotlinx.coroutines.flow.update import kotlinx.coroutines.launch import logcat.LogPriority +import tachiyomi.domain.manga.model.Manga import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreen.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreen.kt index 374e0cb52..ca0654291 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreen.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreen.kt @@ -22,9 +22,8 @@ import cafe.adriel.voyager.core.screen.uniqueScreenKey import cafe.adriel.voyager.navigator.LocalNavigator import cafe.adriel.voyager.navigator.Navigator import cafe.adriel.voyager.navigator.currentOrThrow -import eu.kanade.domain.chapter.model.Chapter -import eu.kanade.domain.manga.model.Manga import eu.kanade.domain.manga.model.hasCustomCover +import eu.kanade.domain.manga.model.toSManga import eu.kanade.presentation.components.ChangeCategoryDialog import eu.kanade.presentation.components.DuplicateMangaDialog import eu.kanade.presentation.components.LoadingScreen @@ -56,6 +55,8 @@ import eu.kanade.tachiyomi.util.system.toShareIntent import eu.kanade.tachiyomi.util.system.toast import kotlinx.coroutines.launch import logcat.LogPriority +import tachiyomi.domain.chapter.model.Chapter +import tachiyomi.domain.manga.model.Manga class MangaScreen( private val mangaId: Long, 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 2016d703a..c2765471d 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 @@ -19,17 +19,15 @@ 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.UpdateChapter -import eu.kanade.domain.chapter.model.Chapter -import eu.kanade.domain.chapter.model.ChapterUpdate import eu.kanade.domain.download.service.DownloadPreferences import eu.kanade.domain.library.service.LibraryPreferences import eu.kanade.domain.manga.interactor.GetDuplicateLibraryManga import eu.kanade.domain.manga.interactor.GetMangaWithChapters import eu.kanade.domain.manga.interactor.SetMangaChapterFlags import eu.kanade.domain.manga.interactor.UpdateManga -import eu.kanade.domain.manga.model.Manga -import eu.kanade.domain.manga.model.TriStateFilter +import eu.kanade.domain.manga.model.downloadedFilter import eu.kanade.domain.manga.model.isLocal +import eu.kanade.domain.manga.model.toSManga import eu.kanade.domain.track.interactor.GetTracks import eu.kanade.domain.track.model.toDbTrack import eu.kanade.domain.ui.UiPreferences @@ -70,6 +68,10 @@ import kotlinx.coroutines.isActive import kotlinx.coroutines.launch import logcat.LogPriority import tachiyomi.domain.category.model.Category +import tachiyomi.domain.chapter.model.Chapter +import tachiyomi.domain.chapter.model.ChapterUpdate +import tachiyomi.domain.manga.model.Manga +import tachiyomi.domain.manga.model.TriStateFilter import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get import java.text.DecimalFormat diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt index 3001575e5..4667d5498 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt @@ -45,7 +45,7 @@ import com.google.android.material.slider.Slider import com.google.android.material.transition.platform.MaterialContainerTransform import dev.chrisbanes.insetter.applyInsetter import eu.kanade.domain.base.BasePreferences -import eu.kanade.domain.manga.model.Manga +import eu.kanade.domain.manga.model.orientationType import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.notification.NotificationReceiver import eu.kanade.tachiyomi.data.notification.Notifications @@ -94,6 +94,7 @@ import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.sample import kotlinx.coroutines.launch import logcat.LogPriority +import tachiyomi.domain.manga.model.Manga import uy.kohesive.injekt.injectLazy import kotlin.math.abs import kotlin.math.max 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 3b97c9d88..01f1af3cd 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 @@ -9,15 +9,15 @@ import androidx.lifecycle.viewModelScope import eu.kanade.domain.base.BasePreferences import eu.kanade.domain.chapter.interactor.GetChapterByMangaId import eu.kanade.domain.chapter.interactor.UpdateChapter -import eu.kanade.domain.chapter.model.ChapterUpdate import eu.kanade.domain.chapter.model.toDbChapter import eu.kanade.domain.download.service.DownloadPreferences import eu.kanade.domain.history.interactor.GetNextChapters import eu.kanade.domain.history.interactor.UpsertHistory import eu.kanade.domain.manga.interactor.GetManga import eu.kanade.domain.manga.interactor.SetMangaViewerFlags -import eu.kanade.domain.manga.model.Manga import eu.kanade.domain.manga.model.isLocal +import eu.kanade.domain.manga.model.orientationType +import eu.kanade.domain.manga.model.readingModeType import eu.kanade.domain.track.interactor.GetTracks import eu.kanade.domain.track.interactor.InsertTrack import eu.kanade.domain.track.model.toDbTrack @@ -75,7 +75,9 @@ import kotlinx.coroutines.flow.update import kotlinx.coroutines.launch import kotlinx.coroutines.runBlocking import logcat.LogPriority +import tachiyomi.domain.chapter.model.ChapterUpdate import tachiyomi.domain.history.model.HistoryUpdate +import tachiyomi.domain.manga.model.Manga import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get import java.util.Date diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/ChapterLoader.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/ChapterLoader.kt index 9617032d9..c5d702873 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/ChapterLoader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/ChapterLoader.kt @@ -2,7 +2,6 @@ package eu.kanade.tachiyomi.ui.reader.loader import android.content.Context import com.github.junrar.exception.UnsupportedRarV5Exception -import eu.kanade.domain.manga.model.Manga import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.download.DownloadManager import eu.kanade.tachiyomi.data.download.DownloadProvider @@ -13,6 +12,7 @@ import eu.kanade.tachiyomi.source.online.HttpSource import eu.kanade.tachiyomi.ui.reader.model.ReaderChapter import eu.kanade.tachiyomi.util.lang.withIOContext import eu.kanade.tachiyomi.util.system.logcat +import tachiyomi.domain.manga.model.Manga /** * Loader used to retrieve the [PageLoader] for a given chapter. diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/DownloadPageLoader.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/DownloadPageLoader.kt index ba03a3a5a..684c5f6f7 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/DownloadPageLoader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/DownloadPageLoader.kt @@ -3,7 +3,6 @@ package eu.kanade.tachiyomi.ui.reader.loader import android.app.Application import android.net.Uri import com.hippo.unifile.UniFile -import eu.kanade.domain.manga.model.Manga import eu.kanade.tachiyomi.data.database.models.toDomainChapter import eu.kanade.tachiyomi.data.download.DownloadManager import eu.kanade.tachiyomi.data.download.DownloadProvider @@ -12,6 +11,7 @@ import eu.kanade.tachiyomi.source.model.Page import eu.kanade.tachiyomi.ui.reader.model.ReaderChapter import eu.kanade.tachiyomi.ui.reader.model.ReaderPage import rx.Observable +import tachiyomi.domain.manga.model.Manga import uy.kohesive.injekt.injectLazy import java.io.File diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/setting/ReaderReadingModeSettings.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/setting/ReaderReadingModeSettings.kt index 8ab184dea..3cfd03aa9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/setting/ReaderReadingModeSettings.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/setting/ReaderReadingModeSettings.kt @@ -6,6 +6,8 @@ import android.view.LayoutInflater import androidx.core.view.isVisible import androidx.core.widget.NestedScrollView import androidx.lifecycle.lifecycleScope +import eu.kanade.domain.manga.model.orientationType +import eu.kanade.domain.manga.model.readingModeType import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.preference.PreferenceValues import eu.kanade.tachiyomi.databinding.ReaderReadingModeSettingsBinding diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/MissingChapters.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/MissingChapters.kt index 6dd9d4c39..d39a63a80 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/MissingChapters.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/MissingChapters.kt @@ -1,8 +1,8 @@ package eu.kanade.tachiyomi.ui.reader.viewer -import eu.kanade.domain.chapter.model.Chapter import eu.kanade.tachiyomi.data.database.models.toDomainChapter import eu.kanade.tachiyomi.ui.reader.model.ReaderChapter +import tachiyomi.domain.chapter.model.Chapter import kotlin.math.floor private val pattern = Regex("""\d+""") diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/ReaderTransitionView.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/ReaderTransitionView.kt index c7a49cc8e..feea51002 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/ReaderTransitionView.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/ReaderTransitionView.kt @@ -11,13 +11,13 @@ import androidx.core.text.bold import androidx.core.text.buildSpannedString import androidx.core.text.inSpans import androidx.core.view.isVisible -import eu.kanade.domain.manga.model.Manga import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.download.DownloadManager import eu.kanade.tachiyomi.databinding.ReaderTransitionViewBinding import eu.kanade.tachiyomi.ui.reader.loader.DownloadPageLoader import eu.kanade.tachiyomi.ui.reader.model.ChapterTransition import eu.kanade.tachiyomi.util.system.dpToPx +import tachiyomi.domain.manga.model.Manga import kotlin.math.roundToInt class ReaderTransitionView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : 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 5bd2c9990..a35cc0c91 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 @@ -14,7 +14,6 @@ import eu.kanade.core.util.insertSeparators import eu.kanade.domain.chapter.interactor.GetChapter import eu.kanade.domain.chapter.interactor.SetReadStatus import eu.kanade.domain.chapter.interactor.UpdateChapter -import eu.kanade.domain.chapter.model.ChapterUpdate import eu.kanade.domain.library.service.LibraryPreferences import eu.kanade.domain.manga.interactor.GetManga import eu.kanade.domain.ui.UiPreferences @@ -43,6 +42,7 @@ import kotlinx.coroutines.flow.receiveAsFlow import kotlinx.coroutines.flow.update import kotlinx.coroutines.launch import logcat.LogPriority +import tachiyomi.domain.chapter.model.ChapterUpdate import tachiyomi.domain.updates.model.UpdatesWithRelations import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/MangaExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/util/MangaExtensions.kt index f8b0b6e9a..0d73d2bbe 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/MangaExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/MangaExtensions.kt @@ -3,12 +3,13 @@ package eu.kanade.tachiyomi.util import android.content.Context import eu.kanade.domain.download.service.DownloadPreferences import eu.kanade.domain.manga.interactor.UpdateManga -import eu.kanade.domain.manga.model.Manga import eu.kanade.domain.manga.model.hasCustomCover import eu.kanade.domain.manga.model.isLocal +import eu.kanade.domain.manga.model.toSManga import eu.kanade.tachiyomi.data.cache.CoverCache import eu.kanade.tachiyomi.source.LocalSource import eu.kanade.tachiyomi.source.model.SManga +import tachiyomi.domain.manga.model.Manga import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get import java.io.InputStream diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/chapter/ChapterGetNextUnread.kt b/app/src/main/java/eu/kanade/tachiyomi/util/chapter/ChapterGetNextUnread.kt index 296c7e6d4..418220a46 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/chapter/ChapterGetNextUnread.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/chapter/ChapterGetNextUnread.kt @@ -1,10 +1,10 @@ package eu.kanade.tachiyomi.util.chapter -import eu.kanade.domain.chapter.model.Chapter import eu.kanade.domain.chapter.model.applyFilters -import eu.kanade.domain.manga.model.Manga import eu.kanade.tachiyomi.data.download.DownloadManager import eu.kanade.tachiyomi.ui.manga.ChapterItem +import tachiyomi.domain.chapter.model.Chapter +import tachiyomi.domain.manga.model.Manga /** * Gets next unread chapter with filters and sorting applied diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/chapter/ChapterSorter.kt b/app/src/main/java/eu/kanade/tachiyomi/util/chapter/ChapterSorter.kt index 43c4e949d..165ac43b4 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/chapter/ChapterSorter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/chapter/ChapterSorter.kt @@ -1,7 +1,7 @@ package eu.kanade.tachiyomi.util.chapter -import eu.kanade.domain.chapter.model.Chapter -import eu.kanade.domain.manga.model.Manga +import tachiyomi.domain.chapter.model.Chapter +import tachiyomi.domain.manga.model.Manga fun getChapterSort(manga: Manga, sortDescending: Boolean = manga.sortDescending()): (Chapter, Chapter) -> Int { return when (manga.sorting) { diff --git a/domain/src/main/java/tachiyomi/domain/chapter/model/Chapter.kt b/domain/src/main/java/tachiyomi/domain/chapter/model/Chapter.kt new file mode 100644 index 000000000..e11ca6564 --- /dev/null +++ b/domain/src/main/java/tachiyomi/domain/chapter/model/Chapter.kt @@ -0,0 +1,36 @@ +package tachiyomi.domain.chapter.model + +data class Chapter( + val id: Long, + val mangaId: Long, + val read: Boolean, + val bookmark: Boolean, + val lastPageRead: Long, + val dateFetch: Long, + val sourceOrder: Long, + val url: String, + val name: String, + val dateUpload: Long, + val chapterNumber: Float, + val scanlator: String?, +) { + val isRecognizedNumber: Boolean + get() = chapterNumber >= 0f + + companion object { + fun create() = Chapter( + id = -1, + mangaId = -1, + read = false, + bookmark = false, + lastPageRead = 0, + dateFetch = 0, + sourceOrder = 0, + url = "", + name = "", + dateUpload = -1, + chapterNumber = -1f, + scanlator = null, + ) + } +} diff --git a/app/src/main/java/eu/kanade/domain/chapter/model/ChapterUpdate.kt b/domain/src/main/java/tachiyomi/domain/chapter/model/ChapterUpdate.kt similarity index 93% rename from app/src/main/java/eu/kanade/domain/chapter/model/ChapterUpdate.kt rename to domain/src/main/java/tachiyomi/domain/chapter/model/ChapterUpdate.kt index 8e073f358..7cfe4ab23 100644 --- a/app/src/main/java/eu/kanade/domain/chapter/model/ChapterUpdate.kt +++ b/domain/src/main/java/tachiyomi/domain/chapter/model/ChapterUpdate.kt @@ -1,4 +1,4 @@ -package eu.kanade.domain.chapter.model +package tachiyomi.domain.chapter.model data class ChapterUpdate( val id: Long, diff --git a/domain/src/main/java/tachiyomi/domain/manga/model/Manga.kt b/domain/src/main/java/tachiyomi/domain/manga/model/Manga.kt new file mode 100644 index 000000000..c92dbdbe3 --- /dev/null +++ b/domain/src/main/java/tachiyomi/domain/manga/model/Manga.kt @@ -0,0 +1,110 @@ +package tachiyomi.domain.manga.model + +import eu.kanade.tachiyomi.source.model.UpdateStrategy +import java.io.Serializable + +data class Manga( + val id: Long, + val source: Long, + val favorite: Boolean, + val lastUpdate: Long, + val dateAdded: Long, + val viewerFlags: Long, + val chapterFlags: Long, + val coverLastModified: Long, + val url: String, + val title: String, + val artist: String?, + val author: String?, + val description: String?, + val genre: List?, + val status: Long, + val thumbnailUrl: String?, + val updateStrategy: UpdateStrategy, + val initialized: Boolean, +) : Serializable { + + val sorting: Long + get() = chapterFlags and CHAPTER_SORTING_MASK + + val displayMode: Long + get() = chapterFlags and CHAPTER_DISPLAY_MASK + + val unreadFilterRaw: Long + get() = chapterFlags and CHAPTER_UNREAD_MASK + + val downloadedFilterRaw: Long + get() = chapterFlags and CHAPTER_DOWNLOADED_MASK + + val bookmarkedFilterRaw: Long + get() = chapterFlags and CHAPTER_BOOKMARKED_MASK + + val unreadFilter: TriStateFilter + get() = when (unreadFilterRaw) { + CHAPTER_SHOW_UNREAD -> TriStateFilter.ENABLED_IS + CHAPTER_SHOW_READ -> TriStateFilter.ENABLED_NOT + else -> TriStateFilter.DISABLED + } + + val bookmarkedFilter: TriStateFilter + get() = when (bookmarkedFilterRaw) { + CHAPTER_SHOW_BOOKMARKED -> TriStateFilter.ENABLED_IS + CHAPTER_SHOW_NOT_BOOKMARKED -> TriStateFilter.ENABLED_NOT + else -> TriStateFilter.DISABLED + } + + fun sortDescending(): Boolean { + return chapterFlags and CHAPTER_SORT_DIR_MASK == CHAPTER_SORT_DESC + } + + companion object { + // Generic filter that does not filter anything + const val SHOW_ALL = 0x00000000L + + const val CHAPTER_SORT_DESC = 0x00000000L + const val CHAPTER_SORT_ASC = 0x00000001L + const val CHAPTER_SORT_DIR_MASK = 0x00000001L + + const val CHAPTER_SHOW_UNREAD = 0x00000002L + const val CHAPTER_SHOW_READ = 0x00000004L + const val CHAPTER_UNREAD_MASK = 0x00000006L + + const val CHAPTER_SHOW_DOWNLOADED = 0x00000008L + const val CHAPTER_SHOW_NOT_DOWNLOADED = 0x00000010L + const val CHAPTER_DOWNLOADED_MASK = 0x00000018L + + const val CHAPTER_SHOW_BOOKMARKED = 0x00000020L + const val CHAPTER_SHOW_NOT_BOOKMARKED = 0x00000040L + const val CHAPTER_BOOKMARKED_MASK = 0x00000060L + + const val CHAPTER_SORTING_SOURCE = 0x00000000L + const val CHAPTER_SORTING_NUMBER = 0x00000100L + const val CHAPTER_SORTING_UPLOAD_DATE = 0x00000200L + const val CHAPTER_SORTING_MASK = 0x00000300L + + const val CHAPTER_DISPLAY_NAME = 0x00000000L + const val CHAPTER_DISPLAY_NUMBER = 0x00100000L + const val CHAPTER_DISPLAY_MASK = 0x00100000L + + fun create() = Manga( + id = -1L, + url = "", + title = "", + source = -1L, + favorite = false, + lastUpdate = 0L, + dateAdded = 0L, + viewerFlags = 0L, + chapterFlags = 0L, + coverLastModified = 0L, + artist = null, + author = null, + description = null, + genre = null, + status = 0L, + thumbnailUrl = null, + updateStrategy = UpdateStrategy.ALWAYS_UPDATE, + initialized = false, + ) + } +} diff --git a/domain/src/main/java/tachiyomi/domain/manga/model/MangaCover.kt b/domain/src/main/java/tachiyomi/domain/manga/model/MangaCover.kt index fab5572f3..d2ca3b103 100644 --- a/domain/src/main/java/tachiyomi/domain/manga/model/MangaCover.kt +++ b/domain/src/main/java/tachiyomi/domain/manga/model/MangaCover.kt @@ -10,3 +10,13 @@ data class MangaCover( val url: String?, val lastModified: Long, ) + +fun Manga.asMangaCover(): MangaCover { + return MangaCover( + mangaId = id, + sourceId = source, + isMangaFavorite = favorite, + url = thumbnailUrl, + lastModified = coverLastModified, + ) +} diff --git a/domain/src/main/java/tachiyomi/domain/manga/model/MangaUpdate.kt b/domain/src/main/java/tachiyomi/domain/manga/model/MangaUpdate.kt index 1abf0c028..28fda84fc 100644 --- a/domain/src/main/java/tachiyomi/domain/manga/model/MangaUpdate.kt +++ b/domain/src/main/java/tachiyomi/domain/manga/model/MangaUpdate.kt @@ -22,3 +22,26 @@ data class MangaUpdate( val updateStrategy: UpdateStrategy? = null, val initialized: Boolean? = null, ) + +fun Manga.toMangaUpdate(): MangaUpdate { + return MangaUpdate( + id = id, + source = source, + favorite = favorite, + lastUpdate = lastUpdate, + dateAdded = dateAdded, + viewerFlags = viewerFlags, + chapterFlags = chapterFlags, + coverLastModified = coverLastModified, + url = url, + title = title, + artist = artist, + author = author, + description = description, + genre = genre, + status = status, + thumbnailUrl = thumbnailUrl, + updateStrategy = updateStrategy, + initialized = initialized, + ) +} diff --git a/domain/src/main/java/tachiyomi/domain/manga/model/TriStateFilter.kt b/domain/src/main/java/tachiyomi/domain/manga/model/TriStateFilter.kt new file mode 100644 index 000000000..b890cafad --- /dev/null +++ b/domain/src/main/java/tachiyomi/domain/manga/model/TriStateFilter.kt @@ -0,0 +1,7 @@ +package tachiyomi.domain.manga.model + +enum class TriStateFilter { + DISABLED, // Disable filter + ENABLED_IS, // Enabled with "is" filter + ENABLED_NOT, // Enabled with "not" filter +}