Setting cover in reader sets the custom cover flag

This commit is contained in:
Jay 2020-04-13 01:07:10 -04:00
parent 6533689539
commit 8d88d1a739
3 changed files with 7 additions and 4 deletions

View File

@ -690,13 +690,12 @@ class MangaDetailsController : BaseController,
menu.findItem(R.id.action_mark_all_as_read).isVisible =
presenter.getNextUnreadChapter() != null && !presenter.isLockedFromSearch
menu.findItem(R.id.action_mark_all_as_unread).isVisible =
!presenter.allUnread() && !presenter.isLockedFromSearch
presenter.anyUnread() && !presenter.isLockedFromSearch
menu.findItem(R.id.action_remove_downloads).isVisible =
presenter.hasDownloads() && !presenter.isLockedFromSearch &&
manga?.source != LocalSource.ID
menu.findItem(R.id.remove_non_bookmarked).isVisible =
presenter.hasBookmark() && !presenter.isLockedFromSearch
menu.findItem(R.id.action_mark_all_as_unread).isVisible = presenter.isTracked()
menu.findItem(R.id.action_migrate).isVisible = !presenter.isLockedFromSearch &&
manga?.source != LocalSource.ID && presenter.manga.favorite
menu.findItem(R.id.action_migrate).title = view?.context?.getString(R.string.migrate_,

View File

@ -319,7 +319,7 @@ class MangaDetailsPresenter(
return chapters.sortedByDescending { it.source_order }.find { !it.read }
}
fun allUnread(): Boolean = chapters.none { it.read }
fun anyUnread(): Boolean = chapters.any { !it.read }
fun hasBookmark(): Boolean = chapters.any { it.bookmark }
fun hasDownloads(): Boolean = chapters.any { it.isDownloaded }

View File

@ -535,7 +535,11 @@ class ReaderPresenter(
} else {
val thumbUrl = manga.thumbnail_url ?: throw Exception("Image url not found")
if (manga.favorite) {
coverCache.copyToCache(thumbUrl, stream())
if (!manga.hasCustomCover()) {
manga.thumbnail_url = "Custom-${manga.thumbnail_url ?: manga.id!!}"
db.insertManga(manga).executeAsBlocking()
}
coverCache.copyToCache(manga.thumbnail_url!!, stream())
MangaImpl.setLastCoverFetch(manga.id!!, Date().time)
SetAsCoverResult.Success
} else {