Skip to content

Commit bd18a95

Browse files
committed
[messages] add createdAt field to ensure correct order
1 parent 1aa4972 commit bd18a95

File tree

5 files changed

+12
-3
lines changed

5 files changed

+12
-3
lines changed

app/src/main/java/me/capcom/smsgateway/modules/gateway/GatewayApi.kt

+1
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ class GatewayApi(
172172
val isEncrypted: Boolean?,
173173
val validUntil: Date?,
174174
val priority: Byte?,
175+
val createdAt: Date?,
175176
)
176177

177178
data class RecipientState(

app/src/main/java/me/capcom/smsgateway/modules/gateway/GatewayService.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,8 @@ class GatewayService(
230230
message.id,
231231
message.message,
232232
message.phoneNumbers,
233-
message.isEncrypted ?: false
233+
message.isEncrypted ?: false,
234+
message.createdAt ?: Date(),
234235
),
235236
SendParams(
236237
message.withDeliveryReport ?: true,

app/src/main/java/me/capcom/smsgateway/modules/localserver/routes/MessagesRoutes.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ class MessagesRoutes(
6767
request.id ?: NanoIdUtils.randomNanoId(),
6868
request.message,
6969
request.phoneNumbers,
70-
request.isEncrypted ?: false
70+
request.isEncrypted ?: false,
71+
Date(),
7172
),
7273
SendParams(
7374
request.withDeliveryReport ?: true,

app/src/main/java/me/capcom/smsgateway/modules/messages/MessagesService.kt

+2
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ class MessagesService(
9494
request.params.skipPhoneValidation,
9595
request.params.priority ?: Message.PRIORITY_DEFAULT,
9696
request.source,
97+
98+
createdAt = request.message.createdAt.time,
9799
),
98100
request.message.phoneNumbers.map {
99101
MessageRecipient(
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
package me.capcom.smsgateway.modules.messages.data
22

3+
import java.util.Date
4+
35
data class Message(
46
val id: String,
57
val text: String,
68
val phoneNumbers: List<String>,
7-
9+
810
val isEncrypted: Boolean,
11+
12+
val createdAt: Date,
913
)

0 commit comments

Comments
 (0)