mirror of
https://github.com/SableClient/Sable.git
synced 2026-11-21 01:21:18 -08:00
fix(noti): try-catch all badge API calls
This commit is contained in:
1 parent
6a9fe21fe9
commit
b56e793a15
1 file changed
+6
-6
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user