Phase 664: voice-note fetch and forward IPC handlers.
Wire fetch-voice-note-blob and forward-voice-note through ui-flow to platform fetchVoiceNoteBlob and forwardVoiceNote. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -1138,6 +1138,45 @@ async function dispatchUiMessage (platform, msg, hooks = {}) {
|
|||||||
pushState()
|
pushState()
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
if (t === 'fetch-voice-note-blob') {
|
||||||
|
try {
|
||||||
|
const out = await platform.fetchVoiceNoteBlob(msg.noteId)
|
||||||
|
send({
|
||||||
|
type: 'voice-note-blob-fetched',
|
||||||
|
noteId: msg.noteId,
|
||||||
|
dataBase64: out?.dataBase64 || null,
|
||||||
|
bytes: out?.bytes || 0,
|
||||||
|
progress: out?.progress || null
|
||||||
|
})
|
||||||
|
} catch (err) {
|
||||||
|
send({
|
||||||
|
type: 'voice-note-blob-fetch-error',
|
||||||
|
noteId: msg.noteId,
|
||||||
|
message: err?.message || String(err)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if (t === 'forward-voice-note') {
|
||||||
|
try {
|
||||||
|
const out = await platform.forwardVoiceNote({
|
||||||
|
messageId: msg.messageId,
|
||||||
|
targetChannelId: msg.targetChannelId
|
||||||
|
})
|
||||||
|
send({
|
||||||
|
type: 'voice-note-forwarded',
|
||||||
|
messageId: out?.message?.id || null,
|
||||||
|
targetChannelId: msg.targetChannelId
|
||||||
|
})
|
||||||
|
pushState()
|
||||||
|
} catch (err) {
|
||||||
|
send({
|
||||||
|
type: 'voice-note-forward-error',
|
||||||
|
message: err?.message || String(err)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
if (t === 'stage-attachment') {
|
if (t === 'stage-attachment') {
|
||||||
const att = await platform.stageAttachment({
|
const att = await platform.stageAttachment({
|
||||||
data: fromBase64(msg.dataBase64),
|
data: fromBase64(msg.dataBase64),
|
||||||
|
|||||||
Reference in New Issue
Block a user