@aochuang/client-sdk 1.0.341 → 1.0.342
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -452,9 +452,15 @@ class ClientChat {
|
|
|
452
452
|
}
|
|
453
453
|
})
|
|
454
454
|
})
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
455
|
+
} else {
|
|
456
|
+
this.session.updateSession(sessionId, ({ session }) => {
|
|
457
|
+
// listChange/getSession may already include this message in unreadMsgCount.
|
|
458
|
+
// Only count messages newer than the session watermark.
|
|
459
|
+
const isNewerMessage = data.wechatTime > (session.lastMsgTime || 0)
|
|
460
|
+
if (!isNewerMessage) {
|
|
461
|
+
return {}
|
|
462
|
+
}
|
|
463
|
+
const nextSession = {
|
|
458
464
|
lastMsgContent: data.content,
|
|
459
465
|
lastMsgType: data.msgType,
|
|
460
466
|
lastMsgTime: data.wechatTime,
|
|
@@ -462,7 +468,7 @@ class ClientChat {
|
|
|
462
468
|
lastUpdateTime: data.updateDate,
|
|
463
469
|
unreadMsgCount: session.unreadMsgCount
|
|
464
470
|
}
|
|
465
|
-
|
|
471
|
+
if (!data.isSend && isNewerMessage) {
|
|
466
472
|
if (this.sessionManage.currentSession && this.sessionManage.currentSession.conversationId === sessionId && this.shouldMarkCurrentSessionRead(sessionId, data)) {
|
|
467
473
|
// 标记已读
|
|
468
474
|
this.session.setSessionRead(sessionId)
|
|
@@ -594,9 +600,15 @@ class ClientChat {
|
|
|
594
600
|
}
|
|
595
601
|
})
|
|
596
602
|
})
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
603
|
+
} else {
|
|
604
|
+
this.session.updateSession(sessionId, ({ session }) => {
|
|
605
|
+
// listChange/getSession may already include this message in unreadMsgCount.
|
|
606
|
+
// Only count messages newer than the session watermark.
|
|
607
|
+
const isNewerMessage = data.wechatTime > (session.lastMsgTime || 0)
|
|
608
|
+
if (!isNewerMessage) {
|
|
609
|
+
return {}
|
|
610
|
+
}
|
|
611
|
+
const nextSession = {
|
|
600
612
|
lastMsgContent: data.content,
|
|
601
613
|
lastMsgType: data.msgType,
|
|
602
614
|
lastMsgTime: data.wechatTime,
|
|
@@ -604,7 +616,7 @@ class ClientChat {
|
|
|
604
616
|
lastUpdateTime: data.updateDate,
|
|
605
617
|
unreadMsgCount: session.unreadMsgCount
|
|
606
618
|
}
|
|
607
|
-
|
|
619
|
+
if (!data.isSend && isNewerMessage) {
|
|
608
620
|
if (this.sessionManage.currentSession && this.sessionManage.currentSession.conversationId === sessionId && this.shouldMarkCurrentSessionRead(sessionId, data)) {
|
|
609
621
|
// 标记已读
|
|
610
622
|
this.session.setSessionRead(sessionId)
|