Skip to content

Commit

Permalink
Merge pull request #282 from xmtp/np/fix-member-addresses
Browse files Browse the repository at this point in the history
Fix peer addresses actually returns peer addresses
  • Loading branch information
nplasterer authored Feb 22, 2024
2 parents f6e091c + 9907095 commit ea710dc
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 8 deletions.
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ dependencies {
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 "org.xmtp:android:0.7.15"
implementation "org.xmtp:android:0.7.17"
// xmtp-android local testing setup below (comment org.xmtp:android above)
// implementation files('<PATH TO XMTP-ANDROID>/xmtp-android/library/build/outputs/aar/library-debug.aar')
// implementation 'com.google.crypto.tink:tink-android:1.7.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.util.Base64
import android.util.Base64.NO_WRAP
import com.google.gson.GsonBuilder
import org.xmtp.android.library.Client
import org.xmtp.android.library.Conversation
import org.xmtp.android.library.Group
import org.xmtp.android.library.toHex
import uniffi.xmtpv3.GroupPermissions
Expand All @@ -20,7 +21,7 @@ class GroupWrapper {
"clientAddress" to client.address,
"id" to group.id.toHex(),
"createdAt" to group.createdAt.time,
"peerAddresses" to group.memberAddresses(),
"peerAddresses" to Conversation.Group(group).peerAddresses,
"version" to "GROUP",
"topic" to group.id.toHex(),
"permissionLevel" to permissionString,
Expand Down
8 changes: 4 additions & 4 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ PODS:
- GenericJSON (~> 2.0)
- Logging (~> 1.0.0)
- secp256k1.swift (~> 0.1)
- XMTP (0.8.10):
- XMTP (0.8.13):
- Connect-Swift (= 0.3.0)
- GzipSwift
- LibXMTP (= 0.4.2-beta3)
Expand All @@ -451,7 +451,7 @@ PODS:
- ExpoModulesCore
- MessagePacker
- secp256k1.swift
- XMTP (= 0.8.10)
- XMTP (= 0.8.13)
- Yoga (1.14.0)

DEPENDENCIES:
Expand Down Expand Up @@ -744,8 +744,8 @@ SPEC CHECKSUMS:
secp256k1.swift: a7e7a214f6db6ce5db32cc6b2b45e5c4dd633634
SwiftProtobuf: b02b5075dcf60c9f5f403000b3b0c202a11b6ae1
web3.swift: 2263d1e12e121b2c42ffb63a5a7beb1acaf33959
XMTP: 2c9f62b75b68e28ce91b67a7fb56ca71b7e22e87
XMTPReactNative: 734154aef1c07f656641a587e9cc31e8cf8b587b
XMTP: 0424f5521008373eaa0a8cdba9d4244ba13700f2
XMTPReactNative: cba9ca301d6ae82f649702e5befb3551f98d679f
Yoga: e71803b4c1fff832ccf9b92541e00f9b873119b9

PODFILE CHECKSUM: 95d6ace79946933ecf80684613842ee553dd76a2
Expand Down
16 changes: 16 additions & 0 deletions example/src/tests/groupTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ test('can message in a group', async () => {
if (memberAddresses.length !== 3) {
throw new Error('num group members should be 3')
}
const peerAddresses = await aliceGroup.peerAddresses
if (peerAddresses.length !== 2) {
throw new Error('num peer group members should be 2')
}
const lowercasedAddresses: string[] = memberAddresses.map((s) =>
s.toLowerCase()
)
Expand All @@ -144,6 +148,18 @@ test('can message in a group', async () => {
throw new Error('missing address')
}

const lowercasedPeerAddresses: string[] = peerAddresses.map((s) =>
s.toLowerCase()
)
if (
!(
lowercasedPeerAddresses.includes(bobClient.address.toLowerCase()) &&
lowercasedPeerAddresses.includes(camClient.address.toLowerCase())
)
) {
throw new Error('should include self')
}

// Alice can send messages
await aliceGroup.send('hello, world')
await aliceGroup.send('gm')
Expand Down
2 changes: 1 addition & 1 deletion ios/Wrappers/GroupWrapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct GroupWrapper {
"clientAddress": client.address,
"id": group.id.toHex,
"createdAt": UInt64(group.createdAt.timeIntervalSince1970 * 1000),
"peerAddresses": group.memberAddresses,
"peerAddresses": XMTP.Conversation.group(group).peerAddresses,
"version": "GROUP",
"topic": group.id.toHex,
"permissionLevel": permissionString,
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.8.10"
s.dependency "XMTP", "= 0.8.13"
end

0 comments on commit ea710dc

Please sign in to comment.