Update download every 5% progress to avoid noise

This commit is contained in:
Rahul Patel
2024-06-25 23:04:23 +05:30
parent 8857353029
commit 18dd3480cf

View File

@@ -294,6 +294,9 @@ class DownloadWorker @AssistedInject constructor(
this.speed = downloadInfo.speed this.speed = downloadInfo.speed
this.timeRemaining = bytesRemaining / speed * 1000 this.timeRemaining = bytesRemaining / speed * 1000
} }
// Update progress every 5% to avoid noise
if (totalProgress % 5 == 0) {
downloadDao.updateProgress( downloadDao.updateProgress(
download.packageName, download.packageName,
download.progress, download.progress,
@@ -302,6 +305,8 @@ class DownloadWorker @AssistedInject constructor(
) )
notifyStatus(DownloadStatus.DOWNLOADING, NOTIFICATION_ID) notifyStatus(DownloadStatus.DOWNLOADING, NOTIFICATION_ID)
}
totalProgress = progress totalProgress = progress
} }
} }