close push notifications when all have been read

This commit is contained in:
Kris Hu authored and GigiaJ committed 2026-02-15 19:06:45 -06:00
1 parent 6d962a64f9
commit 10ef89ed3a
1 file changed
+7
+7
View File
@@ -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();
}