Skip to content

Commit

Permalink
return members as strings not objects
Browse files Browse the repository at this point in the history
  • Loading branch information
nakajima committed Feb 5, 2024
1 parent e29fde8 commit 2c3d5e3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions Sources/XMTPiOS/Group.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public struct Group: Identifiable, Equatable, Hashable {
var ffiGroup: FfiGroup
var client: Client

public struct Member {
struct Member {
var ffiGroupMember: FfiGroupMember

public var accountAddress: String {
Expand All @@ -36,9 +36,9 @@ public struct Group: Identifiable, Equatable, Hashable {
id.hash(into: &hasher)
}

public var members: [Member] {
public var members: [String] {
do {
return try ffiGroup.listMembers().map(\.fromFFI)
return try ffiGroup.listMembers().map(\.fromFFI.accountAddress)
} catch {
return []
}
Expand Down
8 changes: 4 additions & 4 deletions Tests/XMTPTests/GroupTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class GroupTests: XCTestCase {
let group = try await fixtures.aliceClient.conversations.newGroup(with: [fixtures.bob.address])

try await group.sync()
let members = group.members.map(\.accountAddress.localizedLowercase).sorted()
let members = group.members.map(\.localizedLowercase).sorted()

XCTAssertEqual([fixtures.bob.address.localizedLowercase, fixtures.alice.address.localizedLowercase].sorted(), members)
}
Expand All @@ -108,7 +108,7 @@ class GroupTests: XCTestCase {
try await group.addMembers(addresses: [fixtures.fred.address])

try await group.sync()
let members = group.members.map(\.accountAddress.localizedLowercase).sorted()
let members = group.members.map(\.localizedLowercase).sorted()

XCTAssertEqual([
fixtures.bob.address.localizedLowercase,
Expand All @@ -125,7 +125,7 @@ class GroupTests: XCTestCase {
let group = try await fixtures.aliceClient.conversations.newGroup(with: [fixtures.bob.address, fixtures.fred.address])

try await group.sync()
let members = group.members.map(\.accountAddress.localizedLowercase).sorted()
let members = group.members.map(\.localizedLowercase).sorted()

XCTAssertEqual([
fixtures.bob.address.localizedLowercase,
Expand All @@ -137,7 +137,7 @@ class GroupTests: XCTestCase {

try await group.sync()

let newMembers = group.members.map(\.accountAddress.localizedLowercase).sorted()
let newMembers = group.members.map(\.localizedLowercase).sorted()
XCTAssertEqual([
fixtures.bob.address.localizedLowercase,
fixtures.alice.address.localizedLowercase,
Expand Down

0 comments on commit 2c3d5e3

Please sign in to comment.