From 83a4e3409536a9264cf9074cf64480ee43fb5274 Mon Sep 17 00:00:00 2001 From: Two-Ai <81279822+Two-Ai@users.noreply.github.com> Date: Fri, 24 Feb 2023 15:11:51 -0500 Subject: [PATCH] Remove redundant Downloader isNotification argument (#9139) DownloadQueue.clear() already sets QUEUE downloads to NOT_DOWNLOADED. --- .../kanade/tachiyomi/data/download/DownloadManager.kt | 6 ++---- .../eu/kanade/tachiyomi/data/download/Downloader.kt | 10 +--------- .../data/notification/NotificationReceiver.kt | 2 +- 3 files changed, 4 insertions(+), 14 deletions(-) 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 0e9bdfcbf9..f0235ab3b7 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 @@ -75,11 +75,9 @@ class DownloadManager( /** * Empties the download queue. - * - * @param isNotification value that determines if status is set (needed for view updates) */ - fun clearQueue(isNotification: Boolean = false) { - downloader.clearQueue(isNotification) + fun clearQueue() { + downloader.clearQueue() } /** 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 406c4e857a..51ee2277da 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 @@ -185,18 +185,10 @@ class Downloader( /** * Removes everything from the queue. - * - * @param isNotification value that determines if status is set (needed for view updates) */ - fun clearQueue(isNotification: Boolean = false) { + fun clearQueue() { destroySubscriptions() - // Needed to update the chapter view - if (isNotification) { - queue - .filter { it.status == Download.State.QUEUE } - .forEach { it.status = Download.State.NOT_DOWNLOADED } - } queue.clear() notifier.dismissProgress() } 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 53b612e633..335d483daf 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 @@ -63,7 +63,7 @@ class NotificationReceiver : BroadcastReceiver() { downloadManager.pauseDownloads() } // Clear the download queue - ACTION_CLEAR_DOWNLOADS -> downloadManager.clearQueue(true) + ACTION_CLEAR_DOWNLOADS -> downloadManager.clearQueue() // Launch share activity and dismiss notification ACTION_SHARE_IMAGE -> shareImage(