From e23d291bf39cfb9830173c4c94069fdbad578681 Mon Sep 17 00:00:00 2001 From: Naomi Plasterer Date: Wed, 5 Jun 2024 14:10:04 -0700 Subject: [PATCH 1/3] update js doc --- src/lib/Group.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/Group.ts b/src/lib/Group.ts index 69e600080..642b40de9 100644 --- a/src/lib/Group.ts +++ b/src/lib/Group.ts @@ -55,8 +55,8 @@ export class Group< } /** - * This method returns an array of addresses associated with the group. - * To get the latest member addresses from the network, call sync() first. + * This method returns an array of inboxIds associated with the group. + * To get the latest member inboxIds from the network, call sync() first. * @returns {Promise[]>} A Promise that resolves to an array of DecodedMessage objects. */ async memberInboxIds(): Promise { From 886e5d61f18cc4928e4a5e71a40697625bccaba3 Mon Sep 17 00:00:00 2001 From: Naomi Plasterer Date: Thu, 6 Jun 2024 18:02:25 -0700 Subject: [PATCH 2/3] update the pod --- example/ios/Podfile.lock | 8 +-- example/src/tests/groupTests.ts | 96 +++++++++++++++++---------------- ios/XMTPReactNative.podspec | 2 +- 3 files changed, 56 insertions(+), 50 deletions(-) diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 981b99906..3fbbdd707 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -449,7 +449,7 @@ PODS: - GenericJSON (~> 2.0) - Logging (~> 1.0.0) - secp256k1.swift (~> 0.1) - - XMTP (0.11.3): + - XMTP (0.11.4): - Connect-Swift (= 0.12.0) - GzipSwift - LibXMTP (= 0.5.1-beta0) @@ -458,7 +458,7 @@ PODS: - ExpoModulesCore - MessagePacker - secp256k1.swift - - XMTP (= 0.11.3) + - XMTP (= 0.11.4) - Yoga (1.14.0) DEPENDENCIES: @@ -763,8 +763,8 @@ SPEC CHECKSUMS: secp256k1.swift: a7e7a214f6db6ce5db32cc6b2b45e5c4dd633634 SwiftProtobuf: 407a385e97fd206c4fbe880cc84123989167e0d1 web3.swift: 2263d1e12e121b2c42ffb63a5a7beb1acaf33959 - XMTP: 3e8e649cc8a6cebe4a1a16f6c396a273fefb2662 - XMTPReactNative: 602e98fa5dfa0fe17c1bda5a94c7efbaa693c38c + XMTP: 93c576a55976baeec67f3cc3911c1db8dbd3f86d + XMTPReactNative: 930c288252e5a4b9946d053385ff9e26b4036d8d Yoga: e71803b4c1fff832ccf9b92541e00f9b873119b9 PODFILE CHECKSUM: 95d6ace79946933ecf80684613842ee553dd76a2 diff --git a/example/src/tests/groupTests.ts b/example/src/tests/groupTests.ts index 4dce7acc8..603a7c840 100644 --- a/example/src/tests/groupTests.ts +++ b/example/src/tests/groupTests.ts @@ -1,3 +1,4 @@ +import RNFS from 'react-native-fs' import { DecodedMessage } from 'xmtp-react-native-sdk/lib/DecodedMessage' import { @@ -22,65 +23,70 @@ function test(name: string, perform: () => Promise) { groupTests.push({ name: String(counter++) + '. ' + name, run: perform }) } -test('can make a MLS V3 client', async () => { - // eslint-disable-next-line @typescript-eslint/no-unused-vars - const client = await Client.createRandom({ - env: 'local', - appVersion: 'Testing/0.0.0', - enableAlphaMls: true, - }) - - return true -}) +// test('can make a MLS V3 client', async () => { +// // eslint-disable-next-line @typescript-eslint/no-unused-vars +// const client = await Client.createRandom({ +// env: 'local', +// appVersion: 'Testing/0.0.0', +// enableAlphaMls: true, +// }) -test('can delete a local database', async () => { - let [client, anotherClient] = await createClients(2) - - await client.conversations.newGroup([anotherClient.address]) - await client.conversations.syncGroups() - assert( - (await client.conversations.listGroups()).length === 1, - `should have a group size of 1 but was ${ - (await client.conversations.listGroups()).length - }` - ) +// return true +// }) - await client.deleteLocalDatabase() - client = await Client.createRandom({ - env: 'local', - appVersion: 'Testing/0.0.0', - enableAlphaMls: true, - dbEncryptionKey: new Uint8Array([ - 233, 120, 198, 96, 154, 65, 132, 17, 132, 96, 250, 40, 103, 35, 125, 64, - 166, 83, 208, 224, 254, 44, 205, 227, 175, 49, 234, 129, 74, 252, 135, - 145, - ]), - }) - await client.conversations.syncGroups() - assert( - (await client.conversations.listGroups()).length === 0, - `should have a group size of 0 but was ${ - (await client.conversations.listGroups()).length - }` - ) +// test('can delete a local database', async () => { +// let [client, anotherClient] = await createClients(2) + +// await client.conversations.newGroup([anotherClient.address]) +// await client.conversations.syncGroups() +// assert( +// (await client.conversations.listGroups()).length === 1, +// `should have a group size of 1 but was ${ +// (await client.conversations.listGroups()).length +// }` +// ) + +// await client.deleteLocalDatabase() +// client = await Client.createRandom({ +// env: 'local', +// appVersion: 'Testing/0.0.0', +// enableAlphaMls: true, +// dbEncryptionKey: new Uint8Array([ +// 233, 120, 198, 96, 154, 65, 132, 17, 132, 96, 250, 40, 103, 35, 125, 64, +// 166, 83, 208, 224, 254, 44, 205, 227, 175, 49, 234, 129, 74, 252, 135, +// 145, +// ]), +// }) +// await client.conversations.syncGroups() +// assert( +// (await client.conversations.listGroups()).length === 0, +// `should have a group size of 0 but was ${ +// (await client.conversations.listGroups()).length +// }` +// ) - return true -}) +// return true +// }) test('can make a MLS V3 client with encryption key and database directory', async () => { // eslint-disable-next-line @typescript-eslint/no-unused-vars - const dbDir = 'xmtp_db' - + const dbDirPath = `${RNFS.DocumentDirectoryPath}/xmtp_db` + const directoryExists = await RNFS.exists(dbDirPath) + if (!directoryExists) { + await RNFS.mkdir(dbDirPath) + } + console.log(dbDirPath) const key = new Uint8Array([ 233, 120, 198, 96, 154, 65, 132, 17, 132, 96, 250, 40, 103, 35, 125, 64, 166, 83, 208, 224, 254, 44, 205, 227, 175, 49, 234, 129, 74, 252, 135, 145, ]) + const client = await Client.createRandom({ env: 'local', appVersion: 'Testing/0.0.0', enableAlphaMls: true, dbEncryptionKey: key, - dbDirectory: dbDir, + dbDirectory: dbDirPath, }) const anotherClient = await Client.createRandom({ @@ -104,7 +110,7 @@ test('can make a MLS V3 client with encryption key and database directory', asyn appVersion: 'Testing/0.0.0', enableAlphaMls: true, dbEncryptionKey: key, - dbDirectory: dbDir, + dbDirectory: dbDirPath, }) assert( diff --git a/ios/XMTPReactNative.podspec b/ios/XMTPReactNative.podspec index 22e140c5e..40611a765 100644 --- a/ios/XMTPReactNative.podspec +++ b/ios/XMTPReactNative.podspec @@ -26,5 +26,5 @@ Pod::Spec.new do |s| s.source_files = "**/*.{h,m,swift}" s.dependency 'secp256k1.swift' s.dependency "MessagePacker" - s.dependency "XMTP", "= 0.11.3" + s.dependency "XMTP", "= 0.11.4" end From c35adafd1593ed6e7da67bb7f8dd1ebf2f28b89b Mon Sep 17 00:00:00 2001 From: Naomi Plasterer Date: Thu, 6 Jun 2024 18:03:06 -0700 Subject: [PATCH 3/3] fix: bump the android version --- android/build.gradle | 2 +- example/src/tests/groupTests.ts | 83 ++++++++++++++++----------------- 2 files changed, 42 insertions(+), 43 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 41cbb4ca4..d1e92d799 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -98,7 +98,7 @@ repositories { dependencies { implementation project(':expo-modules-core') implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}" - implementation "org.xmtp:android:0.12.2" + implementation "org.xmtp:android:0.12.3" 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/groupTests.ts b/example/src/tests/groupTests.ts index 603a7c840..e9e4e9a45 100644 --- a/example/src/tests/groupTests.ts +++ b/example/src/tests/groupTests.ts @@ -23,50 +23,50 @@ function test(name: string, perform: () => Promise) { groupTests.push({ name: String(counter++) + '. ' + name, run: perform }) } -// test('can make a MLS V3 client', async () => { -// // eslint-disable-next-line @typescript-eslint/no-unused-vars -// const client = await Client.createRandom({ -// env: 'local', -// appVersion: 'Testing/0.0.0', -// enableAlphaMls: true, -// }) +test('can make a MLS V3 client', async () => { + // eslint-disable-next-line @typescript-eslint/no-unused-vars + const client = await Client.createRandom({ + env: 'local', + appVersion: 'Testing/0.0.0', + enableAlphaMls: true, + }) -// return true -// }) + return true +}) -// test('can delete a local database', async () => { -// let [client, anotherClient] = await createClients(2) - -// await client.conversations.newGroup([anotherClient.address]) -// await client.conversations.syncGroups() -// assert( -// (await client.conversations.listGroups()).length === 1, -// `should have a group size of 1 but was ${ -// (await client.conversations.listGroups()).length -// }` -// ) - -// await client.deleteLocalDatabase() -// client = await Client.createRandom({ -// env: 'local', -// appVersion: 'Testing/0.0.0', -// enableAlphaMls: true, -// dbEncryptionKey: new Uint8Array([ -// 233, 120, 198, 96, 154, 65, 132, 17, 132, 96, 250, 40, 103, 35, 125, 64, -// 166, 83, 208, 224, 254, 44, 205, 227, 175, 49, 234, 129, 74, 252, 135, -// 145, -// ]), -// }) -// await client.conversations.syncGroups() -// assert( -// (await client.conversations.listGroups()).length === 0, -// `should have a group size of 0 but was ${ -// (await client.conversations.listGroups()).length -// }` -// ) +test('can delete a local database', async () => { + let [client, anotherClient] = await createClients(2) -// return true -// }) + await client.conversations.newGroup([anotherClient.address]) + await client.conversations.syncGroups() + assert( + (await client.conversations.listGroups()).length === 1, + `should have a group size of 1 but was ${ + (await client.conversations.listGroups()).length + }` + ) + + await client.deleteLocalDatabase() + client = await Client.createRandom({ + env: 'local', + appVersion: 'Testing/0.0.0', + enableAlphaMls: true, + dbEncryptionKey: new Uint8Array([ + 233, 120, 198, 96, 154, 65, 132, 17, 132, 96, 250, 40, 103, 35, 125, 64, + 166, 83, 208, 224, 254, 44, 205, 227, 175, 49, 234, 129, 74, 252, 135, + 145, + ]), + }) + await client.conversations.syncGroups() + assert( + (await client.conversations.listGroups()).length === 0, + `should have a group size of 0 but was ${ + (await client.conversations.listGroups()).length + }` + ) + + return true +}) test('can make a MLS V3 client with encryption key and database directory', async () => { // eslint-disable-next-line @typescript-eslint/no-unused-vars @@ -75,7 +75,6 @@ test('can make a MLS V3 client with encryption key and database directory', asyn if (!directoryExists) { await RNFS.mkdir(dbDirPath) } - console.log(dbDirPath) const key = new Uint8Array([ 233, 120, 198, 96, 154, 65, 132, 17, 132, 96, 250, 40, 103, 35, 125, 64, 166, 83, 208, 224, 254, 44, 205, 227, 175, 49, 234, 129, 74, 252, 135, 145,