增加按设备统计的群消息未读角标

This commit is contained in:
xhgit committed 2026-11-14 20:11:42 +08:00
1 parent f54077ce46
commit 187923ca3c
16 files changed
+189 -23

No files matched your search

+3 -1
View File
@@ -9,6 +9,7 @@ export type GroupMember = { id: string; username: string; state: 'active' | 'inv
export type GroupDetail = { id: string; membershipVersion: string; members: GroupMember[]; role: GroupMember['role'] }
export type GroupPreferences = { pinned: boolean; muted: boolean }
export type GroupSummary = Omit<GroupDetail, 'members'> & GroupPreferences & { name: string; state: GroupMember['state'] }
export type ListedGroup = GroupSummary & { unread: number }
export type GroupDevice = Peer & { user: string }
type Epoch = { id: string; creatorDevice: string; membershipVersion: string; welcome?: string; current: boolean; roster: string[] }
type Publishing = { id: string; membershipVersion: string; devices: { device: string; wire?: string }[] }
@@ -271,7 +272,8 @@ export function synchronizeGroup(identity: ChatIdentity, group: GroupDetail, cal
const engine = factory.DeviceMls.restore(decode(state.engine))
try { await replenishPackages(identity, call, state, save, engine) } catch { warning ||= '密钥包补充失败' } finally { engine.free() }
}
return { devices, lines: chat.lines, pinned: state.pinned, ready, current, warning,
const hasMore = packets.length === 64 && packets.at(-1)?.sequence === chat.cursor
return { devices, lines: chat.lines, pinned: state.pinned, ready, current, warning, cursor: chat.cursor, hasMore,
hasPending: Boolean(chat.pendingMessage), stalePending: Boolean(chat.pendingMessage && chat.pendingMessage.epoch !== current?.id) }
})
}