Clean up download ahead logic
- Remove redundant chapter sorting logic when fetching next chapter(s) - Remove redundant download queue checks (it'll handle already queued or downloaded items) - Trigger download ahead when read >= 25% of chapter rather than 20% - Rely on download cache when checking if next chapter is downloaded to avoid jank (fixes #8328)
This commit is contained in:
@@ -11,7 +11,7 @@ class NetworkToLocalManga(
|
||||
val localManga = getManga(manga.url, sourceId)
|
||||
return when {
|
||||
localManga == null -> {
|
||||
val id = insertManga(manga.copy(source = sourceId))
|
||||
val id = insertManga(manga, sourceId)
|
||||
manga.copy(id = id!!)
|
||||
}
|
||||
!localManga.favorite -> {
|
||||
@@ -29,7 +29,7 @@ class NetworkToLocalManga(
|
||||
return mangaRepository.getMangaByUrlAndSourceId(url, sourceId)
|
||||
}
|
||||
|
||||
private suspend fun insertManga(manga: Manga): Long? {
|
||||
return mangaRepository.insert(manga)
|
||||
private suspend fun insertManga(manga: Manga, sourceId: Long): Long? {
|
||||
return mangaRepository.insert(manga.copy(source = sourceId))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user