diff --git a/service-worker.js b/service-worker.js index bec4dd87..b69d4a6c 100644 --- a/service-worker.js +++ b/service-worker.js @@ -64,16 +64,16 @@ const fbMessaging = firebase.messaging(); // This method shows the push notifications while the window is in background. fbMessaging.onBackgroundMessage(payload => { - if (payload.data.silent == 'true') { - // TODO: if this is an 'msg', fetch the new message in the background. - return; - } - // Notify webapp that a message was received. if (webAppChannel) { webAppChannel.postMessage(payload.data); } + if (payload.data.silent == 'true') { + // No need to show anything. + return; + } + const titles = {'msg': 'new_message', 'sub': 'new_chat'}; const pushType = payload.data.what || 'msg'; const title = payload.data.title || self.i18nMessage(titles[pushType]);