We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2471573 commit ad2539cCopy full SHA for ad2539c
1 file changed
app/src/main/java/com/github/libretube/services/DownloadService.kt
@@ -227,11 +227,17 @@ class DownloadService : LifecycleService() {
227
228
downloadQueue[item.id] = false
229
230
- if (_downloadFlow.firstOrNull { it.first == item.id }?.second == DownloadStatus.Stopped) {
+ if (downloadFlow.firstOrNull { it.first == item.id }?.second == DownloadStatus.Stopped) {
231
downloadQueue.remove(item.id, false)
232
}
233
234
- stopServiceIfDone()
+ // start the next download if there are any remaining ones enqueued
235
+ val nextDownload = downloadFlow.firstOrNull { (_, status) -> status == DownloadStatus.Paused }
236
+ if (nextDownload != null) {
237
+ resume(nextDownload.first)
238
+ } else {
239
+ stopServiceIfDone()
240
+ }
241
242
243
private suspend fun progressDownload(
0 commit comments