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(() => {
|
useEffect(() => {
|
||||||
let notification = false;
|
let notification = false;
|
||||||
let highlight = false;
|
let highlight = false;
|
||||||
|
let total = 0;
|
||||||
roomToUnread.forEach((unread) => {
|
roomToUnread.forEach((unread) => {
|
||||||
|
if (unread.from === null) {
|
||||||
|
total += unread.total;
|
||||||
|
}
|
||||||
if (unread.total > 0) {
|
if (unread.total > 0) {
|
||||||
notification = true;
|
notification = true;
|
||||||
}
|
}
|
||||||
|
|
@ -71,6 +75,11 @@ function FaviconUpdater() {
|
||||||
} else {
|
} else {
|
||||||
setFavicon(LogoSVG);
|
setFavicon(LogoSVG);
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
navigator.setAppBadge(total);
|
||||||
|
} catch (e) {
|
||||||
|
// Likely Firefox/Gecko-based and doesn't support badging API
|
||||||
|
}
|
||||||
}, [roomToUnread]);
|
}, [roomToUnread]);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue