From cc054ba5b634bd9f736b1d5035d5ea8fd8094247 Mon Sep 17 00:00:00 2001 From: Naomi Plasterer Date: Fri, 29 Sep 2023 11:48:54 -0700 Subject: [PATCH 1/4] reproduce it in a test --- example/src/tests.ts | 61 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/example/src/tests.ts b/example/src/tests.ts index d3926bf66..c405be284 100644 --- a/example/src/tests.ts +++ b/example/src/tests.ts @@ -495,3 +495,64 @@ test("can send read receipts", async () => { return true; }); +test("can stream all messages", async () => { + const bo = await XMTP.Client.createRandom({ env: "local" }); + await delayToPropogate(); + const alix = await XMTP.Client.createRandom({ env: "local" }); + await delayToPropogate(); + + // Record message stream across all conversations + const allMessages: DecodedMessage[] = []; + await alix.conversations.streamAllMessages(async (message) => { + console.log(`Pushing message ${message.id}`) + allMessages.push(message); + }); + + // Start Bob starts a new conversation. + const boConvo = await bo.conversations.newConversation(alix.address); + await delayToPropogate(); + + for (let i = 0; i < 5; i++) { + console.log(`Message ${i}`) + await boConvo.send({ text: `Message ${i}` }); + await delayToPropogate(); + } + if (allMessages.length !== 5) { + console.log("Failing here at 5") + throw Error("Unexpected all messages count " + allMessages.length); + } + + // Starts a new conversation. + const caro = await XMTP.Client.createRandom({ env: "local" }); + const caroConvo = await caro.conversations.newConversation(alix.address); + await delayToPropogate(); + for (let i = 0; i < 5; i++) { + console.log(`Message2 ${i}`) + await caroConvo.send({ text: `Message ${i}` }); + await delayToPropogate(); + } + if (allMessages.length !== 10) { + console.log("Failing here at 10") + throw Error("Unexpected all messages count " + allMessages.length); + } + + alix.conversations.cancelStreamAllMessages(); + + await alix.conversations.streamAllMessages(async (message) => { + allMessages.push(message); + }); + + for (let i = 0; i < 5; i++) { + console.log(`Message3 ${i}`) + await boConvo.send({ text: `Message ${i}` }); + await delayToPropogate(); + } + if (allMessages.length <= 10) { + console.log(`Failing here at 15 ${allMessages.length}`) + throw Error("Unexpected all messages count " + allMessages.length); + } + + + return true; +}); + From 5116921b288d2b60d8fc6324099676f69d688a7e Mon Sep 17 00:00:00 2001 From: Naomi Plasterer Date: Fri, 29 Sep 2023 17:36:27 -0700 Subject: [PATCH 2/4] remove unneeded CI work around --- .github/workflows/androidTests.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/androidTests.yml b/.github/workflows/androidTests.yml index aa4d168d4..a5e2e34be 100644 --- a/.github/workflows/androidTests.yml +++ b/.github/workflows/androidTests.yml @@ -42,13 +42,6 @@ jobs: - name: Install React Native CLI run: npm i -g react-native-cli --force - # Workaround for https://github.com/actions/runner-images/issues/8104 - - name: Fix Qemu Error - run: | - brew remove --ignore-dependencies qemu - curl -o ./qemu.rb https://raw.githubusercontent.com/Homebrew/homebrew-core/f88e30b3a23ef3735580f9b05535ce5a0a03c9e3/Formula/qemu.rb - brew install ./qemu.rb - - name: Install docker run: brew install docker docker-compose From a8ddacdb73a62fcc9c058d8ea6d5c48884449a67 Mon Sep 17 00:00:00 2001 From: Naomi Plasterer Date: Fri, 29 Sep 2023 17:40:58 -0700 Subject: [PATCH 3/4] fix: stream all messages actually streams --- android/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/build.gradle b/android/build.gradle index caa6a6a4a..bcf63beee 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -95,7 +95,7 @@ repositories { dependencies { implementation project(':expo-modules-core') implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}" - implementation "org.xmtp:android:0.6.4" + implementation "org.xmtp:android:0.6.5" 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" From 2467023d99d179aff7a734a051a48f4cf7aee8a9 Mon Sep 17 00:00:00 2001 From: Naomi Plasterer Date: Fri, 29 Sep 2023 17:48:28 -0700 Subject: [PATCH 4/4] remove the console statements from the test --- example/src/tests.ts | 7 ------- 1 file changed, 7 deletions(-) diff --git a/example/src/tests.ts b/example/src/tests.ts index c405be284..e0ed091c7 100644 --- a/example/src/tests.ts +++ b/example/src/tests.ts @@ -504,7 +504,6 @@ test("can stream all messages", async () => { // Record message stream across all conversations const allMessages: DecodedMessage[] = []; await alix.conversations.streamAllMessages(async (message) => { - console.log(`Pushing message ${message.id}`) allMessages.push(message); }); @@ -513,12 +512,10 @@ test("can stream all messages", async () => { await delayToPropogate(); for (let i = 0; i < 5; i++) { - console.log(`Message ${i}`) await boConvo.send({ text: `Message ${i}` }); await delayToPropogate(); } if (allMessages.length !== 5) { - console.log("Failing here at 5") throw Error("Unexpected all messages count " + allMessages.length); } @@ -527,12 +524,10 @@ test("can stream all messages", async () => { const caroConvo = await caro.conversations.newConversation(alix.address); await delayToPropogate(); for (let i = 0; i < 5; i++) { - console.log(`Message2 ${i}`) await caroConvo.send({ text: `Message ${i}` }); await delayToPropogate(); } if (allMessages.length !== 10) { - console.log("Failing here at 10") throw Error("Unexpected all messages count " + allMessages.length); } @@ -543,12 +538,10 @@ test("can stream all messages", async () => { }); for (let i = 0; i < 5; i++) { - console.log(`Message3 ${i}`) await boConvo.send({ text: `Message ${i}` }); await delayToPropogate(); } if (allMessages.length <= 10) { - console.log(`Failing here at 15 ${allMessages.length}`) throw Error("Unexpected all messages count " + allMessages.length); }