Skip to content

Commit

Permalink
Add/remove groups
Browse files Browse the repository at this point in the history
Added functionality for add remove groups
  • Loading branch information
Alex Risch authored and Alex Risch committed Feb 9, 2024
1 parent 2e532b4 commit 2a1e79d
Show file tree
Hide file tree
Showing 4 changed files with 309 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,28 @@ class XMTPModule : Module() {
runBlocking { group?.sync() }
}

AsyncFunction("addGroupMembers") { clientAddress: String, id: String, peerAddresses: List<String> ->
logV("addGroupMembers")
val client = clients[clientAddress] ?: throw XMTPException("No client")
if (client.libXMTPClient == null) {
throw XMTPException("Create client with enableAlphaMLS true in order to create a group")
}
val group = findGroup(clientAddress, id)

runBlocking { group?.addMembers(peerAddresses) }
}

AsyncFunction("removeGroupMembers") { clientAddress: String, id: String, peerAddresses: List<String> ->
logV("removeGroupMembers")
val client = clients[clientAddress] ?: throw XMTPException("No client")
if (client.libXMTPClient == null) {
throw XMTPException("Create client with enableAlphaMLS true in order to create a group")
}
val group = findGroup(clientAddress, id)

runBlocking { group?.removeMembers(peerAddresses) }
}

Function("subscribeToConversations") { clientAddress: String ->
logV("subscribeToConversations")
subscribeToConversations(clientAddress = clientAddress)
Expand Down
Loading

0 comments on commit 2a1e79d

Please sign in to comment.