Change cover memory key (#7276)

Use different key for custom cover and add last modified time for updating
cover without clearing the whole memory cache
This commit is contained in:
Ivan Iskandar
2022-06-10 20:33:59 +07:00
committed by GitHub
parent 20c14a0a00
commit 59837bbb90
8 changed files with 42 additions and 36 deletions

View File

@@ -316,12 +316,11 @@ class MangaPresenter(
LocalSource.updateCover(context, manga, it)
manga.updateCoverLastModified(db)
db.insertManga(manga).executeAsBlocking()
coverCache.clearMemoryCache()
} else if (manga.favorite) {
coverCache.setCustomCoverToCache(manga, it)
manga.updateCoverLastModified(db)
coverCache.clearMemoryCache()
}
true
}
}
.subscribeOn(Schedulers.io())
@@ -337,7 +336,6 @@ class MangaPresenter(
.fromCallable {
coverCache.deleteCustomCover(manga.id)
manga.updateCoverLastModified(db)
coverCache.clearMemoryCache()
}
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())

View File

@@ -704,13 +704,11 @@ class ReaderPresenter(
val context = Injekt.get<Application>()
LocalSource.updateCover(context, manga, it)
manga.updateCoverLastModified(db)
coverCache.clearMemoryCache()
SetAsCoverResult.Success
} else {
if (manga.favorite) {
coverCache.setCustomCoverToCache(manga, it)
manga.updateCoverLastModified(db)
coverCache.clearMemoryCache()
SetAsCoverResult.Success
} else {
SetAsCoverResult.AddToLibraryFirst