mirror of
https://github.com/oxen-io/session-android.git
synced 2025-01-03 13:47:45 +00:00
message sender failed with error
This commit is contained in:
parent
f3c3483cde
commit
246eb62958
@ -287,8 +287,16 @@ class Storage(context: Context, helper: SQLCipherOpenHelper) : Database(context,
|
||||
}
|
||||
}
|
||||
|
||||
override fun setErrorMessage(message: Message, error: Exception) {
|
||||
TODO("Not yet implemented")
|
||||
override fun setErrorMessage(messageID: Long, error: Exception) {
|
||||
val database = DatabaseFactory.getMmsSmsDatabase(context)
|
||||
val messageRecord = database.getMessageFor(messageID) ?: return
|
||||
if (messageRecord.isMms) {
|
||||
val mmsDatabase = DatabaseFactory.getMmsDatabase(context)
|
||||
mmsDatabase.markAsSentFailed(messageID)
|
||||
} else {
|
||||
val smsDatabase = DatabaseFactory.getSmsDatabase(context)
|
||||
smsDatabase.markAsSentFailed(messageID)
|
||||
}
|
||||
}
|
||||
|
||||
override fun getGroup(groupID: String): GroupRecord? {
|
||||
|
@ -92,7 +92,7 @@ interface StorageProtocol {
|
||||
fun setOpenGroupServerMessageID(messageID: Long, serverID: Long)
|
||||
fun markAsSent(messageID: Long)
|
||||
fun markUnidentified(messageID: Long)
|
||||
fun setErrorMessage(message: Message, error: Exception)
|
||||
fun setErrorMessage(messageID: Long, error: Exception)
|
||||
|
||||
// Closed Groups
|
||||
fun getGroup(groupID: String): GroupRecord?
|
||||
|
@ -272,6 +272,8 @@ object MessageSender {
|
||||
}
|
||||
|
||||
fun handleFailedMessageSend(message: Message, error: Exception) {
|
||||
MessagingConfiguration.shared.storage.setErrorMessage(message, error)
|
||||
val storage = MessagingConfiguration.shared.storage
|
||||
val messageId = storage.getMessageIdInDatabase(message.sentTimestamp!!, message.sender!!) ?: return
|
||||
storage.setErrorMessage(messageId, error)
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user