diff --git a/library/src/androidTest/java/org/xmtp/android/library/GroupTest.kt b/library/src/androidTest/java/org/xmtp/android/library/GroupTest.kt index e32507256..a06fb50bc 100644 --- a/library/src/androidTest/java/org/xmtp/android/library/GroupTest.kt +++ b/library/src/androidTest/java/org/xmtp/android/library/GroupTest.kt @@ -256,6 +256,20 @@ class GroupTest { assert(!caroGroup.isActive()) } + @Test + fun testAddedByAddress() { + val group = runBlocking { + alixClient.conversations.newGroup( + listOf( + bo.walletAddress, + ) + ) + } + runBlocking { boClient.conversations.syncGroups() } + val boGroup = runBlocking { boClient.conversations.listGroups().first() } + assertEquals(boGroup.addedByAddress().lowercase(), alix.walletAddress.lowercase()) + } + @Test fun testCanListGroups() { runBlocking { diff --git a/library/src/main/java/README.md b/library/src/main/java/README.md index 0f192cd44..a99bdb8dc 100644 --- a/library/src/main/java/README.md +++ b/library/src/main/java/README.md @@ -6,10 +6,9 @@ Kotlin code emitted by the `bindings_ffi` crate in [libxmtp](https://github.com/ 1. From repo [libxmtp](https://github.com/xmtp/libxmtp) checkout the branch you would like to make a release from 2. Navigate to the `bindings_ffi` folder -3. Run `./gen_kotlin.sh` -4. Run `./cross_build.sh` -5. Copy the contents of `libxmtp/bindings_ffi/src/uniffi/xmtpv3/xmtpv3.kt` to `xmtp-android/library/src/main/java/xmtpv3.kt` -6. All instances of `value.forEach` should be changed to `value.iterator().forEach` to be compatible with API 23 -7. Copy the jniLibs from `libxmtp/bindings_ffi/jniLibs` to `xmtp-android/library/src/main/jniLibs` +3. Follow the instructions for "Rebuilding this crate in the `bindings_ffi` [README](https://github.com/xmtp/libxmtp/tree/main/bindings_ffi#rebuilding-this-crate)" +4. Copy the contents of `libxmtp/bindings_ffi/src/uniffi/xmtpv3/xmtpv3.kt` to `xmtp-android/library/src/main/java/xmtpv3.kt` +5. All instances of `value.forEach` should be changed to `value.iterator().forEach` to be compatible with API 23 +6. Copy the jniLibs from `libxmtp/bindings_ffi/jniLibs` to `xmtp-android/library/src/main/jniLibs` You should now be on the latest libxmtp. Tests will fail if the jniLibs do not match the version of xmtpv3. \ No newline at end of file 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 f802cf29c..876df77ff 100644 --- a/library/src/main/java/org/xmtp/android/library/Group.kt +++ b/library/src/main/java/org/xmtp/android/library/Group.kt @@ -134,6 +134,10 @@ class Group(val client: Client, private val libXMTPGroup: FfiGroup) { return libXMTPGroup.isActive() } + fun addedByAddress(): String { + return libXMTPGroup.addedByAddress() + } + fun permissionLevel(): GroupPermissions { return metadata.policyType() } diff --git a/library/src/main/java/xmtpv3.kt b/library/src/main/java/xmtpv3.kt index 890152485..b0e2902a3 100644 --- a/library/src/main/java/xmtpv3.kt +++ b/library/src/main/java/xmtpv3.kt @@ -411,6 +411,8 @@ internal interface _UniFFILib : Library { ): Unit fun uniffi_xmtpv3_fn_method_ffigroup_add_members(`ptr`: Pointer,`accountAddresses`: RustBuffer.ByValue, ): Pointer + fun uniffi_xmtpv3_fn_method_ffigroup_added_by_address(`ptr`: Pointer,_uniffi_out_err: RustCallStatus, + ): RustBuffer.ByValue fun uniffi_xmtpv3_fn_method_ffigroup_created_at_ns(`ptr`: Pointer,_uniffi_out_err: RustCallStatus, ): Long fun uniffi_xmtpv3_fn_method_ffigroup_find_messages(`ptr`: Pointer,`opts`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus, @@ -673,6 +675,8 @@ internal interface _UniFFILib : Library { ): Short fun uniffi_xmtpv3_checksum_method_ffigroup_add_members( ): Short + fun uniffi_xmtpv3_checksum_method_ffigroup_added_by_address( + ): Short fun uniffi_xmtpv3_checksum_method_ffigroup_created_at_ns( ): Short fun uniffi_xmtpv3_checksum_method_ffigroup_find_messages( @@ -823,6 +827,9 @@ private fun uniffiCheckApiChecksums(lib: _UniFFILib) { if (lib.uniffi_xmtpv3_checksum_method_ffigroup_add_members() != 24978.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } + if (lib.uniffi_xmtpv3_checksum_method_ffigroup_added_by_address() != 5368.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } if (lib.uniffi_xmtpv3_checksum_method_ffigroup_created_at_ns() != 58515.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } @@ -1488,7 +1495,8 @@ public object FfiConverterTypeFfiConversations: FfiConverter) + suspend fun `addMembers`(`accountAddresses`: List)@Throws(GenericException::class) + fun `addedByAddress`(): String fun `createdAtNs`(): Long@Throws(GenericException::class) fun `findMessages`(`opts`: FfiListMessagesOptions): List@Throws(GenericException::class) fun `groupMetadata`(): FfiGroupMetadata @@ -1542,6 +1550,18 @@ class FfiGroup( GenericException.ErrorHandler, ) } + + @Throws(GenericException::class)override fun `addedByAddress`(): String = + callWithPointer { + rustCallWithError(GenericException) { _status -> + _UniFFILib.INSTANCE.uniffi_xmtpv3_fn_method_ffigroup_added_by_address(it, + + _status) + } + }.let { + FfiConverterString.lift(it) + } + override fun `createdAtNs`(): Long = callWithPointer { rustCall() { _status -> diff --git a/library/src/main/jniLibs/arm64-v8a/libuniffi_xmtpv3.so b/library/src/main/jniLibs/arm64-v8a/libuniffi_xmtpv3.so index f719c5695..48dcc1b13 100755 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 8d8e6b627..1a8a40ac5 100755 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 6c8f2f36d..d32916daf 100755 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 1b3773029..c790a1687 100755 Binary files a/library/src/main/jniLibs/x86_64/libuniffi_xmtpv3.so and b/library/src/main/jniLibs/x86_64/libuniffi_xmtpv3.so differ