mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-29 00:10:32 +05:30
fix: download success notification
This commit is contained in:
parent
eb386fdcdb
commit
f65af00d4c
@ -236,24 +236,19 @@ class DownloadService : LifecycleService() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_downloadFlow.firstOrNull { it.first == item.id }?.second == DownloadStatus.Stopped) {
|
val completed = totalRead < item.downloadSize
|
||||||
downloadQueue.remove(item.id, false)
|
if (completed) {
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
val completed = when {
|
|
||||||
totalRead < item.downloadSize -> {
|
|
||||||
_downloadFlow.emit(item.id to DownloadStatus.Paused)
|
_downloadFlow.emit(item.id to DownloadStatus.Paused)
|
||||||
false
|
} else {
|
||||||
|
_downloadFlow.emit(item.id to DownloadStatus.Completed)
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
|
||||||
_downloadFlow.emit(item.id to DownloadStatus.Completed)
|
|
||||||
true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
setPauseNotification(notificationBuilder, item, completed)
|
setPauseNotification(notificationBuilder, item, completed)
|
||||||
pause(item.id)
|
pause(item.id)
|
||||||
|
|
||||||
|
if (_downloadFlow.firstOrNull { it.first == item.id }?.second == DownloadStatus.Stopped) {
|
||||||
|
downloadQueue.remove(item.id, false)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun startConnection(
|
private suspend fun startConnection(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user