From db55edffa460dcaeb36f8710ed79012b2277c3f1 Mon Sep 17 00:00:00 2001 From: Xeovalyte Date: Sat, 14 Jan 2023 19:39:10 +0100 Subject: [PATCH] fixed double push notification message --- backend/index.js | 5 +++-- frontend/package-lock.json | 13 +++++++------ frontend/public/firebase-messaging-sw.js | 14 -------------- 3 files changed, 10 insertions(+), 22 deletions(-) diff --git a/backend/index.js b/backend/index.js index 54b722b..1b7f48a 100644 --- a/backend/index.js +++ b/backend/index.js @@ -136,7 +136,8 @@ app.post('/sendmessage', async (req, res) => { const message = { notification: { title: title, - body: body + body: body, + icon: 'https://wrbapp.xeovalyte.com/ios/256.png', }, topic: 'all', apns: { @@ -175,4 +176,4 @@ app.post('/sendmessage', async (req, res) => { } catch (e) { return res.status(500).send({ code: 'error', error: e }) } -}) \ No newline at end of file +}) diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 060eb85..83bedff 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -4,6 +4,7 @@ "requires": true, "packages": { "": { + "name": "frontend", "hasInstallScript": true, "dependencies": { "@capacitor/core": "^4.3.0", @@ -6637,9 +6638,9 @@ "dev": true }, "node_modules/json5": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz", - "integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==", + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", "bin": { "json5": "lib/cli.js" }, @@ -16492,9 +16493,9 @@ "dev": true }, "json5": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz", - "integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==" + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==" }, "jsonc-parser": { "version": "3.2.0", diff --git a/frontend/public/firebase-messaging-sw.js b/frontend/public/firebase-messaging-sw.js index 6d31d96..0b6f71b 100644 --- a/frontend/public/firebase-messaging-sw.js +++ b/frontend/public/firebase-messaging-sw.js @@ -31,17 +31,3 @@ const firebaseConfig = { const app = firebase.initializeApp(firebaseConfig); const messaging = firebase.messaging(); - - -messaging.onBackgroundMessage((payload) => { - console.log('[firebase-messaging-sw.js] Received background message ', payload); - // Customize notification here - const notificationTitle = payload.notification.title; - const notificationOptions = { - body: payload.notification.body, - icon: '/ios/256.png' - }; - - self.registration.showNotification(notificationTitle, - notificationOptions); - }); \ No newline at end of file