Improve player service dismiss logic

This commit is contained in:
vfsfitvnm
2022-09-06 18:02:06 +02:00
parent 4014675766
commit 996dbb4de1
2 changed files with 7 additions and 4 deletions

View File

@@ -450,14 +450,16 @@ class PlayerService : InvincibleService(), Player.Listener, PlaybackStatsListene
if (notification == null) {
isNotificationStarted = false
makeInvincible(false)
stopForeground(true)
stopForeground(false)
sendCloseEqualizerIntent()
notificationManager?.cancel(NotificationId)
return
}
if (player.shouldBePlaying && !isNotificationStarted) {
isNotificationStarted = true
startForegroundService(this@PlayerService, intent<PlayerService>())
startForeground(NotificationId, notification())
startForeground(NotificationId, notification)
makeInvincible(false)
sendOpenEqualizerIntent()
} else {