Skip to content

Commit

Permalink
do iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
nplasterer committed Dec 16, 2024
1 parent 8f85a16 commit 4feaa1b
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion ios/XMTPModule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ public class XMTPModule: Module {
return nil
}
}

AsyncFunction("sendEncodedContent") {
(
installationId: String, conversationId: String,
Expand Down Expand Up @@ -809,6 +809,30 @@ public class XMTPModule: Module {
)
}

AsyncFunction("prepareEncodedMessage") {
(
installationId: String,
conversationId: String,
encodedContentData: [UInt8]
) -> String in
guard
let client = await clientsManager.getClient(key: installationId)
else {
throw Error.noClient
}
guard
let conversation = try client.findConversation(
conversationId: conversationId)
else {
throw Error.conversationNotFound(
"no conversation found for \(conversationId)")
}
let encodedContent = try EncodedContent(
serializedBytes: Data(encodedContentData))
return try await conversation.prepareMessage(
encodedContent: encodedContent)
}

AsyncFunction("findOrCreateDm") {
(installationId: String, peerAddress: String) -> String in
guard
Expand Down

0 comments on commit 4feaa1b

Please sign in to comment.