From 1e239faf03a2f8fccf4fc452aec7100923b50b6d Mon Sep 17 00:00:00 2001 From: Bnyro Date: Wed, 8 Feb 2023 09:58:49 +0100 Subject: [PATCH] Fix that thumbnails persist after deleting a download --- .../github/libretube/ui/adapters/DownloadsAdapter.kt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/github/libretube/ui/adapters/DownloadsAdapter.kt b/app/src/main/java/com/github/libretube/ui/adapters/DownloadsAdapter.kt index 59d0a673d..cba95ab55 100644 --- a/app/src/main/java/com/github/libretube/ui/adapters/DownloadsAdapter.kt +++ b/app/src/main/java/com/github/libretube/ui/adapters/DownloadsAdapter.kt @@ -95,10 +95,13 @@ class DownloadsAdapter( .setMessage(R.string.irreversible) .setPositiveButton(R.string.okay) { _, _ -> items.map { File(it.path) }.forEach { file -> - if (file.exists()) { - try { - file.delete() - } catch (_: Exception) { } + runCatching { + if (file.exists()) file.delete() + } + } + runCatching { + download.thumbnailPath?.let { + File(it).delete() } }