fixed TM-171 jira task

This commit is contained in:
amirrezaghabeli
2025-10-01 14:11:53 +03:30
parent d42f477dcb
commit 006b421a9e
12 changed files with 69 additions and 17 deletions
+24
View File
@@ -12,3 +12,27 @@ firebase.initializeApp({
});
const messaging = firebase.messaging();
// Handle background messages
messaging.onBackgroundMessage(async (payload) => {
const notificationTitle = payload.notification.title;
const notificationOptions = {
body: payload.notification.body,
badge: '/icons/Icon-192.svg',
icon: '/icons/notification.svg',
data: payload.data,
click_action: payload.notification.click_action,
};
self.registration.showNotification(notificationTitle, notificationOptions);
});
// Open or focus the app when a notification is clicked
self.addEventListener('notificationclick', (event) => {
event.notification.close();
const targetUrl = 'https://app.opplens.com/notification';
event.waitUntil(
self.clients.openWindow(targetUrl)
);
});