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 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" diff --git a/example/src/tests.ts b/example/src/tests.ts index d3926bf66..e0ed091c7 100644 --- a/example/src/tests.ts +++ b/example/src/tests.ts @@ -495,3 +495,57 @@ 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) => { + 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++) { + await boConvo.send({ text: `Message ${i}` }); + await delayToPropogate(); + } + if (allMessages.length !== 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++) { + await caroConvo.send({ text: `Message ${i}` }); + await delayToPropogate(); + } + if (allMessages.length !== 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++) { + await boConvo.send({ text: `Message ${i}` }); + await delayToPropogate(); + } + if (allMessages.length <= 10) { + throw Error("Unexpected all messages count " + allMessages.length); + } + + + return true; +}); +