diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index c48f3a48d..689075f0a 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 (3.0.1): + - XMTP (3.0.3): - Connect-Swift (= 0.12.0) - GzipSwift - LibXMTP (= 3.0.0) @@ -458,7 +458,7 @@ PODS: - ExpoModulesCore - MessagePacker - secp256k1.swift - - XMTP (= 3.0.1) + - XMTP (= 3.0.3) - Yoga (1.14.0) DEPENDENCIES: @@ -763,8 +763,8 @@ SPEC CHECKSUMS: secp256k1.swift: a7e7a214f6db6ce5db32cc6b2b45e5c4dd633634 SwiftProtobuf: 407a385e97fd206c4fbe880cc84123989167e0d1 web3.swift: 2263d1e12e121b2c42ffb63a5a7beb1acaf33959 - XMTP: 00937113c4e6055980dcff9a51f8b70de83605aa - XMTPReactNative: 21011caca6d56cf3128b672fcba791b2009bb704 + XMTP: ab14d9456330823f1c52b08ce5281d1e20c03f7f + XMTPReactNative: f7c9dc2eadef5c7d9590d2b7764ab805d16c7a5e Yoga: e71803b4c1fff832ccf9b92541e00f9b873119b9 PODFILE CHECKSUM: 0e6fe50018f34e575d38dc6a1fdf1f99c9596cdd diff --git a/example/ios/xmtpreactnativesdkexample.xcodeproj/project.pbxproj b/example/ios/xmtpreactnativesdkexample.xcodeproj/project.pbxproj index 0d2d68566..4bfad6909 100644 --- a/example/ios/xmtpreactnativesdkexample.xcodeproj/project.pbxproj +++ b/example/ios/xmtpreactnativesdkexample.xcodeproj/project.pbxproj @@ -314,12 +314,10 @@ inputPaths = ( "${PODS_ROOT}/Target Support Files/Pods-xmtpreactnativesdkexample/Pods-xmtpreactnativesdkexample-frameworks.sh", "${PODS_XCFRAMEWORKS_BUILD_DIR}/OpenSSL-Universal/OpenSSL.framework/OpenSSL", - "${PODS_XCFRAMEWORKS_BUILD_DIR}/hermes-engine/Pre-built/hermes.framework/hermes", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/OpenSSL.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/hermes.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; diff --git a/example/src/HomeScreen.tsx b/example/src/HomeScreen.tsx index 882ab48ca..e229a48ec 100644 --- a/example/src/HomeScreen.tsx +++ b/example/src/HomeScreen.tsx @@ -15,10 +15,9 @@ import { useXmtp, DecodedMessage, } from 'xmtp-react-native-sdk' -import { Group } from 'xmtp-react-native-sdk/lib/Group' import { SupportedContentTypes } from './contentTypes/contentTypes' -import { useConversationList, useGroupsList, useMessages } from './hooks' +import { useConversationList } from './hooks' /// Show the user's list of conversations. @@ -30,17 +29,11 @@ export default function HomeScreen() { isFetching, isRefetching, } = useConversationList() - const { - data: groups, - refetch: refetchGroups, - isFetching: isFetchingGroups, - isRefetching: isRefetchingGroups, - } = useGroupsList() return ( <> - DMs + Inbox - - - Groups - - item.id} - renderItem={({ item: group }) => ( - - )} - /> - ) } -function GroupListItem({ - group, +function ConversationItem({ + conversation, client, }: { - group: Group + conversation: Conversation client: Client | null }) { const navigation = useContext(NavigationContext) @@ -103,30 +82,30 @@ function GroupListItem({ const [consentState, setConsentState] = useState() const denyGroup = async () => { - await group.updateConsent('denied') - const consent = await group.consentState() + await conversation.updateConsent('denied') + const consent = await conversation.consentState() setConsentState(consent) } useEffect(() => { - group + conversation ?.sync() - .then(() => group.messages()) + .then(() => conversation.messages()) .then(setMessages) - .then(() => group.consentState()) + .then(() => conversation.consentState()) .then((result) => { setConsentState(result) }) .catch((e) => { - console.error('Error fetching group messages: ', e) + console.error('Error fetching conversation messages: ', e) }) - }, [group]) + }, [conversation]) return ( - navigation!.navigate('group', { - id: group.id, + navigation!.navigate('conversation', { + id: conversation.id, }) } > @@ -160,75 +139,3 @@ function GroupListItem({ ) } - -function ConversationItem({ - conversation, - client, -}: { - conversation: Conversation - client: Client | null -}) { - const navigation = useContext(NavigationContext) - const { data: messages } = useMessages({ topic: conversation.topic }) - const lastMessage = messages?.[0] - const [getConsentState, setConsentState] = useState() - - useEffect(() => { - conversation - .consentState() - .then((result) => { - setConsentState(result) - }) - .catch((e) => { - console.error('Error setting consent state: ', e) - }) - }, [conversation]) - - const denyContact = async () => { - await conversation.updateConsent('denied') - conversation - .consentState() - .then(setConsentState) - .catch((e) => { - console.error('Error denying contact: ', e) - }) - } - - return ( - - navigation!.navigate('conversation', { - topic: conversation.topic, - }) - } - > - - - - ({messages?.length} messages) - -