adding placeholder for foreground topic fcm messages
This commit is contained in:
@@ -231,6 +231,7 @@ class TinodeWeb extends React.Component {
|
|||||||
try {
|
try {
|
||||||
this.fbPush = firebase.initializeApp(FIREBASE_INIT, APP_NAME).messaging();
|
this.fbPush = firebase.initializeApp(FIREBASE_INIT, APP_NAME).messaging();
|
||||||
this.fbPush.usePublicVapidKey(FIREBASE_INIT.messagingVapidKey);
|
this.fbPush.usePublicVapidKey(FIREBASE_INIT.messagingVapidKey);
|
||||||
|
|
||||||
navigator.serviceWorker.register('/service-worker.js').then((reg) => {
|
navigator.serviceWorker.register('/service-worker.js').then((reg) => {
|
||||||
this.checkForAppUpdate(reg);
|
this.checkForAppUpdate(reg);
|
||||||
this.fbPush.useServiceWorker(reg);
|
this.fbPush.useServiceWorker(reg);
|
||||||
@@ -974,9 +975,10 @@ class TinodeWeb extends React.Component {
|
|||||||
this.requestPushToken();
|
this.requestPushToken();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// TODO: add handler for FCM topic pushes (pushes for channels).
|
||||||
|
// They have to be handled even when the app is in the foreground.
|
||||||
this.fbPush.onMessage((payload) => {
|
this.fbPush.onMessage((payload) => {
|
||||||
// No need to do anything about it.
|
console.log("got fg push message", payload.data);
|
||||||
// All the magic happends in the service worker.
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5050,6 +5050,9 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
console.log("Failed to register service worker:", err);
|
console.log("Failed to register service worker:", err);
|
||||||
});
|
});
|
||||||
|
this.fbPush.onMessage(payload => {
|
||||||
|
console.log("got fg push message", payload.data);
|
||||||
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.handleError(formatMessage(messages.push_init_failed), 'err');
|
this.handleError(formatMessage(messages.push_init_failed), 'err');
|
||||||
console.log("Failed to initialize push notifications", err);
|
console.log("Failed to initialize push notifications", err);
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1
-2
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user