fix(noti): try-catch all badge API calls

This commit is contained in:
Kris Hu authored and GigiaJ committed 2026-02-15 19:06:46 -06:00
1 parent 6a9fe21fe9
commit b56e793a15
1 file changed
+6 -6
+6 -6
View File
@@ -81,15 +81,15 @@ function FaviconUpdater() {
}
try {
navigator.setAppBadge(total);
if (usePushNotifications && total === 0) {
registration.getNotifications()
.then((pushNotifications) => pushNotifications
.forEach((pushNotification) => pushNotification.close()));
navigator.clearAppBadge();
}
} catch (e) {
// Likely Firefox/Gecko-based and doesn't support badging API
}
if (usePushNotifications && total === 0) {
registration.getNotifications()
.then((pushNotifications) => pushNotifications
.forEach((pushNotification) => pushNotification.close()));
navigator.clearAppBadge();
}
}, [roomToUnread, usePushNotifications, registration]);
return null;