Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync all syncs all #550

Merged
merged 11 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ repositories {
dependencies {
implementation project(':expo-modules-core')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}"
implementation "org.xmtp:android:3.0.10"
implementation "org.xmtp:android:3.0.13"
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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,14 +332,14 @@ class XMTPModule : Module() {
}
}

AsyncFunction("build") Coroutine { address: String, dbEncryptionKey: List<Int>, authParams: String ->
AsyncFunction("build") Coroutine { address: String, inboxId: String?, dbEncryptionKey: List<Int>, authParams: String ->
withContext(Dispatchers.IO) {
logV("build")
val options = clientOptions(
dbEncryptionKey,
authParams,
)
val client = Client().build(address = address, options = options)
val client = Client().build(address = address, options = options, inboxId = inboxId)
ContentJson.Companion
clients[client.installationId] = client
ClientWrapper.encodeToObj(client)
Expand Down Expand Up @@ -444,6 +444,17 @@ class XMTPModule : Module() {
}
}

AsyncFunction("staticCanMessage") Coroutine { environment: String, peerAddresses: List<String> ->
withContext(Dispatchers.IO) {
logV("staticCanMessage")
Client.canMessage(
peerAddresses,
context,
apiEnvironments(environment, null)
)
}
}

AsyncFunction("getOrCreateInboxId") Coroutine { address: String, environment: String ->
withContext(Dispatchers.IO) {
try {
Expand Down
23 changes: 16 additions & 7 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ PODS:
- hermes-engine/Pre-built (= 0.71.14)
- hermes-engine/Pre-built (0.71.14)
- libevent (2.1.12)
- LibXMTP (3.0.7)
- LibXMTP (3.0.9)
- MessagePacker (0.4.7)
- MMKV (2.0.0):
- MMKVCore (~> 2.0.0)
Expand Down Expand Up @@ -440,17 +440,24 @@ PODS:
- React-RCTImage
- RNSVG (13.14.0):
- React-Core
- SQLCipher (4.5.7):
- SQLCipher/standard (= 4.5.7)
- SQLCipher/common (4.5.7)
- SQLCipher/standard (4.5.7):
- SQLCipher/common
- SwiftProtobuf (1.28.2)
- XMTP (3.0.10):
- XMTP (3.0.13):
- Connect-Swift (= 1.0.0)
- CryptoSwift (= 1.8.3)
- CSecp256k1 (~> 0.2)
- LibXMTP (= 3.0.7)
- LibXMTP (= 3.0.9)
- SQLCipher (= 4.5.7)
- XMTPReactNative (0.1.0):
- CSecp256k1 (~> 0.2)
- ExpoModulesCore
- MessagePacker
- XMTP (= 3.0.10)
- SQLCipher (= 4.5.7)
- XMTP (= 3.0.13)
- Yoga (1.14.0)

DEPENDENCIES:
Expand Down Expand Up @@ -536,6 +543,7 @@ SPEC REPOS:
- MMKV
- MMKVCore
- OpenSSL-Universal
- SQLCipher
- SwiftProtobuf
- XMTP

Expand Down Expand Up @@ -698,7 +706,7 @@ SPEC CHECKSUMS:
glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b
hermes-engine: d7cc127932c89c53374452d6f93473f1970d8e88
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
LibXMTP: 1d9b9514c2b6407a82d72b203288cd5af064d787
LibXMTP: c1bdf81e52b0e995b3aabf962a2b068e4ea184d0
MessagePacker: ab2fe250e86ea7aedd1a9ee47a37083edd41fd02
MMKV: f7d1d5945c8765f97f39c3d121f353d46735d801
MMKVCore: c04b296010fcb1d1638f2c69405096aac12f6390
Expand Down Expand Up @@ -746,9 +754,10 @@ SPEC CHECKSUMS:
RNFS: 4ac0f0ea233904cb798630b3c077808c06931688
RNScreens: 218801c16a2782546d30bd2026bb625c0302d70f
RNSVG: d00c8f91c3cbf6d476451313a18f04d220d4f396
SQLCipher: 5e6bfb47323635c8b657b1b27d25c5f1baf63bf5
SwiftProtobuf: 4dbaffec76a39a8dc5da23b40af1a5dc01a4c02d
XMTP: 22bd60ccd58801953c1bbc7619b0046b2eef5b97
XMTPReactNative: 48e8bbbb9c1800cd507121bd9918aa4a571e8237
XMTP: 0c1529391b3ed63136498fdf4a95515c296050a3
XMTPReactNative: 9f22be223ee1bac2f0cfbbddc9cf0d5ac4b68e86
Yoga: e71803b4c1fff832ccf9b92541e00f9b873119b9

PODFILE CHECKSUM: 0e6fe50018f34e575d38dc6a1fdf1f99c9596cdd
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,13 +296,15 @@
"${PODS_CONFIGURATION_BUILD_DIR}/CryptoSwift/CryptoSwift.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/EXConstants/EXConstants.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/React-Core/AccessibilityResources.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/SQLCipher/SQLCipher.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/SwiftProtobuf/SwiftProtobuf.bundle",
);
name = "[CP] Copy Pods Resources";
outputPaths = (
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/CryptoSwift.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/EXConstants.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/AccessibilityResources.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/SQLCipher.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/SwiftProtobuf.bundle",
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
28 changes: 28 additions & 0 deletions example/src/tests/clientTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,34 @@ test('can make a client', async () => {
return true
})

test('static can message', async () => {
const [alix, bo] = await createClients(2)

const addressMap = await Client.canMessage('local', [
alix.address,
'0x4E9ce36E442e55EcD9025B9a6E0D88485d628A67',
bo.address,
])

assert(
addressMap[
'0x4E9ce36E442e55EcD9025B9a6E0D88485d628A67'.toLocaleLowerCase()
] === false,
`should not be able to message 0x4E9ce36E442e55EcD9025B9a6E0D88485d628A67`
)

assert(
addressMap[alix.address.toLowerCase()] === true,
`should be able to message ${alix.address}`
)

assert(
addressMap[bo.address.toLowerCase()] === true,
`should be able to message ${bo.address}`
)
return true
})

test('can revoke all other installations', async () => {
const keyBytes = new Uint8Array([
233, 120, 198, 96, 154, 65, 132, 17, 132, 96, 250, 40, 103, 35, 125, 64,
Expand Down
4 changes: 0 additions & 4 deletions example/src/tests/conversationTests.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import RNFS from 'react-native-fs'

Check warning on line 1 in example/src/tests/conversationTests.ts

View workflow job for this annotation

GitHub Actions / lint

There should be at least one empty line between import groups
import { Test, assert, createClients, delayToPropogate } from './test-utils'
import {

Check warning on line 3 in example/src/tests/conversationTests.ts

View workflow job for this annotation

GitHub Actions / lint

There should be at least one empty line between import groups
Client,
ConsentRecord,
Conversation,
ConversationId,
ConversationVersion,
} from '../../../src/index'
import { Wallet } from 'ethers'

Check warning on line 10 in example/src/tests/conversationTests.ts

View workflow job for this annotation

GitHub Actions / lint

`ethers` import should occur before import of `react-native-fs`

export const conversationTests: Test[] = []
let counter = 1
Expand Down Expand Up @@ -603,8 +603,6 @@
// Sync conversations
await bo.conversations.sync()
if (boDm) await boDm.sync()
await alix.conversations.sync()
await alix2.conversations.sync()
await alix2.preferences.syncConsent()
await alix.conversations.syncAllConversations()
await delayToPropogate(2000)
Expand Down Expand Up @@ -667,8 +665,6 @@
})

await alixGroup.send('Hello')
await alix.conversations.sync()
await alix2.conversations.sync()
await alix.conversations.syncAllConversations()
await alix2.conversations.syncAllConversations()

Expand Down
Loading
Loading