Make DownloadManager the sole entry point for DownloadService (#9140)

* Rename functions for DownloadService internal use

* Call DownloadService.start via DownloadManager

* Inline DownloadService.stop into pauseDownloads

* Inline DownloadService.stop into clearQueue

NotificationReceiver will now also stop the DownloadService when
receiving ACTION_CLEAR_DOWNLOADS.

* Provide DownloadService.isRunning via DownloadManager
This commit is contained in:
Two-Ai
2023-02-24 22:07:30 -05:00
committed by GitHub
parent 7ec87e76db
commit 86b9262a7e
9 changed files with 34 additions and 44 deletions
@@ -18,7 +18,6 @@ import eu.kanade.presentation.manga.components.ChapterDownloadAction
import eu.kanade.presentation.updates.UpdatesUiModel
import eu.kanade.tachiyomi.data.download.DownloadCache
import eu.kanade.tachiyomi.data.download.DownloadManager
import eu.kanade.tachiyomi.data.download.DownloadService
import eu.kanade.tachiyomi.data.download.model.Download
import eu.kanade.tachiyomi.data.library.LibraryUpdateJob
import eu.kanade.tachiyomi.source.SourceManager
@@ -168,7 +167,7 @@ class UpdatesScreenModel(
ChapterDownloadAction.START -> {
downloadChapters(items)
if (items.any { it.downloadStateProvider() == Download.State.ERROR }) {
DownloadService.start(Injekt.get<Application>())
downloadManager.startDownloads()
}
}
ChapterDownloadAction.START_NOW -> {