Skip to content

Commit

Permalink
return sent at ns in the decoded message
Browse files Browse the repository at this point in the history
  • Loading branch information
nplasterer committed Nov 10, 2024
1 parent 1b263b7 commit 8652392
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
15 changes: 1 addition & 14 deletions library/src/main/java/org/xmtp/android/library/DecodedMessage.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.xmtp.android.library

import org.xmtp.android.library.codecs.TextCodec
import org.xmtp.android.library.codecs.decoded
import org.xmtp.android.library.libxmtp.Message.MessageDeliveryStatus
import org.xmtp.proto.message.contents.Content
Expand All @@ -13,21 +12,9 @@ data class DecodedMessage(
var encodedContent: Content.EncodedContent,
var senderAddress: String,
var sent: Date,
var sentNs: Long,
var deliveryStatus: MessageDeliveryStatus = MessageDeliveryStatus.PUBLISHED
) {
companion object {
fun preview(client: Client, topic: String, body: String, senderAddress: String, sent: Date): DecodedMessage {
val encoded = TextCodec().encode(content = body)
return DecodedMessage(
client = client,
topic = topic,
encodedContent = encoded,
senderAddress = senderAddress,
sent = sent
)
}
}

fun <T> content(): T? =
encodedContent.decoded()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ data class Message(val client: Client, private val libXMTPMessage: FfiMessage) {
encodedContent = EncodedContent.parseFrom(libXMTPMessage.content),
senderAddress = senderInboxId,
sent = sentAt,
sentNs = sentAtNs,
deliveryStatus = deliveryStatus
)
if (decodedMessage.encodedContent.type == ContentTypeGroupUpdated && libXMTPMessage.kind != FfiConversationMessageKind.MEMBERSHIP_CHANGE) {
Expand Down

0 comments on commit 8652392

Please sign in to comment.