interaction of push notification with tinode moved to the SDK

This commit is contained in:
or-else
2022-05-25 14:22:56 -07:00
parent 2a7c85c61c
commit a7d98136c5
7 changed files with 45 additions and 67 deletions
+1 -19
View File
@@ -317,25 +317,7 @@ class TinodeWeb extends React.Component {
// Tinode received a push notification from the server.
handlePushMessage(payload) {
const data = payload.data || {};
switch (data.what) {
case 'msg':
if (Tinode.isChannelTopicName(data.topic)) {
// The last argument is a fake user Id: otherwise the update is seen as one from the current user.
this.tinode.oobNotification('msg', data.topic, data.seq, 'fake-uid');
}
break;
case 'read':
// Message read on another device, clear it here.
this.tinode.oobNotification('read', data.topic, data.seq);
break;
case 'sub':
// Subscription update: new subscription or subscription is deleted.
this.tinode.oobNotification('sub', data.topic, -1, data.xfrom, {give: data.modeGiven, want: data.modeWant});
break;
default:
console.warn("Unknown push type ignored", data.what, data);
}
this.tinode.oobNotification(payload.data || {});
}
initFCMessaging() {
+1 -24
View File
@@ -7742,30 +7742,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
}
handlePushMessage(payload) {
const data = payload.data || {};
switch (data.what) {
case 'msg':
if (tinode_sdk__WEBPACK_IMPORTED_MODULE_4__.Tinode.isChannelTopicName(data.topic)) {
this.tinode.oobNotification('msg', data.topic, data.seq, 'fake-uid');
}
break;
case 'read':
this.tinode.oobNotification('read', data.topic, data.seq);
break;
case 'sub':
this.tinode.oobNotification('sub', data.topic, -1, data.xfrom, {
give: data.modeGiven,
want: data.modeWant
});
break;
default:
console.warn("Unknown push type ignored", data.what, data);
}
this.tinode.oobNotification(payload.data || {});
}
initFCMessaging() {
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+39 -20
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long