fix: R.color.destructive on the error drawable in conversation and home adapter and handling message re-sending

This commit is contained in:
jubb
2021-07-01 11:06:11 +10:00
parent 8eb4da34d4
commit 758475f0dc
6 changed files with 91 additions and 17 deletions

View File

@@ -89,6 +89,7 @@ interface StorageProtocol {
fun persistAttachments(messageID: Long, attachments: List<Attachment>): List<Long>
fun getAttachmentsForMessage(messageID: Long): List<DatabaseAttachment>
fun getMessageIdInDatabase(timestamp: Long, author: String): Long? // TODO: This is a weird name
fun markAsSending(timestamp: Long, author: String)
fun markAsSent(timestamp: Long, author: String)
fun markUnidentified(timestamp: Long, author: String)
fun setErrorMessage(timestamp: Long, author: String, error: Exception)

View File

@@ -3,6 +3,8 @@ package org.session.libsession.messaging.jobs
import com.esotericsoftware.kryo.Kryo
import com.esotericsoftware.kryo.io.Input
import com.esotericsoftware.kryo.io.Output
import nl.komponents.kovenant.FailedException
import nl.komponents.kovenant.Promise
import org.session.libsession.messaging.MessagingModuleConfiguration
import org.session.libsession.messaging.jobs.Job.Companion.MAX_BUFFER_SIZE
import org.session.libsession.messaging.messages.Destination
@@ -55,7 +57,7 @@ class MessageSendJob(val message: Message, val destination: Destination) : Job {
return
} // Wait for all attachments to upload before continuing
}
MessageSender.send(this.message, this.destination).success {
val promise = MessageSender.send(this.message, this.destination).success {
this.handleSuccess()
}.fail { exception ->
Log.e(TAG, "Couldn't send message due to error: $exception.")
@@ -64,6 +66,11 @@ class MessageSendJob(val message: Message, val destination: Destination) : Job {
}
this.handleFailure(exception)
}
try {
promise.get()
} catch (e: Exception) {
Log.d(TAG, "Promise failed to resolve successfully", e)
}
}
private fun handleSuccess() {