Allow download ahead even if entry isn't favorited

(cherry picked from commit f8cf3db4a456462a80ecc252e8655f6b5c66c4d4)
This commit is contained in:
arkon
2023-07-08 17:46:48 -04:00
committed by Jobobby04
parent 8d300e3efd
commit af5c4f8a61
2 changed files with 4 additions and 4 deletions
@@ -261,6 +261,7 @@ class ReaderViewModel(
}
private val incognitoMode = preferences.incognitoMode().get()
private val downloadAheadAmount = downloadPreferences.autoDownloadWhileReading().get()
init {
// To save state
@@ -561,9 +562,8 @@ class ReaderViewModel(
}
private fun downloadNextChapters() {
if (downloadAheadAmount == 0) return
val manga = manga ?: return
val amount = downloadPreferences.autoDownloadWhileReading().get()
if (amount == 0 || !manga.favorite) return
// Only download ahead if current + next chapter is already downloaded too to avoid jank
if (getCurrentChapter()?.pageLoader?.isLocal == true) return
@@ -585,7 +585,7 @@ class ReaderViewModel(
} else {
this
}
}.take(amount)
}.take(downloadAheadAmount)
downloadManager.downloadChapters(
manga,