mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 15:41:52 +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()
|
||||
|
||||
val files = mangaFiles[manga.id]?.toSet() ?: return false
|
||||
return files.any { file ->
|
||||
provider.getValidChapterDirNames(chapter).any {
|
||||
it.toLowerCase() == file.toLowerCase()
|
||||
}
|
||||
val files = mangaFiles[manga.id]?.toHashSet() ?: return false
|
||||
return provider.getValidChapterDirNames(chapter).any {
|
||||
it in files
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,25 +82,32 @@ class MangaDetailsPresenter(
|
||||
var headerItem = MangaHeaderItem(manga, controller.fromCatalogue)
|
||||
|
||||
fun onCreate() {
|
||||
|
||||
isLockedFromSearch = SecureActivityDelegate.shouldBeLocked()
|
||||
headerItem.isLocked = isLockedFromSearch
|
||||
downloadManager.addListener(this)
|
||||
LibraryUpdateService.setListener(this)
|
||||
tracks = db.getTracks(manga).executeAsBlocking()
|
||||
if (manga.source == LocalSource.ID) {
|
||||
refreshAll()
|
||||
} else if (!manga.initialized) {
|
||||
isLoading = true
|
||||
controller.setRefresh(true)
|
||||
controller.updateHeader()
|
||||
refreshAll()
|
||||
} else {
|
||||
updateChapters()
|
||||
controller.updateChapters(this.chapters)
|
||||
scope.launch {
|
||||
withContext(Dispatchers.IO) {
|
||||
isLockedFromSearch = SecureActivityDelegate.shouldBeLocked()
|
||||
headerItem.isLocked = isLockedFromSearch
|
||||
downloadManager.addListener(this@MangaDetailsPresenter)
|
||||
LibraryUpdateService.setListener(this@MangaDetailsPresenter)
|
||||
tracks = db.getTracks(manga).executeAsBlocking()
|
||||
if (manga.source == LocalSource.ID) {
|
||||
refreshAll()
|
||||
} else if (!manga.initialized) {
|
||||
isLoading = true
|
||||
withContext(Dispatchers.Main) {
|
||||
controller.setRefresh(true)
|
||||
controller.updateHeader()
|
||||
}
|
||||
refreshAll()
|
||||
} else {
|
||||
updateChapters()
|
||||
withContext(Dispatchers.Main) {
|
||||
controller.updateChapters(this@MangaDetailsPresenter.chapters)
|
||||
}
|
||||
}
|
||||
setTrackItems()
|
||||
refreshTracking(false)
|
||||
}
|
||||
}
|
||||
setTrackItems()
|
||||
refreshTracking(false)
|
||||
}
|
||||
|
||||
fun onDestroy() {
|
||||
|
Loading…
Reference in New Issue
Block a user