mirror of
https://github.com/oxen-io/session-android.git
synced 2025-04-28 05:50:46 +00:00
fix: empty messages in open groups now correct properly
This commit is contained in:
parent
d292c760c4
commit
c3f7425ccd
@ -182,8 +182,7 @@ class Storage(context: Context, helper: SQLCipherOpenHelper) : Database(context,
|
||||
|
||||
override fun resumeMessageSendJobIfNeeded(messageSendJobID: String) {
|
||||
val job = DatabaseFactory.getSessionJobDatabase(context).getMessageSendJob(messageSendJobID) ?: return
|
||||
job.delegate = JobQueue.shared
|
||||
job.execute()
|
||||
JobQueue.shared.add(job)
|
||||
}
|
||||
|
||||
override fun isJobCanceled(job: Job): Boolean {
|
||||
|
@ -34,8 +34,8 @@ class AttachmentDownloadJob(val attachmentID: Long, val databaseMessageID: Long)
|
||||
}
|
||||
|
||||
override fun execute() {
|
||||
try {
|
||||
val messageDataProvider = MessagingConfiguration.shared.messageDataProvider
|
||||
messageDataProvider.getDatabaseAttachment(attachmentID)
|
||||
val attachment = messageDataProvider.getDatabaseAttachment(attachmentID) ?: return handleFailure(Error.NoAttachment)
|
||||
messageDataProvider.setAttachmentState(AttachmentState.STARTED, attachmentID, this.databaseMessageID)
|
||||
val tempFile = createTempFile()
|
||||
@ -69,6 +69,9 @@ class AttachmentDownloadJob(val attachmentID: Long, val databaseMessageID: Long)
|
||||
|
||||
tempFile.delete()
|
||||
handleSuccess()
|
||||
} catch (e: Exception) {
|
||||
handleFailure(e)
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleSuccess() {
|
||||
|
@ -42,7 +42,8 @@ data class OpenGroupMessage(
|
||||
}()
|
||||
// Message
|
||||
val displayname = storage.getUserDisplayName() ?: "Anonymous"
|
||||
val body = message.text ?: message.sentTimestamp.toString() // The back-end doesn't accept messages without a body so we use this as a workaround
|
||||
val text = message.text
|
||||
val body = if (text.isNullOrEmpty()) message.sentTimestamp.toString() else text // The back-end doesn't accept messages without a body so we use this as a workaround
|
||||
val result = OpenGroupMessage(null, userPublicKey, displayname, body, message.sentTimestamp!!, OpenGroupAPI.openGroupMessageType, quote, mutableListOf(), null, null, 0)
|
||||
// Link preview
|
||||
val linkPreview = message.linkPreview
|
||||
|
Loading…
x
Reference in New Issue
Block a user