parent
1a07e23192
commit
a20fe4c9a0
|
@ -106,6 +106,7 @@ export class Convo {
|
||||||
string,
|
string,
|
||||||
{id: string; message: ChatBskyConvoSendMessage.InputSchema['message']}
|
{id: string; message: ChatBskyConvoSendMessage.InputSchema['message']}
|
||||||
> = new Map()
|
> = new Map()
|
||||||
|
private deletedMessages: Set<string> = new Set()
|
||||||
private footerItems: Map<string, ConvoItem> = new Map()
|
private footerItems: Map<string, ConvoItem> = new Map()
|
||||||
|
|
||||||
private pendingEventIngestion: Promise<void> | undefined
|
private pendingEventIngestion: Promise<void> | undefined
|
||||||
|
@ -278,6 +279,8 @@ export class Convo {
|
||||||
* this.pastMessages.set(log.message.id, log.message)
|
* this.pastMessages.set(log.message.id, log.message)
|
||||||
*/
|
*/
|
||||||
this.pastMessages.delete(log.message.id)
|
this.pastMessages.delete(log.message.id)
|
||||||
|
this.newMessages.delete(log.message.id)
|
||||||
|
this.deletedMessages.delete(log.message.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -411,6 +414,30 @@ export class Convo {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async deleteMessage(messageId: string) {
|
||||||
|
this.deletedMessages.add(messageId)
|
||||||
|
this.commit()
|
||||||
|
|
||||||
|
try {
|
||||||
|
await this.agent.api.chat.bsky.convo.deleteMessageForSelf(
|
||||||
|
{
|
||||||
|
convoId: this.convoId,
|
||||||
|
messageId,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
encoding: 'application/json',
|
||||||
|
headers: {
|
||||||
|
Authorization: this.__tempFromUserDid,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
)
|
||||||
|
} catch (e) {
|
||||||
|
this.deletedMessages.delete(messageId)
|
||||||
|
this.commit()
|
||||||
|
throw e
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Items in reverse order, since FlatList inverts
|
* Items in reverse order, since FlatList inverts
|
||||||
*/
|
*/
|
||||||
|
@ -474,7 +501,14 @@ export class Convo {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return items.map((item, i) => {
|
return items
|
||||||
|
.filter(item => {
|
||||||
|
if (isConvoItemMessage(item)) {
|
||||||
|
return !this.deletedMessages.has(item.message.id)
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
.map((item, i) => {
|
||||||
let nextMessage = null
|
let nextMessage = null
|
||||||
const isMessage = isConvoItemMessage(item)
|
const isMessage = isConvoItemMessage(item)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue