diff --git a/library/src/main/java/libxmtp-version.txt b/library/src/main/java/libxmtp-version.txt index a374f737..58d1a96c 100644 --- a/library/src/main/java/libxmtp-version.txt +++ b/library/src/main/java/libxmtp-version.txt @@ -1,3 +1,3 @@ -Version: 7d863bde +Version: a9111a13 Branch: main -Date: 2024-12-20 22:46:38 +0000 +Date: 2024-12-21 00:25:32 +0000 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 b0589922..6b0055ac 100644 --- a/library/src/main/java/org/xmtp/android/library/Conversations.kt +++ b/library/src/main/java/org/xmtp/android/library/Conversations.kt @@ -242,7 +242,8 @@ data class Conversations( null, 1, null, - FfiDirection.DESCENDING + FfiDirection.DESCENDING, + null ) ) .firstOrNull() diff --git a/library/src/main/java/org/xmtp/android/library/Dm.kt b/library/src/main/java/org/xmtp/android/library/Dm.kt index e3114398..3698a6be 100644 --- a/library/src/main/java/org/xmtp/android/library/Dm.kt +++ b/library/src/main/java/org/xmtp/android/library/Dm.kt @@ -12,6 +12,7 @@ import org.xmtp.android.library.libxmtp.Message import org.xmtp.android.library.libxmtp.Message.MessageDeliveryStatus import org.xmtp.android.library.libxmtp.Message.SortDirection import org.xmtp.android.library.messages.Topic +import uniffi.xmtpv3.FfiContentType import uniffi.xmtpv3.FfiConversation import uniffi.xmtpv3.FfiConversationMetadata import uniffi.xmtpv3.FfiDeliveryStatus @@ -109,6 +110,7 @@ class Dm(val client: Client, private val libXMTPGroup: FfiConversation) { afterNs: Long? = null, direction: SortDirection = SortDirection.DESCENDING, deliveryStatus: MessageDeliveryStatus = MessageDeliveryStatus.ALL, + contentTypes: List? = null ): List { return libXMTPGroup.findMessages( opts = FfiListMessagesOptions( @@ -124,7 +126,8 @@ class Dm(val client: Client, private val libXMTPGroup: FfiConversation) { direction = when (direction) { SortDirection.ASCENDING -> FfiDirection.ASCENDING else -> FfiDirection.DESCENDING - } + }, + contentTypes = contentTypes ) ).mapNotNull { Message(client, it).decodeOrNull() diff --git a/library/src/main/java/org/xmtp/android/library/Group.kt b/library/src/main/java/org/xmtp/android/library/Group.kt index ef21df9e..dd44011a 100644 --- a/library/src/main/java/org/xmtp/android/library/Group.kt +++ b/library/src/main/java/org/xmtp/android/library/Group.kt @@ -12,6 +12,7 @@ import org.xmtp.android.library.libxmtp.Message import org.xmtp.android.library.libxmtp.Message.MessageDeliveryStatus import org.xmtp.android.library.libxmtp.Message.SortDirection import org.xmtp.android.library.messages.Topic +import uniffi.xmtpv3.FfiContentType import uniffi.xmtpv3.FfiConversation import uniffi.xmtpv3.FfiConversationMetadata import uniffi.xmtpv3.FfiDeliveryStatus @@ -126,6 +127,7 @@ class Group(val client: Client, private val libXMTPGroup: FfiConversation) { afterNs: Long? = null, direction: SortDirection = SortDirection.DESCENDING, deliveryStatus: MessageDeliveryStatus = MessageDeliveryStatus.ALL, + contentTypes: List? = null ): List { return libXMTPGroup.findMessages( opts = FfiListMessagesOptions( @@ -141,7 +143,8 @@ class Group(val client: Client, private val libXMTPGroup: FfiConversation) { direction = when (direction) { SortDirection.ASCENDING -> FfiDirection.ASCENDING else -> FfiDirection.DESCENDING - } + }, + contentTypes = contentTypes ) ).mapNotNull { Message(client, it).decodeOrNull() diff --git a/library/src/main/java/xmtpv3.kt b/library/src/main/java/xmtpv3.kt index 4b8a1e5d..aa6f769b 100644 --- a/library/src/main/java/xmtpv3.kt +++ b/library/src/main/java/xmtpv3.kt @@ -10430,6 +10430,7 @@ data class FfiListMessagesOptions( var `limit`: kotlin.Long?, var `deliveryStatus`: FfiDeliveryStatus?, var `direction`: FfiDirection?, + var `contentTypes`: List?, ) { companion object @@ -10447,6 +10448,7 @@ public object FfiConverterTypeFfiListMessagesOptions : FfiConverterOptionalLong.read(buf), FfiConverterOptionalTypeFfiDeliveryStatus.read(buf), FfiConverterOptionalTypeFfiDirection.read(buf), + FfiConverterOptionalSequenceTypeFfiContentType.read(buf), ) } @@ -10455,7 +10457,8 @@ public object FfiConverterTypeFfiListMessagesOptions : FfiConverterOptionalLong.allocationSize(value.`sentAfterNs`) + FfiConverterOptionalLong.allocationSize(value.`limit`) + FfiConverterOptionalTypeFfiDeliveryStatus.allocationSize(value.`deliveryStatus`) + - FfiConverterOptionalTypeFfiDirection.allocationSize(value.`direction`) + FfiConverterOptionalTypeFfiDirection.allocationSize(value.`direction`) + + FfiConverterOptionalSequenceTypeFfiContentType.allocationSize(value.`contentTypes`) ) override fun write(value: FfiListMessagesOptions, buf: ByteBuffer) { @@ -10464,6 +10467,7 @@ public object FfiConverterTypeFfiListMessagesOptions : FfiConverterOptionalLong.write(value.`limit`, buf) FfiConverterOptionalTypeFfiDeliveryStatus.write(value.`deliveryStatus`, buf) FfiConverterOptionalTypeFfiDirection.write(value.`direction`, buf) + FfiConverterOptionalSequenceTypeFfiContentType.write(value.`contentTypes`, buf) } } @@ -10847,6 +10851,41 @@ public object FfiConverterTypeFfiConsentState : FfiConverterRustBuffer { + override fun read(buf: ByteBuffer) = try { + FfiContentType.values()[buf.getInt() - 1] + } catch (e: IndexOutOfBoundsException) { + throw RuntimeException("invalid enum value, something is very wrong!!", e) + } + + override fun allocationSize(value: FfiContentType) = 4UL + + override fun write(value: FfiContentType, buf: ByteBuffer) { + buf.putInt(value.ordinal + 1) + } +} + + enum class FfiConversationMessageKind { APPLICATION, @@ -11965,6 +12004,37 @@ public object FfiConverterOptionalTypeFfiMetadataField : FfiConverterRustBuffer< } +/** + * @suppress + */ +public object FfiConverterOptionalSequenceTypeFfiContentType : + FfiConverterRustBuffer?> { + override fun read(buf: ByteBuffer): List? { + if (buf.get().toInt() == 0) { + return null + } + return FfiConverterSequenceTypeFfiContentType.read(buf) + } + + override fun allocationSize(value: List?): ULong { + if (value == null) { + return 1UL + } else { + return 1UL + FfiConverterSequenceTypeFfiContentType.allocationSize(value) + } + } + + override fun write(value: List?, buf: ByteBuffer) { + if (value == null) { + buf.put(0) + } else { + buf.put(1) + FfiConverterSequenceTypeFfiContentType.write(value, buf) + } + } +} + + /** * @suppress */ @@ -12311,6 +12381,33 @@ public object FfiConverterSequenceTypeFfiV2QueryResponse : } +/** + * @suppress + */ +public object FfiConverterSequenceTypeFfiContentType : + FfiConverterRustBuffer> { + override fun read(buf: ByteBuffer): List { + val len = buf.getInt() + return List(len) { + FfiConverterTypeFfiContentType.read(buf) + } + } + + override fun allocationSize(value: List): ULong { + val sizeForLength = 4UL + val sizeForItems = value.map { FfiConverterTypeFfiContentType.allocationSize(it) }.sum() + return sizeForLength + sizeForItems + } + + override fun write(value: List, buf: ByteBuffer) { + buf.putInt(value.size) + value.iterator().forEach { + FfiConverterTypeFfiContentType.write(it, buf) + } + } +} + + /** * @suppress */ @@ -12369,7 +12466,7 @@ public object FfiConverterMapStringBoolean : // The parens on `(k, v)` here ensure we're calling the right method, // which is important for compatibility with older android devices. // Ref https://blog.danlew.net/2017/03/16/kotlin-puzzler-whose-line-is-it-anyways/ - value.iterator().forEach { (k, v) -> + value.forEach { (k, v) -> FfiConverterString.write(k, buf) FfiConverterBoolean.write(v, buf) } diff --git a/library/src/main/jniLibs/arm64-v8a/libuniffi_xmtpv3.so b/library/src/main/jniLibs/arm64-v8a/libuniffi_xmtpv3.so index da10741b..343f744a 100644 Binary files a/library/src/main/jniLibs/arm64-v8a/libuniffi_xmtpv3.so and b/library/src/main/jniLibs/arm64-v8a/libuniffi_xmtpv3.so differ diff --git a/library/src/main/jniLibs/armeabi-v7a/libuniffi_xmtpv3.so b/library/src/main/jniLibs/armeabi-v7a/libuniffi_xmtpv3.so index 69d6b87d..ffa63f8c 100644 Binary files a/library/src/main/jniLibs/armeabi-v7a/libuniffi_xmtpv3.so and b/library/src/main/jniLibs/armeabi-v7a/libuniffi_xmtpv3.so differ diff --git a/library/src/main/jniLibs/x86/libuniffi_xmtpv3.so b/library/src/main/jniLibs/x86/libuniffi_xmtpv3.so index a1221063..cc8da5f5 100644 Binary files a/library/src/main/jniLibs/x86/libuniffi_xmtpv3.so and b/library/src/main/jniLibs/x86/libuniffi_xmtpv3.so differ diff --git a/library/src/main/jniLibs/x86_64/libuniffi_xmtpv3.so b/library/src/main/jniLibs/x86_64/libuniffi_xmtpv3.so index 8391690c..fdf18d5a 100644 Binary files a/library/src/main/jniLibs/x86_64/libuniffi_xmtpv3.so and b/library/src/main/jniLibs/x86_64/libuniffi_xmtpv3.so differ