From 810d339b4e1a3172b47709b721d20f6f419d8dec Mon Sep 17 00:00:00 2001 From: FooIbar <118464521+FooIbar@users.noreply.github.com> Date: Sun, 20 Jul 2025 23:53:36 +0800 Subject: [PATCH] Fix downloading notification stuck when nothing to download --- .../hippo/ehviewer/download/DownloadManager.kt | 10 ---------- .../hippo/ehviewer/download/DownloadService.kt | 16 ++++------------ 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/app/src/main/kotlin/com/hippo/ehviewer/download/DownloadManager.kt b/app/src/main/kotlin/com/hippo/ehviewer/download/DownloadManager.kt index b7f1e4af0..70f78cb81 100644 --- a/app/src/main/kotlin/com/hippo/ehviewer/download/DownloadManager.kt +++ b/app/src/main/kotlin/com/hippo/ehviewer/download/DownloadManager.kt @@ -311,16 +311,6 @@ object DownloadManager : OnSpiderListener, CoroutineScope { } } - suspend fun stopCurrentDownload() { - val info = stopCurrentDownloadInternal() - if (info != null) { - // Update listener - mutableNotifyFlow.emit(info) - // Ensure download - ensureDownload() - } - } - suspend fun stopRangeDownload(gidList: LongArray) { stopRangeDownloadInternal(gidList) diff --git a/app/src/main/kotlin/com/hippo/ehviewer/download/DownloadService.kt b/app/src/main/kotlin/com/hippo/ehviewer/download/DownloadService.kt index 2c0fcdf06..3f4d0939a 100644 --- a/app/src/main/kotlin/com/hippo/ehviewer/download/DownloadService.kt +++ b/app/src/main/kotlin/com/hippo/ehviewer/download/DownloadService.kt @@ -117,19 +117,11 @@ class DownloadService : } } - ACTION_START_ALL -> { - deferredMgr.await().startAllDownload() - } - - ACTION_STOP_ALL -> deferredMgr.await().run { - if (isIdle) stopSelf() else stopAllDownload() - } - - ACTION_CLEAR -> { - clear() - checkStopSelf() - } + ACTION_START_ALL -> deferredMgr.await().startAllDownload() + ACTION_STOP_ALL -> deferredMgr.await().stopAllDownload() + ACTION_CLEAR -> clear() } + checkStopSelf() } override fun onBind(intent: Intent) = null