From ede81225aec813acb1061c76ffbb2fcc6b07fea3 Mon Sep 17 00:00:00 2001 From: Naomi Plasterer Date: Fri, 13 Sep 2024 13:22:24 -0600 Subject: [PATCH 1/2] update package --- .../project.xcworkspace/xcshareddata/swiftpm/Package.resolved | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/XMTPiOSExample/XMTPiOSExample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/XMTPiOSExample/XMTPiOSExample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index a874b2a3..4d3d866a 100644 --- a/XMTPiOSExample/XMTPiOSExample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/XMTPiOSExample/XMTPiOSExample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -59,8 +59,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/xmtp/libxmtp-swift.git", "state" : { - "revision" : "06e890646a32c3ae9b9ac78150a7ec4971e54c9d", - "version" : "0.5.8-beta3" + "revision" : "abd4f896f539e5bb090c85022177d775ad08dcb1", + "version" : "0.5.8-beta4" } }, { From bd61f52b8351988c7e30e0eb358dfff3fa081b7c Mon Sep 17 00:00:00 2001 From: Naomi Plasterer Date: Mon, 4 Nov 2024 14:32:53 -0800 Subject: [PATCH 2/2] add a test for pagination --- Tests/XMTPTests/GroupTests.swift | 42 ++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/Tests/XMTPTests/GroupTests.swift b/Tests/XMTPTests/GroupTests.swift index 0a392e4e..b073d099 100644 --- a/Tests/XMTPTests/GroupTests.swift +++ b/Tests/XMTPTests/GroupTests.swift @@ -88,6 +88,48 @@ class GroupTests: XCTestCase { ) } + func testCanListGroupMessagesAfter() async throws { + let fixtures = try await localFixtures() + + let group = try await fixtures.bobClient.conversations.newGroup(with: [fixtures.alice.walletAddress]) + + try await group.send(content: "howdy") + try await group.send(content: "gm") + + let time = Date() + + var messages = try await group.messages() + XCTAssertEqual(messages.count, 3) + + let messagesAfterTime = try await group.messages(after: time) + XCTAssertEqual(messagesAfterTime.count, 0) + + try await group.send(content: "howdy") + try await group.send(content: "gm") + + messages = try await group.messages() + XCTAssertEqual(messages.count, 5) + + let updatedMessagesAfterTime = try await group.messages(after: time) + XCTAssertEqual(updatedMessagesAfterTime.count, 2) + + try await fixtures.aliceClient.conversations.sync() + + let groups = try await fixtures.aliceClient.conversations.groups() + guard let sameGroup = groups.last else { + XCTFail("No groups found") + return + } + + try await sameGroup.sync() + + let sameGroupMessages = try await sameGroup.messages() + XCTAssertEqual(sameGroupMessages.count, 4) + + let sameGroupMessagesAfterTime = try await sameGroup.messages(after: time) + XCTAssertEqual(sameGroupMessagesAfterTime.count, 2) + } + func testCanDualSendConversations() async throws { let fixtures = try await localFixtures() let v2Convo = try await fixtures.aliceClient.conversations.newConversation(with: fixtures.bob.walletAddress)