mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-10 12:47:26 +01:00
Fix download queue page count display bug (#9126)
When restarting a download, the page count would display as 0 until
the first page download completion, after all the existing pages were
rechecked.
To fix, calculate downloadedImages from pages instead of relying on
the downloader to reset and increment the count.
(cherry picked from commit 779df32e98
)
This commit is contained in:
parent
4498b10a10
commit
08e6487a9a
@ -339,7 +339,6 @@ class Downloader(
|
|||||||
?.filter { it.name!!.endsWith(".tmp") }
|
?.filter { it.name!!.endsWith(".tmp") }
|
||||||
?.forEach { it.delete() }
|
?.forEach { it.delete() }
|
||||||
|
|
||||||
download.downloadedImages = 0
|
|
||||||
download.status = Download.State.DOWNLOADING
|
download.status = Download.State.DOWNLOADING
|
||||||
}
|
}
|
||||||
// Get all the URLs to the source images, fetch pages if necessary
|
// Get all the URLs to the source images, fetch pages if necessary
|
||||||
@ -403,7 +402,6 @@ class Downloader(
|
|||||||
}
|
}
|
||||||
page.uri = file.uri
|
page.uri = file.uri
|
||||||
page.progress = 100
|
page.progress = 100
|
||||||
download.downloadedImages++
|
|
||||||
page.status = Page.State.READY
|
page.status = Page.State.READY
|
||||||
}
|
}
|
||||||
.map { page }
|
.map { page }
|
||||||
|
@ -21,9 +21,8 @@ data class Download(
|
|||||||
val totalProgress: Int
|
val totalProgress: Int
|
||||||
get() = pages?.sumOf(Page::progress) ?: 0
|
get() = pages?.sumOf(Page::progress) ?: 0
|
||||||
|
|
||||||
@Volatile
|
val downloadedImages: Int
|
||||||
@Transient
|
get() = pages?.count { it.status == Page.State.READY } ?: 0
|
||||||
var downloadedImages: Int = 0
|
|
||||||
|
|
||||||
@Volatile
|
@Volatile
|
||||||
@Transient
|
@Transient
|
||||||
|
Loading…
Reference in New Issue
Block a user