diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index d8a11bd6e..6dd41edbf 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -762,4 +762,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 95d6ace79946933ecf80684613842ee553dd76a2 -COCOAPODS: 1.14.2 +COCOAPODS: 1.15.2 diff --git a/example/src/ConversationScreen.tsx b/example/src/ConversationScreen.tsx index 86531bc1c..6cbe84d64 100644 --- a/example/src/ConversationScreen.tsx +++ b/example/src/ConversationScreen.tsx @@ -108,7 +108,11 @@ export default function ConversationScreen({ } const sendRemoteAttachmentMessage = () => { if (remoteAttachment) { - sendMessage({ remoteAttachment }).then(() => setAttachment(null)) + sendMessage({ remoteAttachment }) + .then(() => setAttachment(null)) + .catch((e) => { + console.error('Error sending message: ', e) + }) } } const sendTextMessage = () => sendMessage({ text }).then(() => setText('')) @@ -982,7 +986,14 @@ function MessageItem({ visible={showNewReaction} onReaction={(reaction) => { setShowNewReaction(false) - performReaction && performReaction('added', reaction) + performReaction && + performReaction('added', reaction) + .then(() => { + console.log('Reaction added successfully') + }) + .catch((error) => { + console.error('Error adding reaction', error) + }) }} /> diff --git a/example/src/GroupScreen.tsx b/example/src/GroupScreen.tsx index 4c4909427..c55116d26 100644 --- a/example/src/GroupScreen.tsx +++ b/example/src/GroupScreen.tsx @@ -8,7 +8,7 @@ import * as ImagePicker from 'expo-image-picker' import type { ImagePickerAsset } from 'expo-image-picker' import { PermissionStatus } from 'expo-modules-core' import moment from 'moment' -import React, { FC, useCallback, useMemo, useRef, useState } from 'react' +import React, { useCallback, useMemo, useRef, useState } from 'react' import { Button, FlatList, @@ -110,7 +110,11 @@ export default function GroupScreen({ } const sendRemoteAttachmentMessage = () => { if (remoteAttachment) { - sendMessage({ remoteAttachment }).then(() => setAttachment(null)) + sendMessage({ remoteAttachment }) + .then(() => setAttachment(null)) + .catch((e) => { + console.error('Error sending message: ', e) + }) } } const sendTextMessage = () => sendMessage({ text }).then(() => setText('')) @@ -982,7 +986,14 @@ function MessageItem({ visible={showNewReaction} onReaction={(reaction) => { setShowNewReaction(false) - performReaction && performReaction('added', reaction) + performReaction && + performReaction('added', reaction) + .then(() => { + console.log('Reaction added successfully') + }) + .catch((error) => { + console.error('Error adding reaction', error) + }) }} /> diff --git a/example/src/HomeScreen.tsx b/example/src/HomeScreen.tsx index 82537d4e4..656b40c78 100644 --- a/example/src/HomeScreen.tsx +++ b/example/src/HomeScreen.tsx @@ -105,6 +105,9 @@ function GroupListItem({ ?.sync() .then(() => group.messages()) .then(setMessages) + .catch((e) => { + console.error('Error fetching group messages: ', e) + }) }, [group]) return ( @@ -154,14 +157,24 @@ function ConversationItem({ const [getConsentState, setConsentState] = useState() useEffect(() => { - conversation.consentState().then((result) => { - setConsentState(result) - }) + conversation + .consentState() + .then((result) => { + setConsentState(result) + }) + .catch((e) => { + console.error('Error setting consent state: ', e) + }) }, [conversation]) - const denyContact = () => { - client?.contacts.deny([conversation.peerAddress]) - conversation.consentState().then(setConsentState) + const denyContact = async () => { + await client?.contacts.deny([conversation.peerAddress]) + conversation + .consentState() + .then(setConsentState) + .catch((e) => { + console.error('Error denying contact: ', e) + }) } return ( diff --git a/example/src/LaunchScreen.tsx b/example/src/LaunchScreen.tsx index 32c04645e..acfce332c 100644 --- a/example/src/LaunchScreen.tsx +++ b/example/src/LaunchScreen.tsx @@ -85,7 +85,9 @@ export default function LaunchScreen( } else { setSignerAddressDisplay('loading...') } - })() + })().catch((e) => { + console.error("Error displaying signers's address", e) + }) }, [signer]) return ( diff --git a/example/src/TestScreen.tsx b/example/src/TestScreen.tsx index 3eea134c1..41c59131b 100644 --- a/example/src/TestScreen.tsx +++ b/example/src/TestScreen.tsx @@ -47,7 +47,9 @@ function TestView({ useEffect(() => { ;(async () => { await run() - })() + })().catch((e) => { + console.error(e) + }) }, [test]) const backgroundColor = { diff --git a/example/src/hooks.tsx b/example/src/hooks.tsx index 43880c4a1..8daa137cc 100644 --- a/example/src/hooks.tsx +++ b/example/src/hooks.tsx @@ -24,7 +24,14 @@ export function useConversationList(): UseQueryResult< Conversation[] > { const { client } = useXmtp() - client?.contacts.refreshConsentList() + client?.contacts + .refreshConsentList() + .then(() => { + console.log('Refreshed consent list successfully') + }) + .catch((error) => { + console.error('Error refreshing consent list', error) + }) return useQuery[]>( ['xmtp', 'conversations', client?.address], () => client!.conversations.list(),