persist message

This commit is contained in:
Ryan ZHAO
2021-01-19 17:06:02 +11:00
parent 845ea16415
commit 39858cb0c8
3 changed files with 53 additions and 4 deletions

View File

@@ -42,6 +42,10 @@ class VisibleMessage : Message() {
}
}
fun isMediaMessage(): Boolean {
return attachmentIDs.isNotEmpty() || quote != null || linkPreview != null || contact != null
}
// validation
override fun isValid(): Boolean {
if (!super.isValid()) return false

View File

@@ -154,7 +154,7 @@ fun MessageReceiver.handleVisibleMessage(message: VisibleMessage, proto: SignalS
val author = Address.fromSerialized(quote.author)
val messageID = MessagingConfiguration.shared.messageDataProvider.getMessageForQuote(quote.id, author)
if (messageID != null) {
val attachmentsWithLinkPreview = MessagingConfiguration.shared.messageDataProvider.getAttachmentsWithLinkPreviewFor(messageID)
val attachmentsWithLinkPreview = MessagingConfiguration.shared.messageDataProvider.getAttachmentsAndLinkPreviewFor(messageID)
quoteModel = QuoteModel(quote.id, author, MessagingConfiguration.shared.messageDataProvider.getMessageBodyFor(messageID), false, attachmentsWithLinkPreview)
} else {
quoteModel = QuoteModel(quote.id, author, quote.text, true, PointerAttachment.forPointers(proto.dataMessage.quote.attachmentsList))