fix(push): use unique tag for push notifications

This commit is contained in:
Kris Hu authored and GigiaJ committed 2026-02-15 19:06:45 -06:00
1 parent 7151597888
commit 25d77d5132
2 files changed
+4 -4

No files matched your search

+2 -2
View File
@@ -145,7 +145,7 @@ const onPushNotification = async (event: PushEvent) => {
self.navigator.setAppBadge(pushData.unread);
if (pushData.unread == 0) {
self.registration.getNotifications({ tag: "Cinny" })
self.registration.getNotifications()
.then((notifications) => notifications
.forEach((notification) => notification.close()));
await navigator.clearAppBadge();
@@ -158,7 +158,7 @@ const onPushNotification = async (event: PushEvent) => {
// Likely Firefox/Gecko-based and doesn't support badging API
}
handlePushNotificationPushData(pushData);
await handlePushNotificationPushData(pushData);
};
self.addEventListener('push', (event: PushEvent) => event.waitUntil(onPushNotification(event)));
+2 -2
View File
@@ -9,13 +9,13 @@ export const usePushNotifications = (self: ServiceWorkerGlobalScope) => {
title: string,
body: string,
data: any,
silent: boolean = false
silent: boolean | null = null
) => {
await self.registration.showNotification(title, {
body,
icon: DEFAULT_NOTIFICATION_ICON,
badge: DEFAULT_NOTIFICATION_BADGE,
tag: "Cinny",
tag: data?.event_id ?? "Cinny",
silent,
data
});