Skip to content

Commit

Permalink
implement it on android
Browse files Browse the repository at this point in the history
  • Loading branch information
nplasterer committed Nov 13, 2024
1 parent fe274c2 commit 9471bd1
Showing 1 changed file with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,14 @@ class XMTPModule : Module() {
}
}

AsyncFunction("getInboxStates") Coroutine { inboxId: String, refreshFromNetwork: Boolean, inboxIds: List<String> ->
withContext(Dispatchers.IO) {
val client = clients[inboxId] ?: throw XMTPException("No client")
val inboxStates = client.inboxStatesForInboxIds(refreshFromNetwork, inboxIds)
inboxStates.map { InboxStateWrapper.encode(it) }
}
}

Function("preAuthenticateToInboxCallbackCompleted") {
logV("preAuthenticateToInboxCallbackCompleted")
preAuthenticateToInboxCallbackDeferred?.complete(Unit)
Expand Down Expand Up @@ -531,11 +539,22 @@ class XMTPModule : Module() {
}
}

AsyncFunction("findDmByInboxId") Coroutine { inboxId: String, peerInboxId: String ->
withContext(Dispatchers.IO) {
logV("findDmByInboxId")
val client = clients[inboxId] ?: throw XMTPException("No client")
val dm = client.findDmByInboxId(peerInboxId)
dm?.let {
DmWrapper.encode(client, dm)
}
}
}

AsyncFunction("findDmByAddress") Coroutine { inboxId: String, peerAddress: String ->
withContext(Dispatchers.IO) {
logV("findDmByAddress")
val client = clients[inboxId] ?: throw XMTPException("No client")
val dm = client.findDm(peerAddress)
val dm = client.findDmByAddress(peerAddress)
dm?.let {
DmWrapper.encode(client, dm)
}
Expand Down

0 comments on commit 9471bd1

Please sign in to comment.