File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
app/src/main/java/com/github/libretube/services Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -227,11 +227,17 @@ class DownloadService : LifecycleService() {
227227
228228 downloadQueue[item.id] = false
229229
230- if (_downloadFlow .firstOrNull { it.first == item.id }?.second == DownloadStatus .Stopped ) {
230+ if (downloadFlow .firstOrNull { it.first == item.id }?.second == DownloadStatus .Stopped ) {
231231 downloadQueue.remove(item.id, false )
232232 }
233233
234- stopServiceIfDone()
234+ // 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+ }
235241 }
236242
237243 private suspend fun progressDownload (
You can’t perform that action at this time.
0 commit comments