Skip to content

Commit

Permalink
update android implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
nplasterer committed Jul 9, 2024
1 parent 85753a0 commit 8d56037
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 24 deletions.
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ repositories {
dependencies {
implementation project(':expo-modules-core')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}"
implementation "org.xmtp:android:0.14.5"
implementation "org.xmtp:android:0.14.6"
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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ import org.xmtp.proto.message.contents.Invitation.ConsentProofPayload
import org.xmtp.proto.message.contents.PrivateKeyOuterClass
import uniffi.xmtpv3.org.xmtp.android.library.libxmtp.GroupPermissionPreconfiguration
import uniffi.xmtpv3.org.xmtp.android.library.libxmtp.PermissionOption
import uniffi.xmtpv3.org.xmtp.android.library.libxmtp.UnpublishedMessage
import java.io.File
import java.util.Date
import java.util.UUID
Expand Down Expand Up @@ -149,7 +148,6 @@ class XMTPModule : Module() {
}

private var clients: MutableMap<String, Client> = mutableMapOf()
private var unpublishedLocalMessages: MutableMap<String, UnpublishedMessage> = mutableMapOf()
private var xmtpPush: XMTPPush? = null
private var signer: ReactNativeSigner? = null
private val isDebugEnabled = BuildConfig.DEBUG // TODO: consider making this configurable
Expand Down Expand Up @@ -706,15 +704,17 @@ class XMTPModule : Module() {
}
}

AsyncFunction("publishPreparedGroupMessage") Coroutine { messageId: String ->
AsyncFunction("publishPreparedGroupMessages") Coroutine { inboxId: String, groupId: String ->
withContext(Dispatchers.IO) {
logV("publishPreparedGroupMessage")
val unpublishedMessage = unpublishedLocalMessages[messageId] ?: throw XMTPException(
"No message found for $messageId"
)
val group =
findGroup(
inboxId = inboxId,
id = groupId
)
?: throw XMTPException("no group found for $groupId")

unpublishedLocalMessages.remove(messageId)
unpublishedMessage.publish()
group.publishMessages()
}
}

Expand All @@ -728,12 +728,10 @@ class XMTPModule : Module() {
)
?: throw XMTPException("no group found for $id")
val sending = ContentJson.fromJson(contentJson)
val unpublishedMessage = group.prepareMessage(
group.prepareMessage(
content = sending.content,
options = SendOptions(contentType = sending.type)
)
unpublishedLocalMessages[unpublishedMessage.messageId] = unpublishedMessage
unpublishedMessage.messageId
}
}

Expand Down
24 changes: 12 additions & 12 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ PODS:
- hermes-engine/Pre-built (= 0.71.14)
- hermes-engine/Pre-built (0.71.14)
- libevent (2.1.12)
- LibXMTP (0.5.4-beta2)
- LibXMTP (0.5.4-beta3)
- Logging (1.0.0)
- MessagePacker (0.4.7)
- MMKV (1.3.5):
- MMKVCore (~> 1.3.5)
- MMKVCore (1.3.5)
- MMKV (1.3.7):
- MMKVCore (~> 1.3.7)
- MMKVCore (1.3.7)
- OpenSSL-Universal (1.1.2200)
- RCT-Folly (2021.07.22.00):
- boost
Expand Down Expand Up @@ -449,16 +449,16 @@ PODS:
- GenericJSON (~> 2.0)
- Logging (~> 1.0.0)
- secp256k1.swift (~> 0.1)
- XMTP (0.13.3):
- XMTP (0.13.4):
- Connect-Swift (= 0.12.0)
- GzipSwift
- LibXMTP (= 0.5.4-beta2)
- LibXMTP (= 0.5.4-beta3)
- web3.swift
- XMTPReactNative (0.1.0):
- ExpoModulesCore
- MessagePacker
- secp256k1.swift
- XMTP (= 0.13.3)
- XMTP (= 0.13.4)
- Yoga (1.14.0)

DEPENDENCIES:
Expand Down Expand Up @@ -711,11 +711,11 @@ SPEC CHECKSUMS:
GzipSwift: 893f3e48e597a1a4f62fafcb6514220fcf8287fa
hermes-engine: d7cc127932c89c53374452d6f93473f1970d8e88
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
LibXMTP: 16096f324c99d44712ed40876fe25150f694feab
LibXMTP: a0fa16bf515442af452e3283bf268d9943a6f6bc
Logging: 9ef4ecb546ad3169398d5a723bc9bea1c46bef26
MessagePacker: ab2fe250e86ea7aedd1a9ee47a37083edd41fd02
MMKV: 506311d0494023c2f7e0b62cc1f31b7370fa3cfb
MMKVCore: 9e2e5fd529b64a9fe15f1a7afb3d73b2e27b4db9
MMKV: 36a22a9ec84c9bb960613a089ddf6f48be9312b0
MMKVCore: 158e61c8516401a9fac730288acb29e6fc19bbf9
OpenSSL-Universal: 6e1ae0555546e604dbc632a2b9a24a9c46c41ef6
RCT-Folly: 424b8c9a7a0b9ab2886ffe9c3b041ef628fd4fb1
RCTRequired: e9df143e880d0e879e7a498dc06923d728809c79
Expand Down Expand Up @@ -763,8 +763,8 @@ SPEC CHECKSUMS:
secp256k1.swift: a7e7a214f6db6ce5db32cc6b2b45e5c4dd633634
SwiftProtobuf: 407a385e97fd206c4fbe880cc84123989167e0d1
web3.swift: 2263d1e12e121b2c42ffb63a5a7beb1acaf33959
XMTP: ca70dd11d709df02999325663e677fe775623d1e
XMTPReactNative: 1b79a6c8748387062ebcebe2c345f77f4998cae2
XMTP: 854ac67c24b20917786b5586ba9605b725b43e8b
XMTPReactNative: 7f42b3cbd4a2ef8a86b9b698355b3f457f288d6e
Yoga: e71803b4c1fff832ccf9b92541e00f9b873119b9

PODFILE CHECKSUM: 95d6ace79946933ecf80684613842ee553dd76a2
Expand Down

0 comments on commit 8d56037

Please sign in to comment.