move nav badge handling to favicon and sum total there for it
This commit is contained in:
1 parent
8cbc9ce601
commit
60af716dbc
1 file changed
+9
@@ -57,7 +57,11 @@ function FaviconUpdater() {
|
||||
useEffect(() => {
|
||||
let notification = false;
|
||||
let highlight = false;
|
||||
let total = 0;
|
||||
roomToUnread.forEach((unread) => {
|
||||
if (unread.from === null) {
|
||||
total += unread.total;
|
||||
}
|
||||
if (unread.total > 0) {
|
||||
notification = true;
|
||||
}
|
||||
@@ -71,6 +75,11 @@ function FaviconUpdater() {
|
||||
} else {
|
||||
setFavicon(LogoSVG);
|
||||
}
|
||||
try {
|
||||
navigator.setAppBadge(total);
|
||||
} catch (e) {
|
||||
// Likely Firefox/Gecko-based and doesn't support badging API
|
||||
}
|
||||
}, [roomToUnread]);
|
||||
|
||||
return null;
|
||||
|
||||
Reference in new issue
Block a user