diff --git a/app/src/main/java/com/aurora/store/data/work/DownloadWorker.kt b/app/src/main/java/com/aurora/store/data/work/DownloadWorker.kt index b4766abc3..30950dc3a 100644 --- a/app/src/main/java/com/aurora/store/data/work/DownloadWorker.kt +++ b/app/src/main/java/com/aurora/store/data/work/DownloadWorker.kt @@ -285,13 +285,12 @@ class DownloadWorker @AssistedInject constructor( private suspend fun onProgress(downloadInfo: DownloadInfo) { if (!isStopped && !download.isFinished) { val progress = ((downloadedBytes + downloadInfo.bytesCopied) * 100 / totalBytes).toInt() + val bytesRemaining = totalBytes - (downloadedBytes + downloadInfo.bytesCopied) + val speed = if (downloadInfo.speed == 0L) 1 else downloadInfo.speed // Individual file progress can be negligible in contrast to total progress - // Only notify the UI if progress is greater to avoid being rate-limited by Android - if (progress > totalProgress) { - val bytesRemaining = totalBytes - (downloadedBytes + downloadInfo.bytesCopied) - val speed = if (downloadInfo.speed == 0L) 1 else downloadInfo.speed - + // Only notify the UI if progress is greater or speed has changed to avoid being rate-limited by Android + if (progress > totalProgress || speed != download.speed) { if (downloadInfo.progress == 100) { downloadedBytes += downloadInfo.bytesCopied }