mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-06 18:57:26 +01:00
Allow download ahead even if entry isn't favorited
This commit is contained in:
parent
a585d46e7a
commit
f8cf3db4a4
@ -204,6 +204,7 @@ class ReaderViewModel(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private val incognitoMode = preferences.incognitoMode().get()
|
private val incognitoMode = preferences.incognitoMode().get()
|
||||||
|
private val downloadAheadAmount = downloadPreferences.autoDownloadWhileReading().get()
|
||||||
|
|
||||||
init {
|
init {
|
||||||
// To save state
|
// To save state
|
||||||
@ -444,9 +445,8 @@ class ReaderViewModel(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun downloadNextChapters() {
|
private fun downloadNextChapters() {
|
||||||
|
if (downloadAheadAmount == 0) return
|
||||||
val manga = manga ?: 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
|
// Only download ahead if current + next chapter is already downloaded too to avoid jank
|
||||||
if (getCurrentChapter()?.pageLoader?.isLocal == true) return
|
if (getCurrentChapter()?.pageLoader?.isLocal == true) return
|
||||||
@ -466,7 +466,7 @@ class ReaderViewModel(
|
|||||||
} else {
|
} else {
|
||||||
this
|
this
|
||||||
}
|
}
|
||||||
}.take(amount)
|
}.take(downloadAheadAmount)
|
||||||
|
|
||||||
downloadManager.downloadChapters(
|
downloadManager.downloadChapters(
|
||||||
manga,
|
manga,
|
||||||
|
@ -470,7 +470,7 @@
|
|||||||
<item quantity="one">Next unread chapter</item>
|
<item quantity="one">Next unread chapter</item>
|
||||||
<item quantity="other">Next %d unread chapters</item>
|
<item quantity="other">Next %d unread chapters</item>
|
||||||
</plurals>
|
</plurals>
|
||||||
<string name="download_ahead_info">Only works on entries in library and if the current chapter plus the next one are already downloaded</string>
|
<string name="download_ahead_info">Only works if the current chapter + the next one are already downloaded.</string>
|
||||||
<string name="save_chapter_as_cbz">Save as CBZ archive</string>
|
<string name="save_chapter_as_cbz">Save as CBZ archive</string>
|
||||||
<string name="split_tall_images">Split tall images</string>
|
<string name="split_tall_images">Split tall images</string>
|
||||||
<string name="split_tall_images_summary">Improves reader performance</string>
|
<string name="split_tall_images_summary">Improves reader performance</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user