Align quote behaviour, move the media message outside of text bubble to simplify layouts (#935)

* refactor: remove text from quote model

* refactor: add docs for TODOs where quote text should be refactored

* refactor: remove the references to stored text in the quote and get the quote text from referenced DB lookup

* refactor: drop the quote data from DB

* fix: turns out we can't drop columns using this version of sqlite

* fix: fixing an attachment download bug, fixing up UI issues with quotes and body text

* feat: split off the message attachment UI from message bubble

* refactor: replace media thumbnails with new designs

* refactor: add debug drawing to troubleshoot swipe gesture

* fix: fix the swipe to reply gesture drawing
This commit is contained in:
Harris
2022-08-08 15:16:33 +10:00
committed by GitHub
parent b1e954084c
commit d53752713e
22 changed files with 201 additions and 711 deletions

View File

@@ -60,6 +60,15 @@ class AttachmentDownloadJob(val attachmentID: Long, val databaseMessageID: Long)
messageDataProvider.setAttachmentState(AttachmentState.FAILED, AttachmentId(attachmentID,0), databaseMessageID)
}
this.handlePermanentFailure(exception)
} else if (exception == Error.DuplicateData) {
attachment?.let { id ->
Log.d("AttachmentDownloadJob", "Setting attachment state = done from duplicate data")
messageDataProvider.setAttachmentState(AttachmentState.DONE, id, databaseMessageID)
} ?: run {
Log.d("AttachmentDownloadJob", "Setting attachment state = done from duplicate data")
messageDataProvider.setAttachmentState(AttachmentState.DONE, AttachmentId(attachmentID,0), databaseMessageID)
}
this.handleSuccess()
} else {
if (failureCount + 1 >= maxFailureCount) {
attachment?.let { id ->

View File

@@ -30,7 +30,7 @@ class Quote() {
fun from(signalQuote: SignalQuote?): Quote? {
if (signalQuote == null) { return null }
val attachmentID = (signalQuote.attachments?.firstOrNull() as? DatabaseAttachment)?.attachmentId?.rowId
return Quote(signalQuote.id, signalQuote.author.serialize(), signalQuote.text, attachmentID)
return Quote(signalQuote.id, signalQuote.author.serialize(), "", attachmentID) // TODO: re-add this
}
}

View File

@@ -254,9 +254,9 @@ fun MessageReceiver.handleVisibleMessage(message: VisibleMessage,
val messageInfo = messageDataProvider.getMessageForQuote(quote.id, author)
if (messageInfo != null) {
val attachments = if (messageInfo.second) messageDataProvider.getAttachmentsAndLinkPreviewFor(messageInfo.first) else ArrayList()
quoteModel = QuoteModel(quote.id, author, messageDataProvider.getMessageBodyFor(quote.id, quote.author), false, attachments)
quoteModel = QuoteModel(quote.id, author,null,false, attachments)
} else {
quoteModel = QuoteModel(quote.id, author, quote.text, true, PointerAttachment.forPointers(proto.dataMessage.quote.attachmentsList))
quoteModel = QuoteModel(quote.id, author,null, true, PointerAttachment.forPointers(proto.dataMessage.quote.attachmentsList))
}
}
// Parse link preview if needed

View File

@@ -4,7 +4,7 @@ import org.session.libsession.messaging.sending_receiving.attachments.Attachment
import org.session.libsession.utilities.Address
class QuoteModel(val id: Long,
val author: Address,
val text: String,
val missing: Boolean,
val attachments: List<Attachment>?)
val author: Address,
val text: String?,
val missing: Boolean,
val attachments: List<Attachment>?)