From 1a1e055f6af45880720890ff3d0fe2edebef69a2 Mon Sep 17 00:00:00 2001 From: Ezequiel Leanes Date: Thu, 18 Jan 2024 13:59:00 -0300 Subject: [PATCH] fix: Improve performance list method (#153) * fix: update ConversationV2 createdAt property * remove test * resolve comments * Remove unused import statement * fix lint issue * Fix createdAt field name in Conversations data class --- .../src/main/java/org/xmtp/android/library/ConversationV2.kt | 4 +++- .../src/main/java/org/xmtp/android/library/Conversations.kt | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/library/src/main/java/org/xmtp/android/library/ConversationV2.kt b/library/src/main/java/org/xmtp/android/library/ConversationV2.kt index 3f6e610e4..6d20253c6 100644 --- a/library/src/main/java/org/xmtp/android/library/ConversationV2.kt +++ b/library/src/main/java/org/xmtp/android/library/ConversationV2.kt @@ -30,6 +30,7 @@ data class ConversationV2( val context: Invitation.InvitationV1.Context, val peerAddress: String, val client: Client, + val createdAtNs: Long? = null, private val header: SealedInvitationHeaderV1, ) { @@ -50,12 +51,13 @@ data class ConversationV2( context = invitation.context, peerAddress = peerAddress, client = client, + createdAtNs = header.createdNs, header = header, ) } } - val createdAt: Date = Date(header.createdNs / 1_000_000) + val createdAt: Date = Date((createdAtNs ?: header.createdNs) / 1_000_000) /** * This lists messages sent to the [Conversation]. diff --git a/library/src/main/java/org/xmtp/android/library/Conversations.kt b/library/src/main/java/org/xmtp/android/library/Conversations.kt index 51c897026..71edc7b37 100644 --- a/library/src/main/java/org/xmtp/android/library/Conversations.kt +++ b/library/src/main/java/org/xmtp/android/library/Conversations.kt @@ -226,6 +226,7 @@ data class Conversations( context = data.invitation.context, peerAddress = data.peerAddress, client = client, + createdAtNs = data.createdNs, header = Invitation.SealedInvitationHeaderV1.getDefaultInstance(), ), )