Fix notification again

This commit is contained in:
Mygod
2021-07-25 22:51:50 -04:00
parent ed09f747ce
commit 5f6e33c852

View File

@@ -62,7 +62,8 @@ object ServiceNotification {
} }
} }
fun stopForeground(service: Service) = synchronized(this) { fun stopForeground(service: Service) = synchronized(this) {
val shutdown = deviceCountsMap.remove(service) != null && deviceCountsMap.isEmpty() deviceCountsMap.remove(service) ?: return@synchronized
val shutdown = deviceCountsMap.isEmpty()
service.stopForeground(shutdown) service.stopForeground(shutdown)
if (!shutdown) manager.notify(NOTIFICATION_ID, buildNotification(service)) if (!shutdown) manager.notify(NOTIFICATION_ID, buildNotification(service))
} }