mirror of
https://github.com/mihonapp/mihon.git
synced 2024-12-04 09:14:09 -05:00
performance improvements
This commit is contained in:
parent
f373c9acca
commit
061e6a4c17
1 changed files with 2 additions and 3 deletions
|
@ -134,15 +134,14 @@ actual class LocalSource(
|
||||||
|
|
||||||
private fun loadMangaForPage(page: Int) {
|
private fun loadMangaForPage(page: Int) {
|
||||||
if (page != loadedPages + 1 || page == currentlyLoadingPage) return
|
if (page != loadedPages + 1 || page == currentlyLoadingPage) return
|
||||||
|
|
||||||
currentlyLoadingPage = loadedPages + 1
|
currentlyLoadingPage = loadedPages + 1
|
||||||
|
|
||||||
|
val localMangaList = runBlocking { getMangaList() }
|
||||||
val mangaPage = mangaDirChunks[page - 1].map { mangaDir ->
|
val mangaPage = mangaDirChunks[page - 1].map { mangaDir ->
|
||||||
SManga.create().apply manga@{
|
SManga.create().apply manga@{
|
||||||
url = mangaDir.name.toString()
|
url = mangaDir.name.toString()
|
||||||
dirLastModifiedAt = mangaDir.lastModified()
|
dirLastModifiedAt = mangaDir.lastModified()
|
||||||
|
|
||||||
val localMangaList = runBlocking { getMangaList() }
|
|
||||||
mangaDir.name?.let { title = localMangaList[url]?.title ?: it }
|
mangaDir.name?.let { title = localMangaList[url]?.title ?: it }
|
||||||
author = localMangaList[url]?.author
|
author = localMangaList[url]?.author
|
||||||
artist = localMangaList[url]?.artist
|
artist = localMangaList[url]?.artist
|
||||||
|
@ -162,7 +161,7 @@ actual class LocalSource(
|
||||||
val chapter = chapters.last()
|
val chapter = chapters.last()
|
||||||
|
|
||||||
// only read metadata from disk if it the mangaDir has been modified
|
// only read metadata from disk if it the mangaDir has been modified
|
||||||
if (dirLastModifiedAt != localMangaList[url]?.lastModifiedAt) {
|
if (dirLastModifiedAt != localMangaList[url]?.dirLastModifiedAt) {
|
||||||
when (val format = getFormat(chapter)) {
|
when (val format = getFormat(chapter)) {
|
||||||
is Format.Directory -> getMangaDetails(this@manga)
|
is Format.Directory -> getMangaDetails(this@manga)
|
||||||
is Format.Zip -> getMangaDetails(this@manga)
|
is Format.Zip -> getMangaDetails(this@manga)
|
||||||
|
|
Loading…
Reference in a new issue