mirror of
https://github.com/hicccc77/WeFlow.git
synced 2026-03-25 07:16:51 +00:00
宇宙超级无敌帅气到爆炸的更新
This commit is contained in:
@@ -81,6 +81,11 @@ export function GlobalSessionMonitor() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const checkForNewMessages = async (oldSessions: ChatSession[], newSessions: ChatSession[]) => {
|
const checkForNewMessages = async (oldSessions: ChatSession[], newSessions: ChatSession[]) => {
|
||||||
|
if (!oldSessions || oldSessions.length === 0) {
|
||||||
|
console.log('[NotificationFilter] Skipping check on initial load (empty baseline)')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const oldMap = new Map(oldSessions.map(s => [s.username, s]))
|
const oldMap = new Map(oldSessions.map(s => [s.username, s]))
|
||||||
|
|
||||||
for (const newSession of newSessions) {
|
for (const newSession of newSessions) {
|
||||||
@@ -140,6 +145,14 @@ export function GlobalSessionMonitor() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 新增:如果未读数量没有增加,说明可能是自己在其他设备回复(或者已读),不弹通知
|
||||||
|
const oldUnread = oldSession ? oldSession.unreadCount : 0
|
||||||
|
const newUnread = newSession.unreadCount
|
||||||
|
if (newUnread <= oldUnread) {
|
||||||
|
// 仅仅是状态同步(如自己在手机上发消息 or 已读),跳过通知
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
let title = newSession.displayName || newSession.username
|
let title = newSession.displayName || newSession.username
|
||||||
let avatarUrl = newSession.avatarUrl
|
let avatarUrl = newSession.avatarUrl
|
||||||
let content = newSession.summary || '[新消息]'
|
let content = newSession.summary || '[新消息]'
|
||||||
|
|||||||
Reference in New Issue
Block a user