Prevent firefox from crashing because of no badging API

This commit is contained in:
Gigiaj 2025-06-12 17:34:29 -05:00
parent 815a0ac7f4
commit f24c6cce76
3 changed files with 16 additions and 3 deletions

View file

@ -48,7 +48,11 @@ export const useRoomEventReaders = (room: Room, eventId?: string): string[] => {
room.on(RoomEvent.Receipt, handleReceipt);
room.on(RoomEvent.LocalEchoUpdated, handleLocalEcho);
navigator.setAppBadge(unreadInfo.total);
try {
navigator.setAppBadge(unreadInfo.total);
} catch (e) {
// Likely Firefox/Gecko-based and doesn't support badging API
}
return () => {
room.removeListener(RoomEvent.Receipt, handleReceipt);
room.removeListener(RoomEvent.LocalEchoUpdated, handleLocalEcho);