mirror of
https://github.com/oxen-io/session-android.git
synced 2025-04-29 09:20:44 +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) {
|
override fun resumeMessageSendJobIfNeeded(messageSendJobID: String) {
|
||||||
val job = DatabaseFactory.getSessionJobDatabase(context).getMessageSendJob(messageSendJobID) ?: return
|
val job = DatabaseFactory.getSessionJobDatabase(context).getMessageSendJob(messageSendJobID) ?: return
|
||||||
job.delegate = JobQueue.shared
|
JobQueue.shared.add(job)
|
||||||
job.execute()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun isJobCanceled(job: Job): Boolean {
|
override fun isJobCanceled(job: Job): Boolean {
|
||||||
|
@ -34,8 +34,8 @@ class AttachmentDownloadJob(val attachmentID: Long, val databaseMessageID: Long)
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun execute() {
|
override fun execute() {
|
||||||
|
try {
|
||||||
val messageDataProvider = MessagingConfiguration.shared.messageDataProvider
|
val messageDataProvider = MessagingConfiguration.shared.messageDataProvider
|
||||||
messageDataProvider.getDatabaseAttachment(attachmentID)
|
|
||||||
val attachment = messageDataProvider.getDatabaseAttachment(attachmentID) ?: return handleFailure(Error.NoAttachment)
|
val attachment = messageDataProvider.getDatabaseAttachment(attachmentID) ?: return handleFailure(Error.NoAttachment)
|
||||||
messageDataProvider.setAttachmentState(AttachmentState.STARTED, attachmentID, this.databaseMessageID)
|
messageDataProvider.setAttachmentState(AttachmentState.STARTED, attachmentID, this.databaseMessageID)
|
||||||
val tempFile = createTempFile()
|
val tempFile = createTempFile()
|
||||||
@ -69,6 +69,9 @@ class AttachmentDownloadJob(val attachmentID: Long, val databaseMessageID: Long)
|
|||||||
|
|
||||||
tempFile.delete()
|
tempFile.delete()
|
||||||
handleSuccess()
|
handleSuccess()
|
||||||
|
} catch (e: Exception) {
|
||||||
|
handleFailure(e)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleSuccess() {
|
private fun handleSuccess() {
|
||||||
|
@ -42,7 +42,8 @@ data class OpenGroupMessage(
|
|||||||
}()
|
}()
|
||||||
// Message
|
// Message
|
||||||
val displayname = storage.getUserDisplayName() ?: "Anonymous"
|
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)
|
val result = OpenGroupMessage(null, userPublicKey, displayname, body, message.sentTimestamp!!, OpenGroupAPI.openGroupMessageType, quote, mutableListOf(), null, null, 0)
|
||||||
// Link preview
|
// Link preview
|
||||||
val linkPreview = message.linkPreview
|
val linkPreview = message.linkPreview
|
||||||
|
Loading…
x
Reference in New Issue
Block a user