From 718947522e3f27e9af0e621122c0559184c047a7 Mon Sep 17 00:00:00 2001 From: advplyr Date: Fri, 6 May 2022 19:45:07 -0500 Subject: [PATCH] Fix:Remove download notifications after download item finished #161 --- .../java/com/audiobookshelf/app/plugins/AbsDownloader.kt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/android/app/src/main/java/com/audiobookshelf/app/plugins/AbsDownloader.kt b/android/app/src/main/java/com/audiobookshelf/app/plugins/AbsDownloader.kt index b242e2a5..e90f3641 100644 --- a/android/app/src/main/java/com/audiobookshelf/app/plugins/AbsDownloader.kt +++ b/android/app/src/main/java/com/audiobookshelf/app/plugins/AbsDownloader.kt @@ -325,6 +325,13 @@ class AbsDownloader : Plugin() { delay(500) } + // Remove download notifications + downloadItem.downloadItemParts.forEach { downloadItemPart -> + downloadItemPart.downloadId?.let { + downloadManager.remove(it) + } + } + val downloadItemScanResult = folderScanner.scanDownloadItem(downloadItem) DeviceManager.dbManager.removeDownloadItem(downloadItem.id) downloadQueue.remove(downloadItem) @@ -367,6 +374,7 @@ class AbsDownloader : Plugin() { if (!downloadItemPart.completed) { Log.d(tag, "checkDownloads Download ${downloadItemPart.filename} Done") downloadItemPart.completed = true + val file = DocumentFileCompat.fromUri(mainActivity, downloadItemPart.destinationUri) Log.d(tag, "DOWNLOAD: Attempt move for file at destination ${downloadItemPart.destinationUri} | ${file?.getBasePath(mainActivity)}")