interaction of push notification with tinode moved to the SDK
This commit is contained in:
@@ -317,25 +317,7 @@ class TinodeWeb extends React.Component {
|
|||||||
|
|
||||||
// Tinode received a push notification from the server.
|
// Tinode received a push notification from the server.
|
||||||
handlePushMessage(payload) {
|
handlePushMessage(payload) {
|
||||||
const data = payload.data || {};
|
this.tinode.oobNotification(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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
initFCMessaging() {
|
initFCMessaging() {
|
||||||
|
|||||||
+1
-24
@@ -7742,30 +7742,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
}
|
}
|
||||||
|
|
||||||
handlePushMessage(payload) {
|
handlePushMessage(payload) {
|
||||||
const data = payload.data || {};
|
this.tinode.oobNotification(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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
initFCMessaging() {
|
initFCMessaging() {
|
||||||
|
|||||||
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
+32
-13
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