This commit is contained in:
pradeepkumar
2026-04-03 08:57:25 +05:30
parent 28b78b56ff
commit cfc6cd540a

View File

@@ -43,9 +43,15 @@ export function NotificationProvider() {
let unsubscribe: (() => void) | null = null;
const init = async () => {
console.log('[NotificationProvider] Initializing push notifications...');
const registered = await notificationService.requestPermissionAndRegister();
console.log('[NotificationProvider] Registration result:', registered);
if (registered) {
unsubscribe = notificationService.setupForegroundHandler(addToast);
unsubscribe = notificationService.setupForegroundHandler((payload) => {
console.log('[NotificationProvider] Foreground message received:', payload);
addToast(payload);
});
console.log('[NotificationProvider] Foreground handler set up');
}
};