Fix refreshing in manga details not fixing corrupt covers

This commit is contained in:
Jays2Kings 2021-05-09 18:45:55 -04:00
parent 59f27c494d
commit dcf3f56a05
2 changed files with 4 additions and 1 deletions

View File

@ -232,7 +232,7 @@ class CoverCache(val context: Context) {
val file = getCoverFile(manga) val file = getCoverFile(manga)
if (deleteCustom) deleteCustomCover(manga) if (deleteCustom) deleteCustomCover(manga)
if (file.exists()) { if (file.exists()) {
context.imageLoader.memoryCache.remove(MemoryCache.Key(file.name)) context.imageLoader.memoryCache.remove(MemoryCache.Key(manga.key()))
file.delete() file.delete()
} }
} }

View File

@ -5,6 +5,8 @@ import android.graphics.Bitmap
import android.net.Uri import android.net.Uri
import android.os.Environment import android.os.Environment
import coil.Coil import coil.Coil
import coil.imageLoader
import coil.memory.MemoryCache
import coil.request.CachePolicy import coil.request.CachePolicy
import coil.request.ImageRequest import coil.request.ImageRequest
import coil.request.Parameters import coil.request.Parameters
@ -370,6 +372,7 @@ class MangaDetailsPresenter(
.build() .build()
if (Coil.imageLoader(preferences.context).execute(request) is SuccessResult) { if (Coil.imageLoader(preferences.context).execute(request) is SuccessResult) {
preferences.context.imageLoader.memoryCache.remove(MemoryCache.Key(manga.key()))
withContext(Dispatchers.Main) { withContext(Dispatchers.Main) {
controller.setPaletteColor() controller.setPaletteColor()
} }