Skip to content

Commit

Permalink
Merge pull request #4860 from Bnyro/master
Browse files Browse the repository at this point in the history
fix: buggy icon to pause download
  • Loading branch information
Bnyro authored Sep 26, 2023
2 parents 16c6c69 + 02bac31 commit 3845e94
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -245,11 +245,14 @@ class DownloadService : LifecycleService() {
}

setPauseNotification(notificationBuilder, item, completed)
pause(item.id)

downloadQueue[item.id] = false

if (_downloadFlow.firstOrNull { it.first == item.id }?.second == DownloadStatus.Stopped) {
downloadQueue.remove(item.id, false)
}

stopServiceIfDone()
}

private suspend fun startConnection(
Expand Down Expand Up @@ -331,6 +334,10 @@ class DownloadService : LifecycleService() {
fun pause(id: Int) {
downloadQueue[id] = false

lifecycleScope.launch(coroutineContext) {
_downloadFlow.emit(id to DownloadStatus.Paused)
}

stopServiceIfDone()
}

Expand Down

0 comments on commit 3845e94

Please sign in to comment.