merge devel
This commit is contained in:
@@ -669,8 +669,8 @@ class MessagesView extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
postReadNotification(seq) {
|
postReadNotification(seq) {
|
||||||
// Ignore notifications if the app is invisible.
|
// Ignore notifications if the app is invisible or topic is not yet available.
|
||||||
if (!this.props.applicationVisible) {
|
if (!this.props.applicationVisible || !this.state.topic) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -697,7 +697,9 @@ class MessagesView extends React.Component {
|
|||||||
if (n.sendAt <= now) {
|
if (n.sendAt <= now) {
|
||||||
// Remove expired notification from queue.
|
// Remove expired notification from queue.
|
||||||
this.readNotificationQueue.shift();
|
this.readNotificationQueue.shift();
|
||||||
seq = Math.max(seq, n.seq);
|
if (n.seq == 0 || Tinode.isServerAssignedSeq(n.seq)) {
|
||||||
|
seq = Math.max(seq, n.seq);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -707,7 +709,11 @@ class MessagesView extends React.Component {
|
|||||||
if (seq >= 0) {
|
if (seq >= 0) {
|
||||||
const topic = this.props.tinode.getTopic(this.state.topic);
|
const topic = this.props.tinode.getTopic(this.state.topic);
|
||||||
if (topic) {
|
if (topic) {
|
||||||
topic.noteRead(seq);
|
try {
|
||||||
|
topic.noteRead(seq);
|
||||||
|
} catch (err) {
|
||||||
|
console.error("Failed to send read notification", err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, NOTIFICATION_EXEC_INTERVAL);
|
}, NOTIFICATION_EXEC_INTERVAL);
|
||||||
@@ -796,9 +802,14 @@ class MessagesView extends React.Component {
|
|||||||
|
|
||||||
handleAllMessagesReceived(count) {
|
handleAllMessagesReceived(count) {
|
||||||
this.setState({fetchingMessages: false});
|
this.setState({fetchingMessages: false});
|
||||||
if (count > 0) {
|
if (!count) {
|
||||||
// 0 means "latest".
|
// All messages received. Nothing left to receive.
|
||||||
this.postReadNotification(0);
|
const topic = this.props.tinode.getTopic(this.state.topic);
|
||||||
|
if (topic) {
|
||||||
|
// Send read notification for the absolute last message.
|
||||||
|
this.postReadNotification(topic.seq);
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load pinned message too (if any);
|
// Load pinned message too (if any);
|
||||||
|
|||||||
+15
-5
@@ -10628,7 +10628,7 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
postReadNotification(seq) {
|
postReadNotification(seq) {
|
||||||
if (!this.props.applicationVisible) {
|
if (!this.props.applicationVisible || !this.state.topic) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!this.readNotificationTimer) {
|
if (!this.readNotificationTimer) {
|
||||||
@@ -10648,7 +10648,9 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
|||||||
const now = new Date();
|
const now = new Date();
|
||||||
if (n.sendAt <= now) {
|
if (n.sendAt <= now) {
|
||||||
this.readNotificationQueue.shift();
|
this.readNotificationQueue.shift();
|
||||||
seq = Math.max(seq, n.seq);
|
if (n.seq == 0 || tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Tinode.isServerAssignedSeq(n.seq)) {
|
||||||
|
seq = Math.max(seq, n.seq);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -10656,7 +10658,11 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
|||||||
if (seq >= 0) {
|
if (seq >= 0) {
|
||||||
const topic = this.props.tinode.getTopic(this.state.topic);
|
const topic = this.props.tinode.getTopic(this.state.topic);
|
||||||
if (topic) {
|
if (topic) {
|
||||||
topic.noteRead(seq);
|
try {
|
||||||
|
topic.noteRead(seq);
|
||||||
|
} catch (err) {
|
||||||
|
console.error("Failed to send read notification", err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, NOTIFICATION_EXEC_INTERVAL);
|
}, NOTIFICATION_EXEC_INTERVAL);
|
||||||
@@ -10741,8 +10747,12 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
|||||||
this.setState({
|
this.setState({
|
||||||
fetchingMessages: false
|
fetchingMessages: false
|
||||||
});
|
});
|
||||||
if (count > 0) {
|
if (!count) {
|
||||||
this.postReadNotification(0);
|
const topic = this.props.tinode.getTopic(this.state.topic);
|
||||||
|
if (topic) {
|
||||||
|
this.postReadNotification(topic.seq);
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (!this.state.pinsLoaded) {
|
if (!this.state.pinsLoaded) {
|
||||||
const topic = this.props.tinode.getTopic(this.state.topic);
|
const topic = this.props.tinode.getTopic(this.state.topic);
|
||||||
|
|||||||
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
Reference in New Issue
Block a user