Mark messages as sending after sending the message now.

Otherwise the scheduled time would never be updated and still be in the future.
This commit is contained in:
Inhishonor
2025-12-12 14:55:35 -08:00
parent 4bf0aebb04
commit e3b2386d49
3 changed files with 16 additions and 0 deletions
@@ -767,6 +767,20 @@ open class MessageRepositoryImpl @Inject constructor(
return message
}
override fun markAsSendingNow(messageId: Long) =
Realm.getDefaultInstance().use { realm ->
realm.refresh()
realm.where(Message::class.java)
.equalTo("id", messageId)
.findFirst()
?.let { message ->
realm.executeTransaction {
message.date = System.currentTimeMillis()
}
}
Unit
}
/**
* Marks the message as sending, in case we need to retry sending it
*/
@@ -51,6 +51,7 @@ class ActionDelayedMessage @Inject constructor(
}
Action.Send -> {
messageRepo.markAsSendingNow(message.id)
updateConversations.addAll(
messageRepo.sendMessage(message).map { it.threadId }
)
@@ -88,4 +88,5 @@ interface MessageRepository {
fun deleteOldMessages(maxAgeDays: Int)
fun markAsSendingNow(messageId: Long)
}