支持私聊附件多选拖拽和批量重试

This commit is contained in:
xhgit committed 2026-11-15 22:41:23 +08:00
1 parent ec2679b991
commit 2931383906
8 files changed
+166 -35

No files matched your search

+3 -1
View File
@@ -217,7 +217,8 @@ export function mutateMessage(identity: ChatIdentity, user: string, peer: Peer,
})
}
export function send(identity: ChatIdentity, user: string, peer: Peer, content: string | File, call: Call, reply?: ChatLine) {
export function send(identity: ChatIdentity, user: string, peer: Peer, content: string | File, call: Call,
{ reply, onQueued }: { reply?: ChatLine; onQueued?: () => void } = {}) {
return update(identity, async (state, save, factory) => {
const current = (await directory(call, user)).find((item) => item.id === peer.id)
if (!current || state.pinned[current.id] !== current.publicKey) throw new Error('发送前请核验对方设备安全码')
@@ -257,6 +258,7 @@ export function send(identity: ChatIdentity, user: string, peer: Peer, content:
state.lines.push({ id, peer: current.id, contact: user, text, attachment, quote: attachment ? undefined : quote, time: new Date().toISOString(), own: true })
state.engine = base64(engine.snapshot())
await save(state)
onQueued?.()
await flush(state, save, call)
} finally {
engine.free()