Skip to content

Commit

Permalink
Adds Group Chat Names functions (#236)
Browse files Browse the repository at this point in the history
* add group name functions

* add the jnilib

* update rust libxmtp for group name functions

* adjust forEach for API 23 compatibility

* Adds extra link to from Contributing guidelines to libxmtp bindings updates README

---------

Co-authored-by: Naomi Plasterer <[email protected]>
Co-authored-by: cameronvoell <[email protected]>
  • Loading branch information
3 people authored Apr 24, 2024
1 parent d38855f commit b9dc5ff
Show file tree
Hide file tree
Showing 9 changed files with 517 additions and 442 deletions.
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,7 @@ Please make sure you have Docker running locally. Once you do, you can run the f
```sh
script/local
```

### Updating libxmtp rust bindings

Please see [LibXMTP Kotlin README](https://github.com/xmtp/xmtp-android/blob/main/library/src/main/java/README.md).
15 changes: 15 additions & 0 deletions library/src/androidTest/java/org/xmtp/android/library/GroupTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,21 @@ class GroupTest {
)
}

@Test
fun testNameAGroup() {
val boGroup = runBlocking { boClient.conversations.newGroup(listOf(alix.walletAddress)) }
runBlocking {
assertEquals("New Group", boGroup.name)
boGroup.updateGroupName("This Is A Great Group")
boGroup.sync()
alixClient.conversations.syncGroups()
}
val alixGroup = runBlocking { alixClient.conversations.listGroups().first() }
runBlocking { alixGroup.sync() }
assertEquals("This Is A Great Group", boGroup.name)
assertEquals("This Is A Great Group", alixGroup.name)
}

@Test
fun testCanAddGroupMembers() {
val group = runBlocking { boClient.conversations.newGroup(listOf(alix.walletAddress)) }
Expand Down
6 changes: 3 additions & 3 deletions library/src/main/java/libxmtp-version.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Version: 5b62701
Branch: main
Date: 2024-04-18 03:59:02 +0000
Version: 40dedd8
Branch: HEAD
Date: 2024-04-23 22:24:01 +0000
7 changes: 7 additions & 0 deletions library/src/main/java/org/xmtp/android/library/Group.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ class Group(val client: Client, private val libXMTPGroup: FfiGroup) {
private val metadata: FfiGroupMetadata
get() = libXMTPGroup.groupMetadata()

val name: String
get() = libXMTPGroup.groupName()

suspend fun send(text: String): String {
return send(prepareMessage(content = text, options = null))
}
Expand Down Expand Up @@ -192,6 +195,10 @@ class Group(val client: Client, private val libXMTPGroup: FfiGroup) {
return addresses
}

suspend fun updateGroupName(name: String) {
return libXMTPGroup.updateGroupName(name)
}

fun streamMessages(): Flow<DecodedMessage> = callbackFlow {
val messageCallback = object : FfiMessageCallback {
override fun onMessage(message: FfiMessage) {
Expand Down
927 changes: 488 additions & 439 deletions library/src/main/java/xmtpv3.kt

Large diffs are not rendered by default.

Binary file modified library/src/main/jniLibs/arm64-v8a/libuniffi_xmtpv3.so
Binary file not shown.
Binary file modified library/src/main/jniLibs/armeabi-v7a/libuniffi_xmtpv3.so
Binary file not shown.
Binary file modified library/src/main/jniLibs/x86/libuniffi_xmtpv3.so
Binary file not shown.
Binary file modified library/src/main/jniLibs/x86_64/libuniffi_xmtpv3.so
Binary file not shown.

0 comments on commit b9dc5ff

Please sign in to comment.