close push notifications when all have been read
This commit is contained in:
1 parent
6d962a64f9
commit
10ef89ed3a
1 file changed
+7
@@ -141,6 +141,13 @@ const handlePushNotificationEventData = async (eventData: PushMessageData) => {
|
||||
} catch (e) {
|
||||
// Likely Firefox/Gecko-based and doesn't support badging API
|
||||
}
|
||||
if (pushData.unread == 0) {
|
||||
self.registration.getNotifications({ tag: "Cinny" })
|
||||
.then((notifications) => notifications
|
||||
.forEach((notification) => notification.close()));
|
||||
await navigator.clearAppBadge();
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
await navigator.clearAppBadge();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user