fix missed calls when topic is not in focus
This commit is contained in:
+5
-5
@@ -64,16 +64,16 @@ const fbMessaging = firebase.messaging();
|
|||||||
|
|
||||||
// This method shows the push notifications while the window is in background.
|
// This method shows the push notifications while the window is in background.
|
||||||
fbMessaging.onBackgroundMessage(payload => {
|
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.
|
// Notify webapp that a message was received.
|
||||||
if (webAppChannel) {
|
if (webAppChannel) {
|
||||||
webAppChannel.postMessage(payload.data);
|
webAppChannel.postMessage(payload.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (payload.data.silent == 'true') {
|
||||||
|
// No need to show anything.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const titles = {'msg': 'new_message', 'sub': 'new_chat'};
|
const titles = {'msg': 'new_message', 'sub': 'new_chat'};
|
||||||
const pushType = payload.data.what || 'msg';
|
const pushType = payload.data.what || 'msg';
|
||||||
const title = payload.data.title || self.i18nMessage(titles[pushType]);
|
const title = payload.data.title || self.i18nMessage(titles[pushType]);
|
||||||
|
|||||||
Reference in New Issue
Block a user