v0.6.5 various updates
This commit is contained in:
@@ -190,11 +190,20 @@ export default function Chat() {
|
||||
setUnreadGroups(prev => { const next = new Map(prev); next.delete(id); return next; });
|
||||
};
|
||||
|
||||
// Update page title with total unread badge count
|
||||
// Update page title AND PWA app badge with total unread count
|
||||
useEffect(() => {
|
||||
const totalUnread = [...unreadGroups.values()].reduce((a, b) => a + b, 0);
|
||||
// Strip any existing badge prefix to get the clean base title
|
||||
const base = document.title.replace(/^\(\d+\)\s*/, '');
|
||||
document.title = totalUnread > 0 ? `(${totalUnread}) ${base}` : base;
|
||||
// PWA app icon badge (Chrome/Edge desktop + Android, Safari 16.4+)
|
||||
if ('setAppBadge' in navigator) {
|
||||
if (totalUnread > 0) {
|
||||
navigator.setAppBadge(totalUnread).catch(() => {});
|
||||
} else {
|
||||
navigator.clearAppBadge().catch(() => {});
|
||||
}
|
||||
}
|
||||
}, [unreadGroups]);
|
||||
|
||||
const activeGroup = [
|
||||
|
||||
Reference in New Issue
Block a user