mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-09 16:50:28 +03:00
move nav badge handling to favicon and sum total there for it
This commit is contained in:
parent
8cbc9ce601
commit
60af716dbc
1 changed files with 9 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue