mirror of
https://github.com/oxen-io/session-android.git
synced 2025-02-19 20:28:26 +00:00
Merge branch 'refactor-sending' of github.com:hjubb/session-android into origin/refactor-sending
This commit is contained in:
commit
65fbd56b6a
@ -66,10 +66,10 @@ class DatabaseAttachmentProvider(context: Context, helper: SQLCipherOpenHelper)
|
||||
attachmentDatabase.setTransferState(messageID, AttachmentId(attachmentId, 0), attachmentState.value)
|
||||
}
|
||||
|
||||
override fun getMessageForQuote(timestamp: Long, author: Address): Long? {
|
||||
override fun getMessageForQuote(timestamp: Long, author: Address): Pair<Long, Boolean>? {
|
||||
val messagingDatabase = DatabaseFactory.getMmsSmsDatabase(context)
|
||||
val message = messagingDatabase.getMessageFor(timestamp, author)
|
||||
return message?.id
|
||||
return if (message != null) Pair(message.id, message.isMms) else null
|
||||
}
|
||||
|
||||
override fun getAttachmentsAndLinkPreviewFor(mmsId: Long): List<Attachment> {
|
||||
|
@ -31,7 +31,7 @@ interface MessageDataProvider {
|
||||
fun updateAttachmentAfterUploadFailed(attachmentId: Long)
|
||||
|
||||
// Quotes
|
||||
fun getMessageForQuote(timestamp: Long, author: Address): Long?
|
||||
fun getMessageForQuote(timestamp: Long, author: Address): Pair<Long, Boolean>?
|
||||
fun getAttachmentsAndLinkPreviewFor(mmsId: Long): List<Attachment>
|
||||
fun getMessageBodyFor(timestamp: Long, author: String): String
|
||||
|
||||
|
@ -31,6 +31,7 @@ import org.session.libsignal.utilities.Base64
|
||||
import org.session.libsignal.utilities.logging.Log
|
||||
import java.security.MessageDigest
|
||||
import java.util.*
|
||||
import kotlin.collections.ArrayList
|
||||
|
||||
internal fun MessageReceiver.isBlock(publicKey: String): Boolean {
|
||||
val context = MessagingConfiguration.shared.context
|
||||
@ -156,9 +157,9 @@ fun MessageReceiver.handleVisibleMessage(message: VisibleMessage, proto: SignalS
|
||||
if (message.quote != null && proto.dataMessage.hasQuote()) {
|
||||
val quote = proto.dataMessage.quote
|
||||
val author = Address.fromSerialized(quote.author)
|
||||
val messageID = MessagingConfiguration.shared.messageDataProvider.getMessageForQuote(quote.id, author)
|
||||
if (messageID != null) {
|
||||
val attachments = MessagingConfiguration.shared.messageDataProvider.getAttachmentsAndLinkPreviewFor(messageID)
|
||||
val messageInfo = MessagingConfiguration.shared.messageDataProvider.getMessageForQuote(quote.id, author)
|
||||
if (messageInfo != null) {
|
||||
val attachments = if (messageInfo.second) MessagingConfiguration.shared.messageDataProvider.getAttachmentsAndLinkPreviewFor(messageInfo.first) else ArrayList()
|
||||
quoteModel = QuoteModel(quote.id, author, MessagingConfiguration.shared.messageDataProvider.getMessageBodyFor(quote.id, quote.author), false, attachments)
|
||||
} else {
|
||||
quoteModel = QuoteModel(quote.id, author, quote.text, true, PointerAttachment.forPointers(proto.dataMessage.quote.attachmentsList))
|
||||
|
Loading…
x
Reference in New Issue
Block a user