mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-17 11:38:51 +01:00
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:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user