Added app badge support for the guest PWA and wired it to the existing counts (unread notifications + upload queue + pending uploads). When the total hits zero, the badge is cleared; when it’s >0, it’s set.

This commit is contained in:
Codex Agent
2025-12-27 14:15:14 +01:00
parent 1a48c9458e
commit a8b54b75ea
3 changed files with 103 additions and 0 deletions

View File

@@ -8,6 +8,7 @@ import {
type GuestNotificationItem,
} from '../services/notificationApi';
import { fetchPendingUploadsSummary } from '../services/pendingUploadsApi';
import { updateAppBadge } from '../lib/badges';
export type NotificationCenterValue = {
notifications: GuestNotificationItem[];
@@ -265,6 +266,10 @@ export function NotificationCenterProvider({ eventToken, children }: { eventToke
const loading = loadingNotifications || queueLoading || pendingLoading;
const totalCount = unreadCount + queueCount + pendingCount;
React.useEffect(() => {
void updateAppBadge(totalCount);
}, [totalCount]);
const value: NotificationCenterValue = {
notifications,
unreadCount,