Fix startForeground for DownloadService

This commit is contained in:
Koitharu
2022-04-16 09:19:10 +03:00
parent 5e82c75893
commit d37eb07301

View File

@@ -24,7 +24,7 @@ class ForegroundNotificationSwitcher(
@Synchronized
fun notify(startId: Int, notification: Notification) {
if (notifications.isEmpty()) {
StartForegroundRunnable(startId, notification)
service.startForeground(startId, notification)
} else {
notificationManager.notify(startId, notification)
}
@@ -46,16 +46,6 @@ class ForegroundNotificationSwitcher(
handler.postDelayed(NotifyRunnable(startId, notification), DEFAULT_DELAY)
}
private inner class StartForegroundRunnable(
private val startId: Int,
private val notification: Notification,
) : Runnable {
override fun run() {
service.startForeground(startId, notification)
}
}
private inner class NotifyRunnable(
private val startId: Int,
private val notification: Notification?,