mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-28 16:00:31 +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) {
|
||||
downloadQueue.remove(item.id, false)
|
||||
return
|
||||
}
|
||||
|
||||
val completed = when {
|
||||
totalRead < item.downloadSize -> {
|
||||
val completed = totalRead < item.downloadSize
|
||||
if (completed) {
|
||||
_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)
|
||||
pause(item.id)
|
||||
|
||||
if (_downloadFlow.firstOrNull { it.first == item.id }?.second == DownloadStatus.Stopped) {
|
||||
downloadQueue.remove(item.id, false)
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun startConnection(
|
||||
|
Loading…
x
Reference in New Issue
Block a user