Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update all V2 to be backed by rust #432

Merged
merged 5 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@ repositories {
dependencies {
implementation project(':expo-modules-core')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}"
implementation "org.xmtp:android:0.11.2"
implementation "org.xmtp:android:0.14.0"
implementation 'com.google.code.gson:gson:2.10.1'
implementation 'com.facebook.react:react-native:0.71.3'
implementation "com.daveanthonythomas.moshipack:moshipack:1.0.1"
}
implementation "com.daveanthonythomas.moshipack:moshipack:1.0.1"}
Original file line number Diff line number Diff line change
Expand Up @@ -299,20 +299,24 @@ class XMTPModule : Module() {

//
// Client API
AsyncFunction("canMessage") { clientAddress: String, peerAddress: String ->
logV("canMessage")
val client = clients[clientAddress] ?: throw XMTPException("No client")
AsyncFunction("canMessage") Coroutine { clientAddress: String, peerAddress: String ->
withContext(Dispatchers.IO) {
logV("canMessage")
val client = clients[clientAddress] ?: throw XMTPException("No client")

client.canMessage(peerAddress)
client.canMessage(peerAddress)
}
}

AsyncFunction("staticCanMessage") { peerAddress: String, environment: String, appVersion: String? ->
try {
logV("staticCanMessage")
val options = ClientOptions(api = apiEnvironments(environment, appVersion))
Client.canMessage(peerAddress = peerAddress, options = options)
} catch (e: Exception) {
throw XMTPException("Failed to create client: ${e.message}")
AsyncFunction("staticCanMessage") Coroutine { peerAddress: String, environment: String, appVersion: String? ->
withContext(Dispatchers.IO) {
try {
logV("staticCanMessage")
val options = ClientOptions(api = apiEnvironments(environment, appVersion))
Client.canMessage(peerAddress = peerAddress, options = options)
} catch (e: Exception) {
throw XMTPException("Failed to create client: ${e.message}")
}
}
}

Expand Down Expand Up @@ -583,14 +587,15 @@ class XMTPModule : Module() {

var consentProof: ConsentProofPayload? = null
if (consentProofPayload.isNotEmpty()) {
val consentProofDataBytes = consentProofPayload.foldIndexed(ByteArray(consentProofPayload.size)) { i, a, v ->
a.apply {
set(
i,
v.toByte()
)
val consentProofDataBytes =
consentProofPayload.foldIndexed(ByteArray(consentProofPayload.size)) { i, a, v ->
a.apply {
set(
i,
v.toByte()
)
}
}
}
consentProof = ConsentProofPayload.parseFrom(consentProofDataBytes)
}

Expand Down
2 changes: 1 addition & 1 deletion ios/XMTPReactNative.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ Pod::Spec.new do |s|
s.source_files = "**/*.{h,m,swift}"
s.dependency 'secp256k1.swift'
s.dependency "MessagePacker"
s.dependency "XMTP", "= 0.10.9"
s.dependency "XMTP", "= 0.13.0"
end
Loading