From 1bee62b4743d19351f9c4e300b6b8dd57839fa61 Mon Sep 17 00:00:00 2001 From: dab246 Date: Tue, 7 Feb 2023 13:19:51 +0700 Subject: [PATCH] TF-1278 Hide notification on background web browser when support fcm --- web/firebase-messaging-sw.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/web/firebase-messaging-sw.js b/web/firebase-messaging-sw.js index d3027c812..cf5dd038d 100644 --- a/web/firebase-messaging-sw.js +++ b/web/firebase-messaging-sw.js @@ -11,3 +11,9 @@ firebase.initializeApp({ appId: "...", }); const messaging = firebase.messaging(); + +messaging.setBackgroundMessageHandler(function(payload) { + console.log('[firebase-messaging-sw.js] Received background message ', payload); + self.registration.hideNotification(); + return null; +}); \ No newline at end of file