Skip to content

Commit fffd04b

Browse files
committed
chore: XMTP SDK version 3.1.11 + fix sending attachment
1 parent e0ff3d8 commit fffd04b

File tree

5 files changed

+38
-32
lines changed

5 files changed

+38
-32
lines changed

features/conversation/conversation-composer/conversation-composer-use-send.ts

+9-7
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,6 @@ export function useSend() {
7272
const { topic } = conversationStore.getState();
7373
const { inputValue, replyingToMessageId } = composerStore.getState();
7474

75-
// Reset the composer
76-
composerStore.getState().reset();
77-
7875
const uploadedAttachment = await handleMediaPreview();
7976

8077
const messageParamsWithTopic: Omit<ISendMessageParams, "topic"> = {
@@ -86,6 +83,9 @@ export function useSend() {
8683
}),
8784
};
8885

86+
// Reset the composer before sending just for better UX
87+
composerStore.getState().reset();
88+
8989
if (uploadedAttachment || inputValue.length > 0) {
9090
if (topic) {
9191
await sendToExistingConversation({
@@ -136,7 +136,10 @@ function useMediaPreview() {
136136

137137
async function handleMediaPreview() {
138138
const mediaPreview = composerStore.getState().composerMediaPreview;
139-
if (!mediaPreview) return null;
139+
140+
if (!mediaPreview) {
141+
return null;
142+
}
140143

141144
if (mediaPreview.status === "uploading") {
142145
await waitUntilMediaPreviewIsUploaded();
@@ -145,15 +148,14 @@ function useMediaPreview() {
145148
composerStore.getState().updateMediaPreviewStatus("sending");
146149

147150
try {
148-
if (mediaPreview) {
149-
await saveAttachmentLocally(mediaPreview);
150-
}
151+
await saveAttachmentLocally(mediaPreview);
151152
} catch (error) {
152153
sentryTrackError(error);
153154
}
154155

155156
const uploadedAttachment =
156157
composerStore.getState().composerUploadedAttachment;
158+
157159
if (!uploadedAttachment) {
158160
throw new Error("Something went wrong while uploading attachment");
159161
}

features/conversation/conversation-composer/conversation-composer.tsx

+14-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import { ReplyPreview } from "@/features/conversation/conversation-composer/conversation-composer-reply-preview";
2+
import { captureErrorWithToast } from "@/utils/capture-error";
23
import { HStack } from "@design-system/HStack";
34
import { VStack } from "@design-system/VStack";
45
import { useAppTheme } from "@theme/useAppTheme";
5-
import React, { memo } from "react";
6+
import React, { memo, useCallback } from "react";
67
import { useSafeAreaInsets } from "react-native-safe-area-context";
8+
import { AddAttachmentButton } from "./conversation-composer-add-attachment-button";
79
import { ConversationComposerAttachmentPreview } from "./conversation-composer-attachment-preview";
8-
import { ConversationComposerTextInput } from "./conversation-composer-text-input";
910
import { SendButton } from "./conversation-composer-send-button";
10-
import { AddAttachmentButton } from "./conversation-composer-add-attachment-button";
11+
import { ConversationComposerTextInput } from "./conversation-composer-text-input";
1112
import { useSend } from "./conversation-composer-use-send";
1213

1314
export const ConversationComposer = memo(function ConversationComposer() {
@@ -16,6 +17,14 @@ export const ConversationComposer = memo(function ConversationComposer() {
1617

1718
const { send } = useSend();
1819

20+
const handleSend = useCallback(async () => {
21+
try {
22+
await send();
23+
} catch (error) {
24+
captureErrorWithToast(error, { message: "Failed to send message" });
25+
}
26+
}, [send]);
27+
1928
return (
2029
<VStack
2130
// {...debugBorder()}
@@ -59,8 +68,8 @@ export const ConversationComposer = memo(function ConversationComposer() {
5968
alignItems: "center",
6069
}}
6170
>
62-
<ConversationComposerTextInput onSubmitEditing={send} />
63-
<SendButton onPress={send} />
71+
<ConversationComposerTextInput onSubmitEditing={handleSend} />
72+
<SendButton onPress={handleSend} />
6473
</HStack>
6574
</VStack>
6675
</HStack>

ios/Podfile.lock

+8-14
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,6 @@ PODS:
254254
- ExpoModulesCore
255255
- ExpoClipboard (7.0.0):
256256
- ExpoModulesCore
257-
- ExpoContacts (14.0.2):
258-
- ExpoModulesCore
259257
- ExpoCrypto (14.0.2):
260258
- ExpoModulesCore
261259
- ExpoDevice (7.0.1):
@@ -412,7 +410,7 @@ PODS:
412410
- libwebp/sharpyuv (1.3.2)
413411
- libwebp/webp (1.3.2):
414412
- libwebp/sharpyuv
415-
- LibXMTP (3.0.20)
413+
- LibXMTP (3.0.23)
416414
- MessagePacker (0.4.7)
417415
- MMKV (2.0.2):
418416
- MMKVCore (~> 2.0.2)
@@ -2343,18 +2341,18 @@ PODS:
23432341
- UMAppLoader (5.0.0)
23442342
- walletsdk-ethos (0.1.0-no-web3j):
23452343
- React-Core
2346-
- XMTP (3.0.24):
2344+
- XMTP (3.0.27):
23472345
- Connect-Swift (= 1.0.0)
23482346
- CryptoSwift (= 1.8.3)
23492347
- CSecp256k1 (~> 0.2)
2350-
- LibXMTP (= 3.0.20)
2348+
- LibXMTP (= 3.0.23)
23512349
- SQLCipher (= 4.5.7)
2352-
- XMTPReactNative (3.1.9):
2350+
- XMTPReactNative (3.1.11):
23532351
- CSecp256k1 (~> 0.2)
23542352
- ExpoModulesCore
23552353
- MessagePacker
23562354
- SQLCipher (= 4.5.7)
2357-
- XMTP (= 3.0.24)
2355+
- XMTP (= 3.0.27)
23582356
- Yoga (0.0.0)
23592357

23602358
DEPENDENCIES:
@@ -2378,7 +2376,6 @@ DEPENDENCIES:
23782376
- ExpoBackgroundFetch (from `../node_modules/expo-background-fetch/ios`)
23792377
- ExpoBlur (from `../node_modules/expo-blur/ios`)
23802378
- ExpoClipboard (from `../node_modules/expo-clipboard/ios`)
2381-
- ExpoContacts (from `../node_modules/expo-contacts/ios`)
23822379
- ExpoCrypto (from `../node_modules/expo-crypto/ios`)
23832380
- ExpoDevice (from `../node_modules/expo-device/ios`)
23842381
- ExpoDocumentPicker (from `../node_modules/expo-document-picker/ios`)
@@ -2584,8 +2581,6 @@ EXTERNAL SOURCES:
25842581
:path: "../node_modules/expo-blur/ios"
25852582
ExpoClipboard:
25862583
:path: "../node_modules/expo-clipboard/ios"
2587-
ExpoContacts:
2588-
:path: "../node_modules/expo-contacts/ios"
25892584
ExpoCrypto:
25902585
:path: "../node_modules/expo-crypto/ios"
25912586
ExpoDevice:
@@ -2867,7 +2862,6 @@ SPEC CHECKSUMS:
28672862
ExpoBackgroundFetch: a3080ab72736b60441adf5f452919426c62e0533
28682863
ExpoBlur: 567af66164e3043a9a30069594aed1ddf0a88d97
28692864
ExpoClipboard: 166ca8c13ca1041f5ba619a211f59427ab5da8a7
2870-
ExpoContacts: 209f0739c712bf808413c691722ce1bb1e2ea0af
28712865
ExpoCrypto: 1eaf79360c8135af1f2ebb133394fd3513ca9a3d
28722866
ExpoDevice: e24dd19a43065182eb246bc0e7f84186862f1e83
28732867
ExpoDocumentPicker: 4a89fd8a0cb90010214a416c858d7dece1c1eb10
@@ -2907,7 +2901,7 @@ SPEC CHECKSUMS:
29072901
libavif: 84bbb62fb232c3018d6f1bab79beea87e35de7b7
29082902
libdav1d: 23581a4d8ec811ff171ed5e2e05cd27bad64c39f
29092903
libwebp: 1786c9f4ff8a279e4dac1e8f385004d5fc253009
2910-
LibXMTP: 5c8a858675af142e4a5336e27bb2d6fa6d633b18
2904+
LibXMTP: 104197abdeb8651480a6663eedb5f3011cec25b7
29112905
MessagePacker: ab2fe250e86ea7aedd1a9ee47a37083edd41fd02
29122906
MMKV: 3eacda84cd1c4fc95cf848d3ecb69d85ed56006c
29132907
MMKVCore: 508b4d3a8ce031f1b5c8bd235f0517fb3f4c73a9
@@ -3015,8 +3009,8 @@ SPEC CHECKSUMS:
30153009
SwiftProtobuf: 4dbaffec76a39a8dc5da23b40af1a5dc01a4c02d
30163010
UMAppLoader: bda51f73f8599e336a778b23e0956130d1e244d5
30173011
walletsdk-ethos: 0a0a1ca18573f1ff44c63072704550bef8aaa16b
3018-
XMTP: 3d82fe8598fe043a67ad93276084ab46a30a1fa3
3019-
XMTPReactNative: 8758bb7d92ff8e6cf9a31cf0f57e5b09cc51319d
3012+
XMTP: 226c2cb3ba800e1b0632a2c7223d9f518149ea34
3013+
XMTPReactNative: 07595ef46a89aac5bbd9e3947202582e3572cced
30203014
Yoga: 7548e4449365bf0ef60db4aefe58abff37fcabec
30213015

30223016
PODFILE CHECKSUM: 00627c9c5607e366416986052af3a07710a899f1

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
"@xmtp/content-type-transaction-reference": "^2.0.0",
6969
"@xmtp/frames-client": "^0.5.4",
7070
"@xmtp/proto": "^3.60.0",
71-
"@xmtp/react-native-sdk": "^3.1.9",
71+
"@xmtp/react-native-sdk": "^3.1.11",
7272
"@xstate/react": "^5.0.0",
7373
"@yornaath/batshit": "^0.10.1",
7474
"alchemy-sdk": "^3.4.4",

yarn.lock

+6-5
Original file line numberDiff line numberDiff line change
@@ -11216,10 +11216,11 @@ __metadata:
1121611216
languageName: node
1121711217
linkType: hard
1121811218

11219-
"@xmtp/react-native-sdk@npm:^3.1.9":
11220-
version: 3.1.9
11221-
resolution: "@xmtp/react-native-sdk@npm:3.1.9"
11219+
"@xmtp/react-native-sdk@npm:^3.1.11":
11220+
version: 3.1.11
11221+
resolution: "@xmtp/react-native-sdk@npm:3.1.11"
1122211222
dependencies:
11223+
"@changesets/changelog-git": "npm:^0.2.0"
1122311224
"@changesets/cli": "npm:^2.27.10"
1122411225
"@ethersproject/bytes": "npm:^5.7.0"
1122511226
"@msgpack/msgpack": "npm:^3.0.0-beta2"
@@ -11231,7 +11232,7 @@ __metadata:
1123111232
expo: "*"
1123211233
react: "*"
1123311234
react-native: "*"
11234-
checksum: 10c0/8e9e33f5fdf9e309bf43bc8f620d93e3d4f5a53ab00f415fd36074fd0d4dac0a099d0b8968884b7d2357dd1ea23e9f90e6ffc5225bd6fe73d921625eb02044ed
11235+
checksum: 10c0/5f1d1d34f08e4791a0a14a69a0322c45db42ab7ef93b724e537db8c23bdc84f773b3dd27803173a6b4831255fea57c270664e2ae3b109e5e603bd8ea51683702
1123511236
languageName: node
1123611237
linkType: hard
1123711238

@@ -13932,7 +13933,7 @@ __metadata:
1393213933
"@xmtp/content-type-transaction-reference": "npm:^2.0.0"
1393313934
"@xmtp/frames-client": "npm:^0.5.4"
1393413935
"@xmtp/proto": "npm:^3.60.0"
13935-
"@xmtp/react-native-sdk": "npm:^3.1.9"
13936+
"@xmtp/react-native-sdk": "npm:^3.1.11"
1393613937
"@xstate/react": "npm:^5.0.0"
1393713938
"@yornaath/batshit": "npm:^0.10.1"
1393813939
alchemy-sdk: "npm:^3.4.4"

0 commit comments

Comments
 (0)