Skip to content

Commit

Permalink
add iOS functions
Browse files Browse the repository at this point in the history
  • Loading branch information
nplasterer committed Jul 31, 2024
1 parent 5d43d3b commit 643ac07
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
8 changes: 4 additions & 4 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ PODS:
- GenericJSON (~> 2.0)
- Logging (~> 1.0.0)
- secp256k1.swift (~> 0.1)
- XMTP (0.13.13):
- XMTP (0.13.14):
- Connect-Swift (= 0.12.0)
- GzipSwift
- LibXMTP (= 0.5.6-beta4)
Expand All @@ -458,7 +458,7 @@ PODS:
- ExpoModulesCore
- MessagePacker
- secp256k1.swift
- XMTP (= 0.13.13)
- XMTP (= 0.13.14)
- Yoga (1.14.0)

DEPENDENCIES:
Expand Down Expand Up @@ -763,8 +763,8 @@ SPEC CHECKSUMS:
secp256k1.swift: a7e7a214f6db6ce5db32cc6b2b45e5c4dd633634
SwiftProtobuf: 407a385e97fd206c4fbe880cc84123989167e0d1
web3.swift: 2263d1e12e121b2c42ffb63a5a7beb1acaf33959
XMTP: bce55f0cd8f4481b8f460581ddf7808dcd09c1de
XMTPReactNative: 30b80235f99ee434ad9567a4d64d6cb505afe1a8
XMTP: f590939a897f00a0f957223eba31d5d6bee10a48
XMTPReactNative: ca2cdef4fcadb3e072fec62de63f379c84464250
Yoga: e71803b4c1fff832ccf9b92541e00f9b873119b9

PODFILE CHECKSUM: 95d6ace79946933ecf80684613842ee553dd76a2
Expand Down
1 change: 1 addition & 0 deletions ios/Wrappers/ClientWrapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ struct ClientWrapper {
"inboxId": client.inboxID,
"address": client.address,
"installationId": client.installationID,
"dbPath": client.dbPath,
]
}

Expand Down
9 changes: 9 additions & 0 deletions ios/XMTPModule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,15 @@ public class XMTPModule: Module {
throw Error.noClient
}
}

AsyncFunction("getOrCreateInboxId") { (address: String, environment: String) in
do {
let options = createClientConfig(env: environment, appVersion: nil)
return try await XMTP.Client.getOrCreateInboxId(options: options, address: address)
} catch {
throw Error.noClient
}
}

AsyncFunction("encryptAttachment") { (inboxId: String, fileJson: String) -> String in
guard let client = await clientsManager.getClient(key: inboxId) else {
Expand Down

0 comments on commit 643ac07

Please sign in to comment.