From 6dbe0469fd5a93236fcb1e71ad9ae27aa2e42f0f Mon Sep 17 00:00:00 2001 From: Naomi Plasterer Date: Wed, 1 Nov 2023 13:44:04 -0700 Subject: [PATCH 1/3] update the word block to deny --- android/build.gradle | 2 +- .../expo/modules/xmtpreactnativesdk/XMTPModule.kt | 13 +++++++------ example/src/HomeScreen.tsx | 8 ++++---- example/src/tests.ts | 14 +++++++------- ios/XMTPModule.swift | 10 +++++----- ios/XMTPReactNative.podspec | 2 +- src/index.ts | 10 +++++----- src/lib/Contacts.ts | 8 ++++---- src/lib/Conversation.ts | 2 +- 9 files changed, 35 insertions(+), 34 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index d135b80e2..9a233583a 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.7" + implementation "org.xmtp:android:0.6.8" 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/android/src/main/java/expo/modules/xmtpreactnativesdk/XMTPModule.kt b/android/src/main/java/expo/modules/xmtpreactnativesdk/XMTPModule.kt index 1e4bc02b3..6848a8e26 100644 --- a/android/src/main/java/expo/modules/xmtpreactnativesdk/XMTPModule.kt +++ b/android/src/main/java/expo/modules/xmtpreactnativesdk/XMTPModule.kt @@ -496,15 +496,16 @@ class XMTPModule : Module() { client.contacts.isAllowed(address) } - Function("isBlocked") { clientAddress: String, address: String -> - logV("isBlocked") + Function("isDenied") { clientAddress: String, address: String -> + logV("isDenied") val client = clients[clientAddress] ?: throw XMTPException("No client") - client.contacts.isBlocked(address) + client.contacts.isDenied(address) } - AsyncFunction("blockContacts") { clientAddress: String, addresses: List -> + AsyncFunction("denyContacts") { clientAddress: String, addresses: List -> + logV("denyContacts") val client = clients[clientAddress] ?: throw XMTPException("No client") - client.contacts.block(addresses) + client.contacts.deny(addresses) } AsyncFunction("allowContacts") { clientAddress: String, addresses: List -> @@ -522,7 +523,7 @@ class XMTPModule : Module() { ?: throw XMTPException("no conversation found for $conversationTopic") when (conversation.consentState()) { ConsentState.ALLOWED -> "allowed" - ConsentState.BLOCKED -> "blocked" + ConsentState.DENIED -> "denied" ConsentState.UNKNOWN -> "unknown" } } diff --git a/example/src/HomeScreen.tsx b/example/src/HomeScreen.tsx index 0f60ac520..6d89d2c40 100644 --- a/example/src/HomeScreen.tsx +++ b/example/src/HomeScreen.tsx @@ -66,7 +66,7 @@ function ConversationItem({ conversation, client }: { conversation: Conversation conversation.consentState().then(result => { setConsentState(result); }) - const blockContact = () => client?.contacts.block([conversation.peerAddress]); + const denyContact = () => client?.contacts.deny([conversation.peerAddress]); return (