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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user