@@ -20,6 +20,7 @@ import org.xmtp.android.library.messages.MessageBuilder
20
20
import org.xmtp.android.library.messages.MessageHeaderV2Builder
21
21
import org.xmtp.android.library.messages.MessageV1Builder
22
22
import org.xmtp.android.library.messages.MessageV2Builder
23
+ import org.xmtp.android.library.messages.Pagination
23
24
import org.xmtp.android.library.messages.PrivateKey
24
25
import org.xmtp.android.library.messages.PrivateKeyBuilder
25
26
import org.xmtp.android.library.messages.SealedInvitationBuilder
@@ -419,27 +420,48 @@ class ConversationTest {
419
420
420
421
@Test
421
422
fun testListBatchMessages () {
422
- val bobConversation = bobClient.conversations.newConversation(
423
- alice.walletAddress,
424
- context = InvitationV1ContextBuilder .buildFromConversation(" hi" )
425
- )
423
+ val bobConversation = aliceClient.conversations.newConversation(bob.walletAddress)
424
+ val steveConversation = aliceClient.conversations.newConversation(fixtures.steve.walletAddress)
426
425
427
- val aliceConversation = aliceClient.conversations.newConversation(
428
- bob.walletAddress,
429
- context = InvitationV1ContextBuilder .buildFromConversation(" hi" )
430
- )
431
426
bobConversation.send(text = " hey alice 1" )
432
427
bobConversation.send(text = " hey alice 2" )
433
- bobConversation .send(text = " hey alice 3" )
428
+ steveConversation .send(text = " hey alice 3" )
434
429
val messages = aliceClient.conversations.listBatchMessages(
435
430
listOf (
436
- aliceConversation .topic,
437
- bobConversation.topic
431
+ Pair (steveConversation .topic, null ) ,
432
+ Pair ( bobConversation.topic, null )
438
433
)
439
434
)
440
435
assertEquals(3 , messages.size)
441
436
}
442
437
438
+ @Test
439
+ fun testListBatchMessagesWithPagination () {
440
+ val bobConversation = aliceClient.conversations.newConversation(bob.walletAddress)
441
+ val steveConversation =
442
+ aliceClient.conversations.newConversation(fixtures.steve.walletAddress)
443
+
444
+ bobConversation.send(text = " hey alice 1 bob" )
445
+ steveConversation.send(text = " hey alice 1 steve" )
446
+
447
+ Thread .sleep(100 )
448
+ val date = Date ()
449
+
450
+ bobConversation.send(text = " hey alice 2 bob" )
451
+ bobConversation.send(text = " hey alice 3 bob" )
452
+ steveConversation.send(text = " hey alice 2 steve" )
453
+ steveConversation.send(text = " hey alice 3 steve" )
454
+
455
+ val messages = aliceClient.conversations.listBatchMessages(
456
+ listOf (
457
+ Pair (steveConversation.topic, Pagination (after = date)),
458
+ Pair (bobConversation.topic, Pagination (after = date))
459
+ )
460
+ )
461
+
462
+ assertEquals(4 , messages.size)
463
+ }
464
+
443
465
@Test
444
466
fun testImportV1ConversationFromJS () {
445
467
val jsExportJSONData =
0 commit comments