mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 16:11:51 +01:00
fix download cache performance issue (#537)
* fix download cache performance issue * adjust based of arkons suggestion * launch the create in a scope to cut the faster loading time a little more
This commit is contained in:
parent
1e9b9dabe3
commit
718165a58e
@ -75,11 +75,9 @@ class DownloadCache(
|
|||||||
|
|
||||||
checkRenew()
|
checkRenew()
|
||||||
|
|
||||||
val files = mangaFiles[manga.id]?.toSet() ?: return false
|
val files = mangaFiles[manga.id]?.toHashSet() ?: return false
|
||||||
return files.any { file ->
|
return provider.getValidChapterDirNames(chapter).any {
|
||||||
provider.getValidChapterDirNames(chapter).any {
|
it in files
|
||||||
it.toLowerCase() == file.toLowerCase()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,25 +82,32 @@ class MangaDetailsPresenter(
|
|||||||
var headerItem = MangaHeaderItem(manga, controller.fromCatalogue)
|
var headerItem = MangaHeaderItem(manga, controller.fromCatalogue)
|
||||||
|
|
||||||
fun onCreate() {
|
fun onCreate() {
|
||||||
|
scope.launch {
|
||||||
isLockedFromSearch = SecureActivityDelegate.shouldBeLocked()
|
withContext(Dispatchers.IO) {
|
||||||
headerItem.isLocked = isLockedFromSearch
|
isLockedFromSearch = SecureActivityDelegate.shouldBeLocked()
|
||||||
downloadManager.addListener(this)
|
headerItem.isLocked = isLockedFromSearch
|
||||||
LibraryUpdateService.setListener(this)
|
downloadManager.addListener(this@MangaDetailsPresenter)
|
||||||
tracks = db.getTracks(manga).executeAsBlocking()
|
LibraryUpdateService.setListener(this@MangaDetailsPresenter)
|
||||||
if (manga.source == LocalSource.ID) {
|
tracks = db.getTracks(manga).executeAsBlocking()
|
||||||
refreshAll()
|
if (manga.source == LocalSource.ID) {
|
||||||
} else if (!manga.initialized) {
|
refreshAll()
|
||||||
isLoading = true
|
} else if (!manga.initialized) {
|
||||||
controller.setRefresh(true)
|
isLoading = true
|
||||||
controller.updateHeader()
|
withContext(Dispatchers.Main) {
|
||||||
refreshAll()
|
controller.setRefresh(true)
|
||||||
} else {
|
controller.updateHeader()
|
||||||
updateChapters()
|
}
|
||||||
controller.updateChapters(this.chapters)
|
refreshAll()
|
||||||
|
} else {
|
||||||
|
updateChapters()
|
||||||
|
withContext(Dispatchers.Main) {
|
||||||
|
controller.updateChapters(this@MangaDetailsPresenter.chapters)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setTrackItems()
|
||||||
|
refreshTracking(false)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
setTrackItems()
|
|
||||||
refreshTracking(false)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onDestroy() {
|
fun onDestroy() {
|
||||||
|
Loading…
Reference in New Issue
Block a user