feat: add message management and delivery states

This commit is contained in:
2026-07-16 17:23:24 +08:00
parent 07c7260a3c
commit 565d044f18
17 changed files with 881 additions and 97 deletions
+8 -4
View File
@@ -9,15 +9,19 @@ contextBridge.exposeInMainWorld('api', {
self: () => ipcRenderer.invoke('self:info'),
listDevices: () => ipcRenderer.invoke('device:list'),
triggerScan: () => ipcRenderer.invoke('device:triggerScan'),
deleteDevice: (deviceId: string) => ipcRenderer.invoke('device:delete', deviceId),
// 消息
listMessages: (peerId: string) => ipcRenderer.invoke('message:list', peerId),
sendText: (toDeviceId: string, content: string) => ipcRenderer.invoke('message:sendText', { toDeviceId, content }),
sendFile: (toDeviceId: string, localPath: string, opts?: { name?: string; mime?: string; asImage?: boolean; withProgress?: boolean }) =>
sendText: (toDeviceId: string, content: string, opts?: { replyTo?: any }) =>
ipcRenderer.invoke('message:sendText', { toDeviceId, content, replyTo: opts?.replyTo }),
sendFile: (toDeviceId: string, localPath: string, opts?: { name?: string; mime?: string; asImage?: boolean; withProgress?: boolean; replyTo?: any }) =>
ipcRenderer.invoke('message:sendFile', { toDeviceId, localPath, ...(opts || {}) }),
sendBuffer: (toDeviceId: string, dataBase64: string, name: string, mime: string) =>
ipcRenderer.invoke('message:sendBuffer', { toDeviceId, dataBase64, name, mime }),
sendBuffer: (toDeviceId: string, dataBase64: string, name: string, mime: string, opts?: { replyTo?: any }) =>
ipcRenderer.invoke('message:sendBuffer', { toDeviceId, dataBase64, name, mime, replyTo: opts?.replyTo }),
recall: (messageId: string) => ipcRenderer.invoke('message:recall', messageId),
deleteMessage: (messageId: string, opts?: { deleteFile?: boolean }) => ipcRenderer.invoke('message:delete', messageId, opts),
markRead: (peerId: string, upToMessageId: string) => ipcRenderer.invoke('message:markRead', { peerId, upToMessageId }),
retry: (messageId: string) => ipcRenderer.invoke('message:retry', messageId),
typing: (toDeviceId: string) => ipcRenderer.invoke('message:typing', toDeviceId),