From 1c6a18b14a1bf15a8d370e9df9ff7692d5968956 Mon Sep 17 00:00:00 2001 From: LuftVerbot <97435834+LuftVerbot@users.noreply.github.com> Date: Wed, 14 Jun 2023 13:32:21 +0200 Subject: [PATCH] merge30 Last Commit Merged: https://github.com/tachiyomiorg/tachiyomi/commit/ad4912803bda73e0f1d5e2e0246561a508e72fd7 --- .../data/source/anime/AnimeSourceMapper.kt | 24 ------- .../source/anime/AnimeSourceRepositoryImpl.kt | 29 ++++++-- .../data/source/manga/MangaSourceMapper.kt | 24 ------- .../source/manga/MangaSourceRepositoryImpl.kt | 29 ++++++-- .../anime/interactor/DeleteEpisodeDownload.kt | 2 +- .../manga/interactor/DeleteChapterDownload.kt | 2 +- .../items/chapter/interactor/SetReadStatus.kt | 2 +- .../items/episode/interactor/SetSeenStatus.kt | 2 +- .../GetAnimeSourcesWithFavoriteCount.kt | 5 +- .../GetMangaSourcesWithFavoriteCount.kt | 5 +- .../browse/anime/BrowseAnimeSourceScreen.kt | 7 +- .../browse/manga/BrowseMangaSourceScreen.kt | 7 +- .../components/ItemDownloadIndicator.kt | 2 +- .../presentation/entries/anime/AnimeScreen.kt | 6 +- .../anime/EpisodeOptionsDialogScreen.kt | 2 +- .../presentation/entries/manga/MangaScreen.kt | 6 +- .../settings/screen/SettingsBackupScreen.kt | 2 +- .../settings/screen/SettingsDownloadScreen.kt | 2 +- .../settings/screen/SettingsTrackingScreen.kt | 2 +- .../java/eu/kanade/tachiyomi/AppModule.kt | 14 ++-- .../java/eu/kanade/tachiyomi/Migrations.kt | 2 +- .../tachiyomi/data/backup/BackupCreatorJob.kt | 2 +- .../data/backup/BackupFileValidator.kt | 4 +- .../tachiyomi/data/backup/BackupManager.kt | 6 +- .../tachiyomi/data/coil/AnimeCoverFetcher.kt | 2 +- .../tachiyomi/data/coil/MangaCoverFetcher.kt | 2 +- .../data/download/anime/AnimeDownloadCache.kt | 4 +- .../download/anime/AnimeDownloadManager.kt | 4 +- .../download/anime/AnimeDownloadProvider.kt | 2 +- .../download/anime/AnimeDownloadService.kt | 2 +- .../data/download/anime/AnimeDownloadStore.kt | 2 +- .../data/download/anime/AnimeDownloader.kt | 4 +- .../download/anime/model/AnimeDownload.kt | 2 +- .../data/download/manga/MangaDownloadCache.kt | 4 +- .../download/manga/MangaDownloadManager.kt | 4 +- .../download/manga/MangaDownloadProvider.kt | 2 +- .../download/manga/MangaDownloadService.kt | 2 +- .../data/download/manga/MangaDownloadStore.kt | 2 +- .../data/download/manga/MangaDownloader.kt | 4 +- .../download/manga/model/MangaDownload.kt | 2 +- .../library/anime/AnimeLibraryUpdateJob.kt | 7 +- .../library/manga/MangaLibraryUpdateJob.kt | 7 +- .../data/notification/NotificationReceiver.kt | 6 +- ...anager.kt => AndroidAnimeSourceManager.kt} | 56 +++------------ .../source/anime/AnimeSourceExtensions.kt | 3 +- ...anager.kt => AndroidMangaSourceManager.kt} | 72 +++---------------- .../source/manga/MangaSourceExtensions.kt | 3 +- .../details/SourcePreferencesScreen.kt | 2 +- .../anime/MigrationAnimeScreenModel.kt | 2 +- .../migration/search/MigrateAnimeDialog.kt | 2 +- .../search/MigrateAnimeSearchScreenModel.kt | 2 +- .../source/browse/BrowseAnimeSourceScreen.kt | 4 +- .../browse/BrowseAnimeSourceScreenModel.kt | 2 +- .../GlobalAnimeSearchScreenModel.kt | 2 +- .../details/MangaSourcePreferencesScreen.kt | 2 +- .../manga/MigrationMangaScreenModel.kt | 2 +- .../migration/search/MigrateMangaDialog.kt | 2 +- .../search/MigrateMangaSearchScreenModel.kt | 2 +- .../source/browse/BrowseMangaSourceScreen.kt | 4 +- .../browse/BrowseMangaSourceScreenModel.kt | 2 +- .../GlobalMangaSearchScreenModel.kt | 2 +- .../ui/entries/anime/AnimeScreenModel.kt | 4 +- .../anime/track/AnimeTrackInfoDialog.kt | 2 +- .../ui/entries/manga/MangaScreenModel.kt | 4 +- .../manga/track/MangaTrackInfoDialog.kt | 2 +- .../ui/library/anime/AnimeLibraryItem.kt | 2 +- .../library/anime/AnimeLibraryScreenModel.kt | 2 +- .../ui/library/anime/AnimeLibraryTab.kt | 4 +- .../ui/library/manga/MangaLibraryItem.kt | 2 +- .../library/manga/MangaLibraryScreenModel.kt | 2 +- .../ui/library/manga/MangaLibraryTab.kt | 4 +- .../tachiyomi/ui/player/ExternalIntents.kt | 4 +- .../tachiyomi/ui/player/PlayerViewModel.kt | 4 +- .../tachiyomi/ui/reader/ReaderViewModel.kt | 4 +- .../ui/reader/loader/ChapterLoader.kt | 4 +- .../updates/anime/AnimeUpdatesScreenModel.kt | 4 +- .../updates/manga/MangaUpdatesScreenModel.kt | 2 +- .../tachiyomi/ui/webview/WebViewActivity.kt | 4 +- .../ui/webview/WebViewScreenModel.kt | 4 +- .../kanade/tachiyomi/util/AnimeExtensions.kt | 2 +- .../kanade/tachiyomi/util/MangaExtensions.kt | 2 +- .../data/source/anime/AnimeSourceMapper.kt | 11 +++ .../data/source/manga/MangaSourceMapper.kt | 11 +++ .../backup/service/BackupPreferences.kt | 6 +- .../domain/backup/service/PreferenceValues.kt | 6 ++ .../download/service/DownloadPreferences.kt | 2 +- .../source/anime/model/StubAnimeSource.kt | 33 +++++++++ .../anime/service/AnimeSourceManager.kt | 22 ++++++ .../source/manga/model/StubMangaSource.kt | 50 +++++++++++++ .../manga/service/MangaSourceManager.kt | 22 ++++++ 90 files changed, 351 insertions(+), 292 deletions(-) delete mode 100644 app/src/main/java/eu/kanade/data/source/anime/AnimeSourceMapper.kt delete mode 100644 app/src/main/java/eu/kanade/data/source/manga/MangaSourceMapper.kt rename app/src/main/java/eu/kanade/tachiyomi/source/anime/{AnimeSourceManager.kt => AndroidAnimeSourceManager.kt} (66%) rename app/src/main/java/eu/kanade/tachiyomi/source/manga/{MangaSourceManager.kt => AndroidMangaSourceManager.kt} (59%) rename {app/src/main/java/eu/kanade => domain/src/main/java/tachiyomi}/domain/backup/service/BackupPreferences.kt (69%) create mode 100644 domain/src/main/java/tachiyomi/domain/backup/service/PreferenceValues.kt rename {app/src/main/java/eu/kanade => domain/src/main/java/tachiyomi}/domain/download/service/DownloadPreferences.kt (98%) create mode 100644 domain/src/main/java/tachiyomi/domain/source/anime/model/StubAnimeSource.kt create mode 100644 domain/src/main/java/tachiyomi/domain/source/anime/service/AnimeSourceManager.kt create mode 100644 domain/src/main/java/tachiyomi/domain/source/manga/model/StubMangaSource.kt create mode 100644 domain/src/main/java/tachiyomi/domain/source/manga/service/MangaSourceManager.kt diff --git a/app/src/main/java/eu/kanade/data/source/anime/AnimeSourceMapper.kt b/app/src/main/java/eu/kanade/data/source/anime/AnimeSourceMapper.kt deleted file mode 100644 index f5d02a985..000000000 --- a/app/src/main/java/eu/kanade/data/source/anime/AnimeSourceMapper.kt +++ /dev/null @@ -1,24 +0,0 @@ -package eu.kanade.data.source.anime - -import eu.kanade.tachiyomi.animesource.AnimeCatalogueSource -import eu.kanade.tachiyomi.source.anime.AnimeSourceManager -import tachiyomi.domain.source.anime.model.AnimeSource -import tachiyomi.domain.source.anime.model.AnimeSourceData - -val animeSourceMapper: (eu.kanade.tachiyomi.animesource.AnimeSource) -> AnimeSource = { source -> - AnimeSource( - source.id, - source.lang, - source.name, - supportsLatest = false, - isStub = source is AnimeSourceManager.StubAnimeSource, - ) -} - -val catalogueAnimeSourceMapper: (AnimeCatalogueSource) -> AnimeSource = { source -> - animeSourceMapper(source).copy(supportsLatest = source.supportsLatest) -} - -val animeSourceDataMapper: (Long, String, String) -> AnimeSourceData = { id, lang, name -> - AnimeSourceData(id, lang, name) -} diff --git a/app/src/main/java/eu/kanade/data/source/anime/AnimeSourceRepositoryImpl.kt b/app/src/main/java/eu/kanade/data/source/anime/AnimeSourceRepositoryImpl.kt index 6897066c6..c83da068d 100644 --- a/app/src/main/java/eu/kanade/data/source/anime/AnimeSourceRepositoryImpl.kt +++ b/app/src/main/java/eu/kanade/data/source/anime/AnimeSourceRepositoryImpl.kt @@ -3,7 +3,7 @@ package eu.kanade.data.source.anime import eu.kanade.domain.source.anime.repository.AnimeSourceRepository import eu.kanade.tachiyomi.animesource.AnimeCatalogueSource import eu.kanade.tachiyomi.animesource.model.AnimeFilterList -import eu.kanade.tachiyomi.source.anime.AnimeSourceManager +import eu.kanade.tachiyomi.animesource.online.AnimeHttpSource import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.map import tachiyomi.data.handlers.anime.AnimeDatabaseHandler @@ -11,8 +11,11 @@ import tachiyomi.data.source.anime.AnimeSourceLatestPagingSource import tachiyomi.data.source.anime.AnimeSourcePagingSourceType import tachiyomi.data.source.anime.AnimeSourcePopularPagingSource import tachiyomi.data.source.anime.AnimeSourceSearchPagingSource +import tachiyomi.data.source.anime.animeSourceMapper import tachiyomi.domain.source.anime.model.AnimeSource import tachiyomi.domain.source.anime.model.AnimeSourceWithCount +import tachiyomi.domain.source.anime.model.StubAnimeSource +import tachiyomi.domain.source.anime.service.AnimeSourceManager import tachiyomi.source.local.entries.anime.LocalAnimeSource class AnimeSourceRepositoryImpl( @@ -22,13 +25,19 @@ class AnimeSourceRepositoryImpl( override fun getAnimeSources(): Flow> { return sourceManager.catalogueSources.map { sources -> - sources.map(catalogueAnimeSourceMapper) + sources.map { + animeSourceMapper(it).copy( + supportsLatest = it.supportsLatest, + ) + } } } override fun getOnlineAnimeSources(): Flow> { - return sourceManager.onlineSources.map { sources -> - sources.map(animeSourceMapper) + return sourceManager.catalogueSources.map { sources -> + sources + .filterIsInstance() + .map(animeSourceMapper) } } @@ -38,8 +47,11 @@ class AnimeSourceRepositoryImpl( sourceIdsWithCount .filterNot { it.source == LocalAnimeSource.ID } .map { (sourceId, count) -> - val source = animeSourceMapper(sourceManager.getOrStub(sourceId)) - source to count + val source = sourceManager.getOrStub(sourceId) + val domainSource = animeSourceMapper(source).copy( + isStub = source is StubAnimeSource, + ) + domainSource to count } } } @@ -49,7 +61,10 @@ class AnimeSourceRepositoryImpl( return sourceIdWithNonLibraryAnime.map { sourceId -> sourceId.map { (sourceId, count) -> val source = sourceManager.getOrStub(sourceId) - AnimeSourceWithCount(animeSourceMapper(source), count) + val domainSource = animeSourceMapper(source).copy( + isStub = source is StubAnimeSource, + ) + AnimeSourceWithCount(domainSource, count) } } } diff --git a/app/src/main/java/eu/kanade/data/source/manga/MangaSourceMapper.kt b/app/src/main/java/eu/kanade/data/source/manga/MangaSourceMapper.kt deleted file mode 100644 index 008e3cdce..000000000 --- a/app/src/main/java/eu/kanade/data/source/manga/MangaSourceMapper.kt +++ /dev/null @@ -1,24 +0,0 @@ -package eu.kanade.data.source.manga - -import eu.kanade.tachiyomi.source.CatalogueSource -import eu.kanade.tachiyomi.source.manga.MangaSourceManager -import tachiyomi.domain.source.manga.model.MangaSourceData -import tachiyomi.domain.source.manga.model.Source - -val mangaSourceMapper: (eu.kanade.tachiyomi.source.MangaSource) -> Source = { source -> - Source( - source.id, - source.lang, - source.name, - supportsLatest = false, - isStub = source is MangaSourceManager.StubMangaSource, - ) -} - -val catalogueMangaSourceMapper: (CatalogueSource) -> Source = { source -> - mangaSourceMapper(source).copy(supportsLatest = source.supportsLatest) -} - -val mangaSourceDataMapper: (Long, String, String) -> MangaSourceData = { id, lang, name -> - MangaSourceData(id, lang, name) -} diff --git a/app/src/main/java/eu/kanade/data/source/manga/MangaSourceRepositoryImpl.kt b/app/src/main/java/eu/kanade/data/source/manga/MangaSourceRepositoryImpl.kt index 9e41dabac..5f3e0e962 100644 --- a/app/src/main/java/eu/kanade/data/source/manga/MangaSourceRepositoryImpl.kt +++ b/app/src/main/java/eu/kanade/data/source/manga/MangaSourceRepositoryImpl.kt @@ -2,8 +2,8 @@ package eu.kanade.data.source.manga import eu.kanade.domain.source.manga.repository.MangaSourceRepository import eu.kanade.tachiyomi.source.CatalogueSource -import eu.kanade.tachiyomi.source.manga.MangaSourceManager import eu.kanade.tachiyomi.source.model.FilterList +import eu.kanade.tachiyomi.source.online.HttpSource import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.map import tachiyomi.data.handlers.manga.MangaDatabaseHandler @@ -11,8 +11,11 @@ import tachiyomi.data.source.manga.SourceLatestPagingSource import tachiyomi.data.source.manga.SourcePagingSourceType import tachiyomi.data.source.manga.SourcePopularPagingSource import tachiyomi.data.source.manga.SourceSearchPagingSource +import tachiyomi.data.source.manga.mangaSourceMapper import tachiyomi.domain.source.manga.model.MangaSourceWithCount import tachiyomi.domain.source.manga.model.Source +import tachiyomi.domain.source.manga.model.StubMangaSource +import tachiyomi.domain.source.manga.service.MangaSourceManager import tachiyomi.source.local.entries.manga.LocalMangaSource class MangaSourceRepositoryImpl( @@ -22,13 +25,19 @@ class MangaSourceRepositoryImpl( override fun getMangaSources(): Flow> { return sourceManager.catalogueSources.map { sources -> - sources.map(catalogueMangaSourceMapper) + sources.map { + mangaSourceMapper(it).copy( + supportsLatest = it.supportsLatest, + ) + } } } override fun getOnlineMangaSources(): Flow> { - return sourceManager.onlineSources.map { sources -> - sources.map(mangaSourceMapper) + return sourceManager.catalogueSources.map { sources -> + sources + .filterIsInstance() + .map(mangaSourceMapper) } } @@ -38,8 +47,11 @@ class MangaSourceRepositoryImpl( sourceIdsWithCount .filterNot { it.source == LocalMangaSource.ID } .map { (sourceId, count) -> - val source = mangaSourceMapper(sourceManager.getOrStub(sourceId)) - source to count + val source = sourceManager.getOrStub(sourceId) + val domainSource = mangaSourceMapper(source).copy( + isStub = source is StubMangaSource, + ) + domainSource to count } } } @@ -49,7 +61,10 @@ class MangaSourceRepositoryImpl( return sourceIdWithNonLibraryManga.map { sourceId -> sourceId.map { (sourceId, count) -> val source = sourceManager.getOrStub(sourceId) - MangaSourceWithCount(mangaSourceMapper(source), count) + val domainSource = mangaSourceMapper(source).copy( + isStub = source is StubMangaSource, + ) + MangaSourceWithCount(domainSource, count) } } } diff --git a/app/src/main/java/eu/kanade/domain/download/anime/interactor/DeleteEpisodeDownload.kt b/app/src/main/java/eu/kanade/domain/download/anime/interactor/DeleteEpisodeDownload.kt index 911ec167b..eac3c1332 100644 --- a/app/src/main/java/eu/kanade/domain/download/anime/interactor/DeleteEpisodeDownload.kt +++ b/app/src/main/java/eu/kanade/domain/download/anime/interactor/DeleteEpisodeDownload.kt @@ -1,10 +1,10 @@ package eu.kanade.domain.download.anime.interactor import eu.kanade.tachiyomi.data.download.anime.AnimeDownloadManager -import eu.kanade.tachiyomi.source.anime.AnimeSourceManager import tachiyomi.core.util.lang.withNonCancellableContext import tachiyomi.domain.entries.anime.model.Anime import tachiyomi.domain.items.episode.model.Episode +import tachiyomi.domain.source.anime.service.AnimeSourceManager class DeleteAnimeDownload( private val sourceManager: AnimeSourceManager, diff --git a/app/src/main/java/eu/kanade/domain/download/manga/interactor/DeleteChapterDownload.kt b/app/src/main/java/eu/kanade/domain/download/manga/interactor/DeleteChapterDownload.kt index 81b8c3aac..0b74f8b1e 100644 --- a/app/src/main/java/eu/kanade/domain/download/manga/interactor/DeleteChapterDownload.kt +++ b/app/src/main/java/eu/kanade/domain/download/manga/interactor/DeleteChapterDownload.kt @@ -1,10 +1,10 @@ package eu.kanade.domain.download.manga.interactor import eu.kanade.tachiyomi.data.download.manga.MangaDownloadManager -import eu.kanade.tachiyomi.source.manga.MangaSourceManager import tachiyomi.core.util.lang.withNonCancellableContext import tachiyomi.domain.entries.manga.model.Manga import tachiyomi.domain.items.chapter.model.Chapter +import tachiyomi.domain.source.manga.service.MangaSourceManager class DeleteChapterDownload( private val sourceManager: MangaSourceManager, diff --git a/app/src/main/java/eu/kanade/domain/items/chapter/interactor/SetReadStatus.kt b/app/src/main/java/eu/kanade/domain/items/chapter/interactor/SetReadStatus.kt index eae6058dd..6e07301dc 100644 --- a/app/src/main/java/eu/kanade/domain/items/chapter/interactor/SetReadStatus.kt +++ b/app/src/main/java/eu/kanade/domain/items/chapter/interactor/SetReadStatus.kt @@ -1,10 +1,10 @@ package eu.kanade.domain.items.chapter.interactor import eu.kanade.domain.download.manga.interactor.DeleteChapterDownload -import eu.kanade.domain.download.service.DownloadPreferences import logcat.LogPriority import tachiyomi.core.util.lang.withNonCancellableContext import tachiyomi.core.util.system.logcat +import tachiyomi.domain.download.service.DownloadPreferences import tachiyomi.domain.entries.manga.model.Manga import tachiyomi.domain.entries.manga.repository.MangaRepository import tachiyomi.domain.items.chapter.model.Chapter diff --git a/app/src/main/java/eu/kanade/domain/items/episode/interactor/SetSeenStatus.kt b/app/src/main/java/eu/kanade/domain/items/episode/interactor/SetSeenStatus.kt index 09c0c300b..bfc181df9 100644 --- a/app/src/main/java/eu/kanade/domain/items/episode/interactor/SetSeenStatus.kt +++ b/app/src/main/java/eu/kanade/domain/items/episode/interactor/SetSeenStatus.kt @@ -1,10 +1,10 @@ package eu.kanade.domain.items.episode.interactor import eu.kanade.domain.download.anime.interactor.DeleteAnimeDownload -import eu.kanade.domain.download.service.DownloadPreferences import logcat.LogPriority import tachiyomi.core.util.lang.withNonCancellableContext import tachiyomi.core.util.system.logcat +import tachiyomi.domain.download.service.DownloadPreferences import tachiyomi.domain.entries.anime.model.Anime import tachiyomi.domain.entries.anime.repository.AnimeRepository import tachiyomi.domain.items.episode.model.Episode diff --git a/app/src/main/java/eu/kanade/domain/source/anime/interactor/GetAnimeSourcesWithFavoriteCount.kt b/app/src/main/java/eu/kanade/domain/source/anime/interactor/GetAnimeSourcesWithFavoriteCount.kt index 2dc21f3c7..46dbdd586 100644 --- a/app/src/main/java/eu/kanade/domain/source/anime/interactor/GetAnimeSourcesWithFavoriteCount.kt +++ b/app/src/main/java/eu/kanade/domain/source/anime/interactor/GetAnimeSourcesWithFavoriteCount.kt @@ -6,6 +6,7 @@ import eu.kanade.domain.source.service.SourcePreferences import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.combine import tachiyomi.domain.source.anime.model.AnimeSource +import tachiyomi.source.local.entries.anime.LocalAnimeSource import java.text.Collator import java.util.Collections import java.util.Locale @@ -21,7 +22,9 @@ class GetAnimeSourcesWithFavoriteCount( preferences.migrationSortingMode().changes(), repository.getAnimeSourcesWithFavoriteCount(), ) { direction, mode, list -> - list.sortedWith(sortFn(direction, mode)) + list + .filterNot { it.first.id == LocalAnimeSource.ID } + .sortedWith(sortFn(direction, mode)) } } diff --git a/app/src/main/java/eu/kanade/domain/source/manga/interactor/GetMangaSourcesWithFavoriteCount.kt b/app/src/main/java/eu/kanade/domain/source/manga/interactor/GetMangaSourcesWithFavoriteCount.kt index 1352961d7..ba20f094a 100644 --- a/app/src/main/java/eu/kanade/domain/source/manga/interactor/GetMangaSourcesWithFavoriteCount.kt +++ b/app/src/main/java/eu/kanade/domain/source/manga/interactor/GetMangaSourcesWithFavoriteCount.kt @@ -6,6 +6,7 @@ import eu.kanade.domain.source.service.SourcePreferences import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.combine import tachiyomi.domain.source.manga.model.Source +import tachiyomi.source.local.entries.manga.LocalMangaSource import java.text.Collator import java.util.Collections import java.util.Locale @@ -21,7 +22,9 @@ class GetMangaSourcesWithFavoriteCount( preferences.migrationSortingMode().changes(), repository.getMangaSourcesWithFavoriteCount(), ) { direction, mode, list -> - list.sortedWith(sortFn(direction, mode)) + list + .filterNot { it.first.id == LocalMangaSource.ID } + .sortedWith(sortFn(direction, mode)) } } diff --git a/app/src/main/java/eu/kanade/presentation/browse/anime/BrowseAnimeSourceScreen.kt b/app/src/main/java/eu/kanade/presentation/browse/anime/BrowseAnimeSourceScreen.kt index bcd460c2a..6bd23cda9 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/anime/BrowseAnimeSourceScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/anime/BrowseAnimeSourceScreen.kt @@ -14,6 +14,7 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.res.stringResource import androidx.paging.LoadState import androidx.paging.compose.LazyPagingItems import eu.kanade.presentation.browse.anime.components.BrowseAnimeSourceComfortableGrid @@ -22,11 +23,11 @@ import eu.kanade.presentation.browse.anime.components.BrowseAnimeSourceList import eu.kanade.presentation.components.AppBar import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.animesource.AnimeSource -import eu.kanade.tachiyomi.source.anime.AnimeSourceManager import kotlinx.coroutines.flow.StateFlow import tachiyomi.domain.entries.anime.model.Anime import tachiyomi.domain.items.episode.model.NoEpisodesException import tachiyomi.domain.library.model.LibraryDisplayMode +import tachiyomi.domain.source.anime.model.StubAnimeSource import tachiyomi.presentation.core.components.material.Scaffold import tachiyomi.presentation.core.screens.EmptyScreen import tachiyomi.presentation.core.screens.EmptyScreenAction @@ -147,7 +148,7 @@ fun BrowseAnimeSourceContent( @Composable fun MissingSourceScreen( - source: AnimeSourceManager.StubAnimeSource, + source: StubAnimeSource, navigateUp: () -> Unit, ) { Scaffold( @@ -160,7 +161,7 @@ fun MissingSourceScreen( }, ) { paddingValues -> EmptyScreen( - message = source.getSourceNotInstalledException().message!!, + message = stringResource(R.string.source_not_installed, source.toString()), modifier = Modifier.padding(paddingValues), ) } diff --git a/app/src/main/java/eu/kanade/presentation/browse/manga/BrowseMangaSourceScreen.kt b/app/src/main/java/eu/kanade/presentation/browse/manga/BrowseMangaSourceScreen.kt index 90c9d60ba..f9fd9b467 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/manga/BrowseMangaSourceScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/manga/BrowseMangaSourceScreen.kt @@ -14,6 +14,7 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.res.stringResource import androidx.paging.LoadState import androidx.paging.compose.LazyPagingItems import eu.kanade.presentation.browse.manga.components.BrowseMangaSourceComfortableGrid @@ -22,11 +23,11 @@ import eu.kanade.presentation.browse.manga.components.BrowseMangaSourceList import eu.kanade.presentation.components.AppBar import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.source.MangaSource -import eu.kanade.tachiyomi.source.manga.MangaSourceManager import kotlinx.coroutines.flow.StateFlow import tachiyomi.domain.entries.manga.model.Manga import tachiyomi.domain.items.chapter.model.NoChaptersException import tachiyomi.domain.library.model.LibraryDisplayMode +import tachiyomi.domain.source.manga.model.StubMangaSource import tachiyomi.presentation.core.components.material.Scaffold import tachiyomi.presentation.core.screens.EmptyScreen import tachiyomi.presentation.core.screens.EmptyScreenAction @@ -147,7 +148,7 @@ fun BrowseSourceContent( @Composable fun MissingSourceScreen( - source: MangaSourceManager.StubMangaSource, + source: StubMangaSource, navigateUp: () -> Unit, ) { Scaffold( @@ -160,7 +161,7 @@ fun MissingSourceScreen( }, ) { paddingValues -> EmptyScreen( - message = source.getSourceNotInstalledException().message!!, + message = stringResource(R.string.source_not_installed, source.toString()), modifier = Modifier.padding(paddingValues), ) } diff --git a/app/src/main/java/eu/kanade/presentation/components/ItemDownloadIndicator.kt b/app/src/main/java/eu/kanade/presentation/components/ItemDownloadIndicator.kt index 2f5e8a0fb..5ec22b826 100644 --- a/app/src/main/java/eu/kanade/presentation/components/ItemDownloadIndicator.kt +++ b/app/src/main/java/eu/kanade/presentation/components/ItemDownloadIndicator.kt @@ -12,7 +12,7 @@ import androidx.compose.ui.hapticfeedback.HapticFeedbackType import androidx.compose.ui.platform.LocalHapticFeedback import androidx.compose.ui.semantics.Role import androidx.compose.ui.unit.dp -import eu.kanade.domain.download.service.DownloadPreferences +import tachiyomi.domain.download.service.DownloadPreferences import tachiyomi.presentation.core.components.material.IconButtonTokens import uy.kohesive.injekt.injectLazy diff --git a/app/src/main/java/eu/kanade/presentation/entries/anime/AnimeScreen.kt b/app/src/main/java/eu/kanade/presentation/entries/anime/AnimeScreen.kt index 9de03fc90..c85f2bc64 100644 --- a/app/src/main/java/eu/kanade/presentation/entries/anime/AnimeScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/entries/anime/AnimeScreen.kt @@ -61,7 +61,6 @@ import eu.kanade.presentation.entries.anime.components.EpisodeDownloadAction import eu.kanade.presentation.entries.anime.components.ExpandableAnimeDescription import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.download.anime.model.AnimeDownload -import eu.kanade.tachiyomi.source.anime.AnimeSourceManager import eu.kanade.tachiyomi.source.anime.getNameForAnimeInfo import eu.kanade.tachiyomi.ui.entries.anime.AnimeScreenState import eu.kanade.tachiyomi.ui.entries.anime.EpisodeItem @@ -71,6 +70,7 @@ import eu.kanade.tachiyomi.util.lang.toRelativeString import eu.kanade.tachiyomi.util.system.copyToClipboard import tachiyomi.domain.entries.anime.model.Anime import tachiyomi.domain.items.episode.model.Episode +import tachiyomi.domain.source.anime.model.StubAnimeSource import tachiyomi.presentation.core.components.LazyColumn import tachiyomi.presentation.core.components.TwoPanelBox import tachiyomi.presentation.core.components.VerticalFastScroller @@ -369,7 +369,7 @@ private fun AnimeScreenSmallImpl( author = state.anime.author, artist = state.anime.artist, sourceName = remember { state.source.getNameForAnimeInfo() }, - isStubSource = remember { state.source is AnimeSourceManager.StubAnimeSource }, + isStubSource = remember { state.source is StubAnimeSource }, coverDataProvider = { state.anime }, status = state.anime.status, onCoverClick = onCoverClicked, @@ -586,7 +586,7 @@ fun AnimeScreenLargeImpl( author = state.anime.author, artist = state.anime.artist, sourceName = remember { state.source.getNameForAnimeInfo() }, - isStubSource = remember { state.source is AnimeSourceManager.StubAnimeSource }, + isStubSource = remember { state.source is StubAnimeSource }, coverDataProvider = { state.anime }, status = state.anime.status, onCoverClick = onCoverClicked, diff --git a/app/src/main/java/eu/kanade/presentation/entries/anime/EpisodeOptionsDialogScreen.kt b/app/src/main/java/eu/kanade/presentation/entries/anime/EpisodeOptionsDialogScreen.kt index bb2d194e9..3fe3bd554 100644 --- a/app/src/main/java/eu/kanade/presentation/entries/anime/EpisodeOptionsDialogScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/entries/anime/EpisodeOptionsDialogScreen.kt @@ -40,7 +40,6 @@ import eu.kanade.presentation.util.Screen import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.animesource.model.Video import eu.kanade.tachiyomi.data.download.anime.AnimeDownloadManager -import eu.kanade.tachiyomi.source.anime.AnimeSourceManager import eu.kanade.tachiyomi.ui.player.loader.EpisodeLoader import eu.kanade.tachiyomi.util.system.toast import kotlinx.coroutines.DelicateCoroutinesApi @@ -55,6 +54,7 @@ import tachiyomi.domain.entries.anime.interactor.GetAnime import tachiyomi.domain.entries.anime.model.Anime import tachiyomi.domain.items.episode.interactor.GetEpisode import tachiyomi.domain.items.episode.model.Episode +import tachiyomi.domain.source.anime.service.AnimeSourceManager import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.screens.LoadingScreen import uy.kohesive.injekt.Injekt diff --git a/app/src/main/java/eu/kanade/presentation/entries/manga/MangaScreen.kt b/app/src/main/java/eu/kanade/presentation/entries/manga/MangaScreen.kt index 5124fe389..3c57de012 100644 --- a/app/src/main/java/eu/kanade/presentation/entries/manga/MangaScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/entries/manga/MangaScreen.kt @@ -60,7 +60,6 @@ import eu.kanade.presentation.entries.manga.components.MangaChapterListItem import eu.kanade.presentation.entries.manga.components.MangaInfoBox import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.download.manga.model.MangaDownload -import eu.kanade.tachiyomi.source.manga.MangaSourceManager import eu.kanade.tachiyomi.source.manga.getNameForMangaInfo import eu.kanade.tachiyomi.ui.entries.manga.ChapterItem import eu.kanade.tachiyomi.ui.entries.manga.MangaScreenState @@ -69,6 +68,7 @@ import eu.kanade.tachiyomi.util.lang.toRelativeString import eu.kanade.tachiyomi.util.system.copyToClipboard import tachiyomi.domain.entries.manga.model.Manga import tachiyomi.domain.items.chapter.model.Chapter +import tachiyomi.domain.source.manga.model.StubMangaSource import tachiyomi.presentation.core.components.LazyColumn import tachiyomi.presentation.core.components.TwoPanelBox import tachiyomi.presentation.core.components.VerticalFastScroller @@ -354,7 +354,7 @@ private fun MangaScreenSmallImpl( author = state.manga.author, artist = state.manga.artist, sourceName = remember { state.source.getNameForMangaInfo() }, - isStubSource = remember { state.source is MangaSourceManager.StubMangaSource }, + isStubSource = remember { state.source is StubMangaSource }, coverDataProvider = { state.manga }, status = state.manga.status, onCoverClick = onCoverClicked, @@ -567,7 +567,7 @@ fun MangaScreenLargeImpl( author = state.manga.author, artist = state.manga.artist, sourceName = remember { state.source.getNameForMangaInfo() }, - isStubSource = remember { state.source is MangaSourceManager.StubMangaSource }, + isStubSource = remember { state.source is StubMangaSource }, coverDataProvider = { state.manga }, status = state.manga.status, onCoverClick = onCoverClicked, diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsBackupScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsBackupScreen.kt index e772df726..eca50dd43 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsBackupScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsBackupScreen.kt @@ -36,7 +36,6 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.core.net.toUri import com.hippo.unifile.UniFile -import eu.kanade.domain.backup.service.BackupPreferences import eu.kanade.presentation.extensions.RequestStoragePermission import eu.kanade.presentation.more.settings.Preference import eu.kanade.presentation.util.collectAsState @@ -58,6 +57,7 @@ import eu.kanade.tachiyomi.util.system.DeviceUtil import eu.kanade.tachiyomi.util.system.copyToClipboard import eu.kanade.tachiyomi.util.system.toast import kotlinx.coroutines.launch +import tachiyomi.domain.backup.service.BackupPreferences import tachiyomi.presentation.core.components.ScrollbarLazyColumn import tachiyomi.presentation.core.components.material.Divider import tachiyomi.presentation.core.util.isScrolledToEnd diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsDownloadScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsDownloadScreen.kt index 35e984a7b..4f905a550 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsDownloadScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsDownloadScreen.kt @@ -20,7 +20,6 @@ import androidx.compose.ui.util.fastMap import androidx.core.net.toUri import com.hippo.unifile.UniFile import eu.kanade.domain.base.BasePreferences -import eu.kanade.domain.download.service.DownloadPreferences import eu.kanade.presentation.category.visualName import eu.kanade.presentation.more.settings.Preference import eu.kanade.presentation.more.settings.widget.TriStateListDialog @@ -30,6 +29,7 @@ import kotlinx.coroutines.runBlocking import tachiyomi.domain.category.anime.interactor.GetAnimeCategories import tachiyomi.domain.category.manga.interactor.GetMangaCategories import tachiyomi.domain.category.model.Category +import tachiyomi.domain.download.service.DownloadPreferences import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get import java.io.File diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsTrackingScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsTrackingScreen.kt index a4cdcbd53..0b31f6260 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsTrackingScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsTrackingScreen.kt @@ -52,11 +52,11 @@ import eu.kanade.tachiyomi.data.track.bangumi.BangumiApi import eu.kanade.tachiyomi.data.track.myanimelist.MyAnimeListApi import eu.kanade.tachiyomi.data.track.shikimori.ShikimoriApi import eu.kanade.tachiyomi.data.track.simkl.SimklApi -import eu.kanade.tachiyomi.source.manga.MangaSourceManager import eu.kanade.tachiyomi.util.system.openInBrowser import eu.kanade.tachiyomi.util.system.toast import tachiyomi.core.util.lang.launchIO import tachiyomi.core.util.lang.withUIContext +import tachiyomi.domain.source.manga.service.MangaSourceManager import tachiyomi.presentation.core.components.material.padding import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get diff --git a/app/src/main/java/eu/kanade/tachiyomi/AppModule.kt b/app/src/main/java/eu/kanade/tachiyomi/AppModule.kt index e755230bf..b86c84b52 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/AppModule.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/AppModule.kt @@ -10,9 +10,7 @@ import data.History import data.Mangas import dataanime.Animehistory import dataanime.Animes -import eu.kanade.domain.backup.service.BackupPreferences import eu.kanade.domain.base.BasePreferences -import eu.kanade.domain.download.service.DownloadPreferences import eu.kanade.domain.library.service.LibraryPreferences import eu.kanade.domain.source.service.SourcePreferences import eu.kanade.domain.track.anime.store.DelayedAnimeTrackingStore @@ -38,8 +36,8 @@ import eu.kanade.tachiyomi.extension.manga.MangaExtensionManager import eu.kanade.tachiyomi.network.JavaScriptEngine import eu.kanade.tachiyomi.network.NetworkHelper import eu.kanade.tachiyomi.network.NetworkPreferences -import eu.kanade.tachiyomi.source.anime.AnimeSourceManager -import eu.kanade.tachiyomi.source.manga.MangaSourceManager +import eu.kanade.tachiyomi.source.anime.AndroidAnimeSourceManager +import eu.kanade.tachiyomi.source.manga.AndroidMangaSourceManager import eu.kanade.tachiyomi.ui.player.ExternalIntents import eu.kanade.tachiyomi.ui.player.settings.PlayerPreferences import eu.kanade.tachiyomi.ui.reader.setting.ReaderPreferences @@ -61,6 +59,10 @@ import tachiyomi.data.handlers.manga.AndroidMangaDatabaseHandler import tachiyomi.data.handlers.manga.MangaDatabaseHandler import tachiyomi.data.listOfStringsAdapter import tachiyomi.data.updateStrategyAdapter +import tachiyomi.domain.backup.service.BackupPreferences +import tachiyomi.domain.download.service.DownloadPreferences +import tachiyomi.domain.source.anime.service.AnimeSourceManager +import tachiyomi.domain.source.manga.service.MangaSourceManager import tachiyomi.mi.data.AnimeDatabase import tachiyomi.source.local.image.anime.LocalAnimeCoverManager import tachiyomi.source.local.image.manga.LocalMangaCoverManager @@ -182,8 +184,8 @@ class AppModule(val app: Application) : InjektModule { addSingletonFactory { NetworkHelper(app, get()) } addSingletonFactory { JavaScriptEngine(app) } - addSingletonFactory { MangaSourceManager(app, get(), get()) } - addSingletonFactory { AnimeSourceManager(app, get(), get()) } + addSingletonFactory { AndroidMangaSourceManager(app, get(), get()) } + addSingletonFactory { AndroidAnimeSourceManager(app, get(), get()) } addSingletonFactory { MangaExtensionManager(app) } addSingletonFactory { AnimeExtensionManager(app) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/Migrations.kt b/app/src/main/java/eu/kanade/tachiyomi/Migrations.kt index 8c8b39b1d..98c1545ab 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/Migrations.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/Migrations.kt @@ -4,7 +4,6 @@ import android.content.Context import androidx.core.content.edit import androidx.preference.PreferenceManager import androidx.work.WorkManager -import eu.kanade.domain.backup.service.BackupPreferences import eu.kanade.domain.base.BasePreferences import eu.kanade.domain.library.service.LibraryPreferences import eu.kanade.domain.source.service.SourcePreferences @@ -27,6 +26,7 @@ import eu.kanade.tachiyomi.util.system.DeviceUtil import eu.kanade.tachiyomi.util.system.toast import tachiyomi.core.preference.PreferenceStore import tachiyomi.core.preference.getEnum +import tachiyomi.domain.backup.service.BackupPreferences import tachiyomi.domain.entries.TriStateFilter import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupCreatorJob.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupCreatorJob.kt index 3db18a29d..13d63cb9f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupCreatorJob.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupCreatorJob.kt @@ -14,11 +14,11 @@ import androidx.work.WorkManager import androidx.work.WorkerParameters import androidx.work.workDataOf import com.hippo.unifile.UniFile -import eu.kanade.domain.backup.service.BackupPreferences import eu.kanade.tachiyomi.data.notification.Notifications import eu.kanade.tachiyomi.util.system.notificationManager import logcat.LogPriority import tachiyomi.core.util.system.logcat +import tachiyomi.domain.backup.service.BackupPreferences import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get import java.util.concurrent.TimeUnit diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupFileValidator.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupFileValidator.kt index 14f0cb356..6eecdfdf9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupFileValidator.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupFileValidator.kt @@ -4,9 +4,9 @@ import android.content.Context import android.net.Uri import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.track.TrackManager -import eu.kanade.tachiyomi.source.anime.AnimeSourceManager -import eu.kanade.tachiyomi.source.manga.MangaSourceManager import eu.kanade.tachiyomi.util.BackupUtil +import tachiyomi.domain.source.anime.service.AnimeSourceManager +import tachiyomi.domain.source.manga.service.MangaSourceManager import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupManager.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupManager.kt index 97ba3f894..fbceac141 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 @@ -11,7 +11,6 @@ import data.Manga_sync import data.Mangas import dataanime.Anime_sync import dataanime.Animes -import eu.kanade.domain.backup.service.BackupPreferences import eu.kanade.domain.library.service.LibraryPreferences import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.backup.BackupConst.BACKUP_CATEGORY @@ -59,10 +58,8 @@ import eu.kanade.tachiyomi.data.database.models.manga.Manga import eu.kanade.tachiyomi.data.database.models.manga.MangaTrack import eu.kanade.tachiyomi.extension.anime.AnimeExtensionManager import eu.kanade.tachiyomi.extension.manga.MangaExtensionManager -import eu.kanade.tachiyomi.source.anime.AnimeSourceManager import eu.kanade.tachiyomi.source.anime.getPreferenceKey import eu.kanade.tachiyomi.source.anime.model.copyFrom -import eu.kanade.tachiyomi.source.manga.MangaSourceManager import eu.kanade.tachiyomi.source.manga.getPreferenceKey import eu.kanade.tachiyomi.source.manga.model.copyFrom import eu.kanade.tachiyomi.util.system.hasPermission @@ -76,6 +73,7 @@ import tachiyomi.core.util.system.logcat import tachiyomi.data.handlers.anime.AnimeDatabaseHandler import tachiyomi.data.handlers.manga.MangaDatabaseHandler import tachiyomi.data.updateStrategyAdapter +import tachiyomi.domain.backup.service.BackupPreferences import tachiyomi.domain.category.anime.interactor.GetAnimeCategories import tachiyomi.domain.category.manga.interactor.GetMangaCategories import tachiyomi.domain.category.model.Category @@ -83,6 +81,8 @@ import tachiyomi.domain.entries.anime.interactor.GetAnimeFavorites import tachiyomi.domain.entries.manga.interactor.GetMangaFavorites import tachiyomi.domain.history.anime.model.AnimeHistoryUpdate import tachiyomi.domain.history.manga.model.MangaHistoryUpdate +import tachiyomi.domain.source.anime.service.AnimeSourceManager +import tachiyomi.domain.source.manga.service.MangaSourceManager 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/coil/AnimeCoverFetcher.kt b/app/src/main/java/eu/kanade/tachiyomi/data/coil/AnimeCoverFetcher.kt index 666a2e74b..a5a9771bf 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/coil/AnimeCoverFetcher.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/coil/AnimeCoverFetcher.kt @@ -15,7 +15,6 @@ import eu.kanade.tachiyomi.data.cache.AnimeCoverCache import eu.kanade.tachiyomi.data.coil.AnimeCoverFetcher.Companion.USE_CUSTOM_COVER import eu.kanade.tachiyomi.data.database.models.anime.Anime import eu.kanade.tachiyomi.network.await -import eu.kanade.tachiyomi.source.anime.AnimeSourceManager import logcat.LogPriority import okhttp3.CacheControl import okhttp3.Call @@ -28,6 +27,7 @@ import okio.buffer import okio.sink import tachiyomi.core.util.system.logcat import tachiyomi.domain.entries.anime.model.AnimeCover +import tachiyomi.domain.source.anime.service.AnimeSourceManager import uy.kohesive.injekt.injectLazy import java.io.File import tachiyomi.domain.entries.anime.model.Anime as DomainAnime 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 d4d4486aa..0b1d7a167 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 @@ -14,7 +14,6 @@ import eu.kanade.tachiyomi.data.cache.MangaCoverCache import eu.kanade.tachiyomi.data.coil.MangaCoverFetcher.Companion.USE_CUSTOM_COVER import eu.kanade.tachiyomi.data.database.models.manga.Manga import eu.kanade.tachiyomi.network.await -import eu.kanade.tachiyomi.source.manga.MangaSourceManager import eu.kanade.tachiyomi.source.online.HttpSource import logcat.LogPriority import okhttp3.CacheControl @@ -28,6 +27,7 @@ import okio.buffer import okio.sink import tachiyomi.core.util.system.logcat import tachiyomi.domain.entries.manga.model.MangaCover +import tachiyomi.domain.source.manga.service.MangaSourceManager import uy.kohesive.injekt.injectLazy import java.io.File import tachiyomi.domain.entries.manga.model.Manga as DomainManga diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/anime/AnimeDownloadCache.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/anime/AnimeDownloadCache.kt index 51edb34d2..bb7f0b435 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/anime/AnimeDownloadCache.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/anime/AnimeDownloadCache.kt @@ -4,10 +4,8 @@ import android.content.Context import androidx.core.net.toUri import com.hippo.unifile.UniFile import eu.kanade.core.util.mapNotNullKeys -import eu.kanade.domain.download.service.DownloadPreferences import eu.kanade.tachiyomi.animesource.AnimeSource import eu.kanade.tachiyomi.extension.anime.AnimeExtensionManager -import eu.kanade.tachiyomi.source.anime.AnimeSourceManager import kotlinx.coroutines.CancellationException import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers @@ -30,8 +28,10 @@ import logcat.LogPriority import tachiyomi.core.util.lang.launchIO import tachiyomi.core.util.lang.launchNonCancellable import tachiyomi.core.util.system.logcat +import tachiyomi.domain.download.service.DownloadPreferences import tachiyomi.domain.entries.anime.model.Anime import tachiyomi.domain.items.episode.model.Episode +import tachiyomi.domain.source.anime.service.AnimeSourceManager 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/anime/AnimeDownloadManager.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/anime/AnimeDownloadManager.kt index 4c6bb25fe..045348030 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/anime/AnimeDownloadManager.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/anime/AnimeDownloadManager.kt @@ -1,12 +1,10 @@ package eu.kanade.tachiyomi.data.download.anime import android.content.Context -import eu.kanade.domain.download.service.DownloadPreferences import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.animesource.AnimeSource import eu.kanade.tachiyomi.animesource.model.Video import eu.kanade.tachiyomi.data.download.anime.model.AnimeDownload -import eu.kanade.tachiyomi.source.anime.AnimeSourceManager import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.asFlow import kotlinx.coroutines.flow.drop @@ -21,8 +19,10 @@ import rx.Observable import tachiyomi.core.util.lang.launchIO import tachiyomi.core.util.system.logcat import tachiyomi.domain.category.anime.interactor.GetAnimeCategories +import tachiyomi.domain.download.service.DownloadPreferences import tachiyomi.domain.entries.anime.model.Anime import tachiyomi.domain.items.episode.model.Episode +import tachiyomi.domain.source.anime.service.AnimeSourceManager import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/anime/AnimeDownloadProvider.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/anime/AnimeDownloadProvider.kt index f76d8df2c..fa3f97eca 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/anime/AnimeDownloadProvider.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/anime/AnimeDownloadProvider.kt @@ -3,7 +3,6 @@ package eu.kanade.tachiyomi.data.download.anime import android.content.Context import androidx.core.net.toUri import com.hippo.unifile.UniFile -import eu.kanade.domain.download.service.DownloadPreferences import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.animesource.AnimeSource import eu.kanade.tachiyomi.util.storage.DiskUtil @@ -12,6 +11,7 @@ import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach import logcat.LogPriority import tachiyomi.core.util.system.logcat +import tachiyomi.domain.download.service.DownloadPreferences import tachiyomi.domain.entries.anime.model.Anime import tachiyomi.domain.items.episode.model.Episode import uy.kohesive.injekt.Injekt diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/anime/AnimeDownloadService.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/anime/AnimeDownloadService.kt index 06af0063d..a5ff3e863 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/anime/AnimeDownloadService.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/anime/AnimeDownloadService.kt @@ -9,7 +9,6 @@ import android.os.IBinder import android.os.PowerManager import androidx.annotation.StringRes import androidx.core.content.ContextCompat -import eu.kanade.domain.download.service.DownloadPreferences import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.notification.Notifications import eu.kanade.tachiyomi.util.system.acquireWakeLock @@ -31,6 +30,7 @@ import logcat.LogPriority import ru.beryukhov.reactivenetwork.ReactiveNetwork import tachiyomi.core.util.lang.withUIContext import tachiyomi.core.util.system.logcat +import tachiyomi.domain.download.service.DownloadPreferences import uy.kohesive.injekt.injectLazy /** diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/anime/AnimeDownloadStore.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/anime/AnimeDownloadStore.kt index 5dd32e181..44daa7e3c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/anime/AnimeDownloadStore.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/anime/AnimeDownloadStore.kt @@ -4,7 +4,6 @@ import android.content.Context import androidx.core.content.edit import eu.kanade.tachiyomi.animesource.online.AnimeHttpSource import eu.kanade.tachiyomi.data.download.anime.model.AnimeDownload -import eu.kanade.tachiyomi.source.anime.AnimeSourceManager import kotlinx.coroutines.runBlocking import kotlinx.serialization.Serializable import kotlinx.serialization.decodeFromString @@ -13,6 +12,7 @@ import kotlinx.serialization.json.Json import tachiyomi.domain.entries.anime.interactor.GetAnime import tachiyomi.domain.entries.anime.model.Anime import tachiyomi.domain.items.episode.interactor.GetEpisode +import tachiyomi.domain.source.anime.service.AnimeSourceManager import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/anime/AnimeDownloader.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/anime/AnimeDownloader.kt index 53dfe9f2a..708bd17d9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/anime/AnimeDownloader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/anime/AnimeDownloader.kt @@ -14,7 +14,6 @@ import com.arthenica.ffmpegkit.SessionState import com.arthenica.ffmpegkit.StatisticsCallback import com.hippo.unifile.UniFile import com.jakewharton.rxrelay.PublishRelay -import eu.kanade.domain.download.service.DownloadPreferences import eu.kanade.domain.items.episode.model.toSEpisode import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.animesource.model.Video @@ -25,7 +24,6 @@ import eu.kanade.tachiyomi.data.download.anime.model.AnimeDownload import eu.kanade.tachiyomi.data.library.anime.AnimeLibraryUpdateNotifier import eu.kanade.tachiyomi.data.notification.NotificationHandler import eu.kanade.tachiyomi.source.UnmeteredSource -import eu.kanade.tachiyomi.source.anime.AnimeSourceManager import eu.kanade.tachiyomi.util.storage.DiskUtil import eu.kanade.tachiyomi.util.storage.saveTo import eu.kanade.tachiyomi.util.storage.toFFmpegString @@ -45,8 +43,10 @@ import tachiyomi.core.util.lang.launchNow import tachiyomi.core.util.lang.withUIContext import tachiyomi.core.util.system.ImageUtil import tachiyomi.core.util.system.logcat +import tachiyomi.domain.download.service.DownloadPreferences import tachiyomi.domain.entries.anime.model.Anime import tachiyomi.domain.items.episode.model.Episode +import tachiyomi.domain.source.anime.service.AnimeSourceManager 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/download/anime/model/AnimeDownload.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/anime/model/AnimeDownload.kt index 16503f1da..50821efc9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/anime/model/AnimeDownload.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/anime/model/AnimeDownload.kt @@ -2,7 +2,6 @@ package eu.kanade.tachiyomi.data.download.anime.model import eu.kanade.tachiyomi.animesource.model.Video import eu.kanade.tachiyomi.animesource.online.AnimeHttpSource -import eu.kanade.tachiyomi.source.anime.AnimeSourceManager import kotlinx.coroutines.delay import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.asStateFlow @@ -16,6 +15,7 @@ import tachiyomi.domain.entries.anime.interactor.GetAnime import tachiyomi.domain.entries.anime.model.Anime import tachiyomi.domain.items.episode.interactor.GetEpisode import tachiyomi.domain.items.episode.model.Episode +import tachiyomi.domain.source.anime.service.AnimeSourceManager import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/manga/MangaDownloadCache.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/manga/MangaDownloadCache.kt index 32240b5d7..c6c84aee4 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/manga/MangaDownloadCache.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/manga/MangaDownloadCache.kt @@ -4,10 +4,8 @@ import android.content.Context import androidx.core.net.toUri import com.hippo.unifile.UniFile import eu.kanade.core.util.mapNotNullKeys -import eu.kanade.domain.download.service.DownloadPreferences import eu.kanade.tachiyomi.extension.manga.MangaExtensionManager import eu.kanade.tachiyomi.source.MangaSource -import eu.kanade.tachiyomi.source.manga.MangaSourceManager import kotlinx.coroutines.CancellationException import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers @@ -30,8 +28,10 @@ import logcat.LogPriority import tachiyomi.core.util.lang.launchIO import tachiyomi.core.util.lang.launchNonCancellable import tachiyomi.core.util.system.logcat +import tachiyomi.domain.download.service.DownloadPreferences import tachiyomi.domain.entries.manga.model.Manga import tachiyomi.domain.items.chapter.model.Chapter +import tachiyomi.domain.source.manga.service.MangaSourceManager 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/manga/MangaDownloadManager.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/manga/MangaDownloadManager.kt index 732aba70d..80a239afe 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/manga/MangaDownloadManager.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/manga/MangaDownloadManager.kt @@ -1,11 +1,9 @@ package eu.kanade.tachiyomi.data.download.manga import android.content.Context -import eu.kanade.domain.download.service.DownloadPreferences import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.download.manga.model.MangaDownload import eu.kanade.tachiyomi.source.MangaSource -import eu.kanade.tachiyomi.source.manga.MangaSourceManager import eu.kanade.tachiyomi.source.model.Page import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.asFlow @@ -20,8 +18,10 @@ import logcat.LogPriority import tachiyomi.core.util.lang.launchIO import tachiyomi.core.util.system.logcat import tachiyomi.domain.category.manga.interactor.GetMangaCategories +import tachiyomi.domain.download.service.DownloadPreferences import tachiyomi.domain.entries.manga.model.Manga import tachiyomi.domain.items.chapter.model.Chapter +import tachiyomi.domain.source.manga.service.MangaSourceManager import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/manga/MangaDownloadProvider.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/manga/MangaDownloadProvider.kt index 2e8273be5..19f90a45a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/manga/MangaDownloadProvider.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/manga/MangaDownloadProvider.kt @@ -3,7 +3,6 @@ package eu.kanade.tachiyomi.data.download.manga import android.content.Context import androidx.core.net.toUri import com.hippo.unifile.UniFile -import eu.kanade.domain.download.service.DownloadPreferences import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.source.MangaSource import eu.kanade.tachiyomi.util.storage.DiskUtil @@ -12,6 +11,7 @@ import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach import logcat.LogPriority import tachiyomi.core.util.system.logcat +import tachiyomi.domain.download.service.DownloadPreferences import tachiyomi.domain.entries.manga.model.Manga import tachiyomi.domain.items.chapter.model.Chapter import uy.kohesive.injekt.Injekt diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/manga/MangaDownloadService.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/manga/MangaDownloadService.kt index 455bb9da0..36a43679f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/manga/MangaDownloadService.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/manga/MangaDownloadService.kt @@ -8,7 +8,6 @@ import android.os.IBinder import android.os.PowerManager import androidx.annotation.StringRes import androidx.core.content.ContextCompat -import eu.kanade.domain.download.service.DownloadPreferences import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.notification.Notifications import eu.kanade.tachiyomi.util.system.acquireWakeLock @@ -30,6 +29,7 @@ import logcat.LogPriority import ru.beryukhov.reactivenetwork.ReactiveNetwork import tachiyomi.core.util.lang.withUIContext import tachiyomi.core.util.system.logcat +import tachiyomi.domain.download.service.DownloadPreferences import uy.kohesive.injekt.injectLazy /** diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/manga/MangaDownloadStore.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/manga/MangaDownloadStore.kt index d8dc75925..af21a771e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/manga/MangaDownloadStore.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/manga/MangaDownloadStore.kt @@ -3,7 +3,6 @@ package eu.kanade.tachiyomi.data.download.manga import android.content.Context import androidx.core.content.edit import eu.kanade.tachiyomi.data.download.manga.model.MangaDownload -import eu.kanade.tachiyomi.source.manga.MangaSourceManager import eu.kanade.tachiyomi.source.online.HttpSource import kotlinx.coroutines.runBlocking import kotlinx.serialization.Serializable @@ -13,6 +12,7 @@ import kotlinx.serialization.json.Json import tachiyomi.domain.entries.manga.interactor.GetManga import tachiyomi.domain.entries.manga.model.Manga import tachiyomi.domain.items.chapter.interactor.GetChapter +import tachiyomi.domain.source.manga.service.MangaSourceManager import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/manga/MangaDownloader.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/manga/MangaDownloader.kt index e9a623b11..2cdf08e9d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/manga/MangaDownloader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/manga/MangaDownloader.kt @@ -3,7 +3,6 @@ package eu.kanade.tachiyomi.data.download.manga import android.content.Context import com.hippo.unifile.UniFile import com.jakewharton.rxrelay.PublishRelay -import eu.kanade.domain.download.service.DownloadPreferences import eu.kanade.domain.entries.manga.model.getComicInfo import eu.kanade.domain.items.chapter.model.toSChapter import eu.kanade.tachiyomi.R @@ -12,7 +11,6 @@ import eu.kanade.tachiyomi.data.download.manga.model.MangaDownload import eu.kanade.tachiyomi.data.library.manga.MangaLibraryUpdateNotifier import eu.kanade.tachiyomi.data.notification.NotificationHandler import eu.kanade.tachiyomi.source.UnmeteredSource -import eu.kanade.tachiyomi.source.manga.MangaSourceManager import eu.kanade.tachiyomi.source.model.Page import eu.kanade.tachiyomi.source.online.HttpSource import eu.kanade.tachiyomi.util.storage.DiskUtil @@ -48,8 +46,10 @@ import tachiyomi.core.util.lang.withIOContext import tachiyomi.core.util.lang.withUIContext import tachiyomi.core.util.system.ImageUtil import tachiyomi.core.util.system.logcat +import tachiyomi.domain.download.service.DownloadPreferences import tachiyomi.domain.entries.manga.model.Manga import tachiyomi.domain.items.chapter.model.Chapter +import tachiyomi.domain.source.manga.service.MangaSourceManager 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/manga/model/MangaDownload.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/manga/model/MangaDownload.kt index f3961acdb..3af7dc0eb 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/manga/model/MangaDownload.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/manga/model/MangaDownload.kt @@ -1,6 +1,5 @@ package eu.kanade.tachiyomi.data.download.manga.model -import eu.kanade.tachiyomi.source.manga.MangaSourceManager import eu.kanade.tachiyomi.source.model.Page import eu.kanade.tachiyomi.source.online.HttpSource import kotlinx.coroutines.delay @@ -15,6 +14,7 @@ import tachiyomi.domain.entries.manga.interactor.GetManga import tachiyomi.domain.entries.manga.model.Manga import tachiyomi.domain.items.chapter.interactor.GetChapter import tachiyomi.domain.items.chapter.model.Chapter +import tachiyomi.domain.source.manga.service.MangaSourceManager import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/library/anime/AnimeLibraryUpdateJob.kt b/app/src/main/java/eu/kanade/tachiyomi/data/library/anime/AnimeLibraryUpdateJob.kt index 94115527c..26cc20745 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/library/anime/AnimeLibraryUpdateJob.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/library/anime/AnimeLibraryUpdateJob.kt @@ -15,7 +15,6 @@ import androidx.work.WorkManager import androidx.work.WorkQuery import androidx.work.WorkerParameters import androidx.work.workDataOf -import eu.kanade.domain.download.service.DownloadPreferences import eu.kanade.domain.entries.anime.interactor.UpdateAnime import eu.kanade.domain.entries.anime.model.copyFrom import eu.kanade.domain.entries.anime.model.toSAnime @@ -40,7 +39,6 @@ import eu.kanade.tachiyomi.data.track.EnhancedAnimeTrackService import eu.kanade.tachiyomi.data.track.TrackManager import eu.kanade.tachiyomi.data.track.TrackService import eu.kanade.tachiyomi.source.UnmeteredSource -import eu.kanade.tachiyomi.source.anime.AnimeSourceManager import eu.kanade.tachiyomi.source.model.UpdateStrategy import eu.kanade.tachiyomi.util.prepUpdateCover import eu.kanade.tachiyomi.util.shouldDownloadNewEpisodes @@ -64,6 +62,7 @@ import tachiyomi.core.util.lang.withIOContext import tachiyomi.core.util.system.logcat import tachiyomi.domain.category.anime.interactor.GetAnimeCategories import tachiyomi.domain.category.model.Category +import tachiyomi.domain.download.service.DownloadPreferences import tachiyomi.domain.entries.anime.interactor.GetAnime import tachiyomi.domain.entries.anime.interactor.GetLibraryAnime import tachiyomi.domain.entries.anime.model.Anime @@ -72,6 +71,8 @@ import tachiyomi.domain.items.episode.interactor.GetEpisodeByAnimeId import tachiyomi.domain.items.episode.model.Episode import tachiyomi.domain.items.episode.model.NoEpisodesException import tachiyomi.domain.library.anime.LibraryAnime +import tachiyomi.domain.source.anime.model.AnimeSourceNotInstalledException +import tachiyomi.domain.source.anime.service.AnimeSourceManager import tachiyomi.domain.track.anime.interactor.GetAnimeTracks import tachiyomi.domain.track.anime.interactor.InsertAnimeTrack import uy.kohesive.injekt.Injekt @@ -284,7 +285,7 @@ class AnimeLibraryUpdateJob(private val context: Context, workerParams: WorkerPa val errorMessage = when (e) { is NoEpisodesException -> context.getString(R.string.no_chapters_error) // failedUpdates will already have the source, don't need to copy it into the message - is AnimeSourceManager.AnimeSourceNotInstalledException -> context.getString(R.string.loader_not_implemented_error) + is AnimeSourceNotInstalledException -> context.getString(R.string.loader_not_implemented_error) else -> e.message } failedUpdates.add(anime to errorMessage) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/library/manga/MangaLibraryUpdateJob.kt b/app/src/main/java/eu/kanade/tachiyomi/data/library/manga/MangaLibraryUpdateJob.kt index e2df73e1d..10550d0a9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/library/manga/MangaLibraryUpdateJob.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/library/manga/MangaLibraryUpdateJob.kt @@ -15,7 +15,6 @@ import androidx.work.WorkManager import androidx.work.WorkQuery import androidx.work.WorkerParameters import androidx.work.workDataOf -import eu.kanade.domain.download.service.DownloadPreferences import eu.kanade.domain.entries.manga.interactor.UpdateManga import eu.kanade.domain.entries.manga.model.copyFrom import eu.kanade.domain.entries.manga.model.toSManga @@ -39,7 +38,6 @@ import eu.kanade.tachiyomi.data.track.EnhancedMangaTrackService import eu.kanade.tachiyomi.data.track.TrackManager import eu.kanade.tachiyomi.data.track.TrackService import eu.kanade.tachiyomi.source.UnmeteredSource -import eu.kanade.tachiyomi.source.manga.MangaSourceManager import eu.kanade.tachiyomi.source.model.SManga import eu.kanade.tachiyomi.source.model.UpdateStrategy import eu.kanade.tachiyomi.util.prepUpdateCover @@ -64,6 +62,7 @@ import tachiyomi.core.util.lang.withIOContext import tachiyomi.core.util.system.logcat import tachiyomi.domain.category.manga.interactor.GetMangaCategories import tachiyomi.domain.category.model.Category +import tachiyomi.domain.download.service.DownloadPreferences import tachiyomi.domain.entries.manga.interactor.GetLibraryManga import tachiyomi.domain.entries.manga.interactor.GetManga import tachiyomi.domain.entries.manga.model.Manga @@ -72,6 +71,8 @@ import tachiyomi.domain.items.chapter.interactor.GetChapterByMangaId import tachiyomi.domain.items.chapter.model.Chapter import tachiyomi.domain.items.chapter.model.NoChaptersException import tachiyomi.domain.library.manga.LibraryManga +import tachiyomi.domain.source.manga.model.SourceNotInstalledException +import tachiyomi.domain.source.manga.service.MangaSourceManager import tachiyomi.domain.track.manga.interactor.GetMangaTracks import tachiyomi.domain.track.manga.interactor.InsertMangaTrack import uy.kohesive.injekt.Injekt @@ -284,7 +285,7 @@ class MangaLibraryUpdateJob(private val context: Context, workerParams: WorkerPa val errorMessage = when (e) { is NoChaptersException -> context.getString(R.string.no_chapters_error) // failedUpdates will already have the source, don't need to copy it into the message - is MangaSourceManager.SourceNotInstalledException -> context.getString(R.string.loader_not_implemented_error) + is SourceNotInstalledException -> context.getString(R.string.loader_not_implemented_error) else -> e.message } failedUpdates.add(manga to errorMessage) 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 8fab957e8..6518eee1d 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 @@ -8,7 +8,6 @@ import android.net.Uri import android.os.Build import androidx.core.content.ContextCompat import androidx.core.net.toUri -import eu.kanade.domain.download.service.DownloadPreferences import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.core.Constants import eu.kanade.tachiyomi.data.backup.BackupRestoreService @@ -17,8 +16,6 @@ import eu.kanade.tachiyomi.data.download.manga.MangaDownloadManager import eu.kanade.tachiyomi.data.library.anime.AnimeLibraryUpdateJob import eu.kanade.tachiyomi.data.library.manga.MangaLibraryUpdateJob import eu.kanade.tachiyomi.data.updater.AppUpdateService -import eu.kanade.tachiyomi.source.anime.AnimeSourceManager -import eu.kanade.tachiyomi.source.manga.MangaSourceManager import eu.kanade.tachiyomi.ui.main.MainActivity import eu.kanade.tachiyomi.ui.player.PlayerActivity import eu.kanade.tachiyomi.ui.reader.ReaderActivity @@ -30,6 +27,7 @@ import eu.kanade.tachiyomi.util.system.toShareIntent import eu.kanade.tachiyomi.util.system.toast import kotlinx.coroutines.runBlocking import tachiyomi.core.util.lang.launchIO +import tachiyomi.domain.download.service.DownloadPreferences import tachiyomi.domain.entries.anime.interactor.GetAnime import tachiyomi.domain.entries.anime.model.Anime import tachiyomi.domain.entries.manga.interactor.GetManga @@ -42,6 +40,8 @@ import tachiyomi.domain.items.episode.interactor.GetEpisode import tachiyomi.domain.items.episode.interactor.UpdateEpisode import tachiyomi.domain.items.episode.model.Episode import tachiyomi.domain.items.episode.model.toEpisodeUpdate +import tachiyomi.domain.source.anime.service.AnimeSourceManager +import tachiyomi.domain.source.manga.service.MangaSourceManager 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/source/anime/AnimeSourceManager.kt b/app/src/main/java/eu/kanade/tachiyomi/source/anime/AndroidAnimeSourceManager.kt similarity index 66% rename from app/src/main/java/eu/kanade/tachiyomi/source/anime/AnimeSourceManager.kt rename to app/src/main/java/eu/kanade/tachiyomi/source/anime/AndroidAnimeSourceManager.kt index e8e6828bc..ebcdb44ed 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/source/anime/AnimeSourceManager.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/source/anime/AndroidAnimeSourceManager.kt @@ -1,12 +1,8 @@ package eu.kanade.tachiyomi.source.anime import android.content.Context -import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.animesource.AnimeCatalogueSource import eu.kanade.tachiyomi.animesource.AnimeSource -import eu.kanade.tachiyomi.animesource.model.SAnime -import eu.kanade.tachiyomi.animesource.model.SEpisode -import eu.kanade.tachiyomi.animesource.model.Video import eu.kanade.tachiyomi.animesource.online.AnimeHttpSource import eu.kanade.tachiyomi.data.download.anime.AnimeDownloadManager import eu.kanade.tachiyomi.extension.anime.AnimeExtensionManager @@ -20,18 +16,20 @@ import kotlinx.coroutines.flow.map import kotlinx.coroutines.launch import kotlinx.coroutines.runBlocking import tachiyomi.domain.source.anime.model.AnimeSourceData +import tachiyomi.domain.source.anime.model.StubAnimeSource import tachiyomi.domain.source.anime.repository.AnimeSourceDataRepository +import tachiyomi.domain.source.anime.service.AnimeSourceManager import tachiyomi.source.local.entries.anime.LocalAnimeSource import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get import uy.kohesive.injekt.injectLazy import java.util.concurrent.ConcurrentHashMap -class AnimeSourceManager( +class AndroidAnimeSourceManager( private val context: Context, private val extensionManager: AnimeExtensionManager, private val sourceRepository: AnimeSourceDataRepository, -) { +) : AnimeSourceManager { private val downloadManager: AnimeDownloadManager by injectLazy() private val scope = CoroutineScope(Job() + Dispatchers.IO) @@ -40,8 +38,7 @@ class AnimeSourceManager( private val stubSourcesMap = ConcurrentHashMap() - val catalogueSources: Flow> = sourcesMapFlow.map { it.values.filterIsInstance() } - val onlineSources: Flow> = catalogueSources.map { it.filterIsInstance() } + override val catalogueSources: Flow> = sourcesMapFlow.map { it.values.filterIsInstance() } init { scope.launch { @@ -77,21 +74,21 @@ class AnimeSourceManager( } } - fun get(sourceKey: Long): AnimeSource? { + override fun get(sourceKey: Long): AnimeSource? { return sourcesMapFlow.value[sourceKey] } - fun getOrStub(sourceKey: Long): AnimeSource { + override fun getOrStub(sourceKey: Long): AnimeSource { return sourcesMapFlow.value[sourceKey] ?: stubSourcesMap.getOrPut(sourceKey) { runBlocking { createStubSource(sourceKey) } } } - fun getOnlineSources() = sourcesMapFlow.value.values.filterIsInstance() + override fun getOnlineSources() = sourcesMapFlow.value.values.filterIsInstance() - fun getCatalogueSources() = sourcesMapFlow.value.values.filterIsInstance() + override fun getCatalogueSources() = sourcesMapFlow.value.values.filterIsInstance() - fun getStubSources(): List { + override fun getStubSources(): List { val onlineSourceIds = getOnlineSources().map { it.id } return stubSourcesMap.values.filterNot { it.id in onlineSourceIds } } @@ -117,37 +114,4 @@ class AnimeSourceManager( } return StubAnimeSource(AnimeSourceData(id, "", "")) } - - @Suppress("OverridingDeprecatedMember") - inner class StubAnimeSource(private val sourceData: AnimeSourceData) : AnimeSource { - - override val id: Long = sourceData.id - - override val name: String = sourceData.name.ifBlank { id.toString() } - - override val lang: String = sourceData.lang - - override suspend fun getAnimeDetails(anime: SAnime): SAnime { - throw getSourceNotInstalledException() - } - - override suspend fun getEpisodeList(anime: SAnime): List { - throw getSourceNotInstalledException() - } - - override suspend fun getVideoList(episode: SEpisode): List