From a629b066f4184a4f24bf58f0d48bf405a2393e17 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Sat, 10 Dec 2022 13:03:47 +0100 Subject: [PATCH] fix download notifications --- .../github/libretube/services/DownloadService.kt | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/com/github/libretube/services/DownloadService.kt b/app/src/main/java/com/github/libretube/services/DownloadService.kt index ede6e3667..a640f8672 100644 --- a/app/src/main/java/com/github/libretube/services/DownloadService.kt +++ b/app/src/main/java/com/github/libretube/services/DownloadService.kt @@ -102,15 +102,12 @@ class DownloadService : Service() { override fun onReceive(context: Context, intent: Intent) { // Fetching the download id received with the broadcast // Checking if the received broadcast is for our enqueued download by matching download id - when ( - intent.getLongExtra( - DownloadManager.EXTRA_DOWNLOAD_ID, - -1 - ) - ) { - videoDownloadId -> videoDownloadId = null - audioDownloadId -> audioDownloadId = null - } + val downloadId = intent.getLongExtra( + DownloadManager.EXTRA_DOWNLOAD_ID, + -1 + ) + if (downloadId == audioDownloadId) audioDownloadId = null + else if (downloadId == videoDownloadId) videoDownloadId = null if (audioDownloadId != null || videoDownloadId != null) return