From 5f6e33c85280e35cea46aa1e0a6a5d8ead0638e3 Mon Sep 17 00:00:00 2001 From: Mygod Date: Sun, 25 Jul 2021 22:51:50 -0400 Subject: [PATCH] Fix notification again --- .../src/main/java/be/mygod/vpnhotspot/ServiceNotification.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/ServiceNotification.kt b/mobile/src/main/java/be/mygod/vpnhotspot/ServiceNotification.kt index caacd93b..740b170e 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/ServiceNotification.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/ServiceNotification.kt @@ -62,7 +62,8 @@ object ServiceNotification { } } 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) if (!shutdown) manager.notify(NOTIFICATION_ID, buildNotification(service)) }