From dcf3f56a0538d604e3a07f384292386bf84406f3 Mon Sep 17 00:00:00 2001 From: Jays2Kings Date: Sun, 9 May 2021 18:45:55 -0400 Subject: [PATCH] Fix refreshing in manga details not fixing corrupt covers --- app/src/main/java/eu/kanade/tachiyomi/data/cache/CoverCache.kt | 2 +- .../java/eu/kanade/tachiyomi/ui/manga/MangaDetailsPresenter.kt | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/cache/CoverCache.kt b/app/src/main/java/eu/kanade/tachiyomi/data/cache/CoverCache.kt index 0c1ba824ec..7214ecd940 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/cache/CoverCache.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/cache/CoverCache.kt @@ -232,7 +232,7 @@ class CoverCache(val context: Context) { val file = getCoverFile(manga) if (deleteCustom) deleteCustomCover(manga) if (file.exists()) { - context.imageLoader.memoryCache.remove(MemoryCache.Key(file.name)) + context.imageLoader.memoryCache.remove(MemoryCache.Key(manga.key())) file.delete() } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsPresenter.kt index 83af2c8074..f790f156f1 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsPresenter.kt @@ -5,6 +5,8 @@ import android.graphics.Bitmap import android.net.Uri import android.os.Environment import coil.Coil +import coil.imageLoader +import coil.memory.MemoryCache import coil.request.CachePolicy import coil.request.ImageRequest import coil.request.Parameters @@ -370,6 +372,7 @@ class MangaDetailsPresenter( .build() if (Coil.imageLoader(preferences.context).execute(request) is SuccessResult) { + preferences.context.imageLoader.memoryCache.remove(MemoryCache.Key(manga.key())) withContext(Dispatchers.Main) { controller.setPaletteColor() }