-
Notifications
You must be signed in to change notification settings - Fork 28
Upgrade to latest xmtp-ios/Android #737
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
base: main
Are you sure you want to change the base?
Conversation
…ct-native into 10-16-upgrade_to_4.6.0-dev
|
Upgrade iOS and Android XMTP SDK dependencies and add timestamp filters, JSON query params, and push visibility controls across
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issue on line in example/src/GroupScreen.tsx:1157
:
codec?.decode(replyContent.content)
may return undefined
or throw, but the code still renders MessageContents
with content={actualReplyContent}
. This can recurse into the same reply
branch with content=undefined
, leading to a runtime TypeError when accessing replyContent.content
.
Consider guarding the decode with try/catch and checking for a defined result before rendering the nested MessageContents
. If decoding fails or returns undefined
, consider rendering a small fallback message instead of recursing.
- if (contentTypeId === 'xmtp.org/reply:1.0') {
- const replyContent: ReplyContent = content
- const codec = Client.codecRegistry[contentTypeId]
- const actualReplyContent = codec?.decode(replyContent.content)
-
- return (
- <View>
- <Text style={{ color: 'gray' }}>Reply</Text>
- <MessageContents
- contentTypeId={contentTypeId}
- content={actualReplyContent}
- />
- </View>
- )
- }
+ if (contentTypeId === 'xmtp.org/reply:1.0') {
+ const replyContent: ReplyContent | undefined = content
+ let actualReplyContent: any | undefined
+ try {
+ const codec = Client.codecRegistry[contentTypeId]
+ actualReplyContent = codec?.decode(replyContent?.content)
+ } catch (e) {
+ actualReplyContent = undefined
+ }
+ return (
+ <View>
+ <Text style={{ color: 'gray' }}>Reply</Text>
+ {actualReplyContent ? (
+ <MessageContents
+ contentTypeId={contentTypeId}
+ content={actualReplyContent}
+ />
+ ) : (
+ <Text style={{ opacity: 0.5, fontStyle: 'italic' }}>
+ failed to decode reply content
+ </Text>
+ )}
+ </View>
+ )
+ }
🚀 Reply to ask Macroscope to explain or update this suggestion.
👍 Helpful? React to give us feedback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issue on line in ios/Wrappers/AuthParamsWrapper.swift:102
:
In AuthParamsWrapper
(https://github.com/xmtp/xmtp-react-native/pull/737/files#diff-7cb2cf2873830a5b373878690efec6f0631a58eee8d291d48feeeea96bca4ecaR102), ConversationListParamsWrapper
(https://github.com/xmtp/xmtp-react-native/pull/737/files#diff-7acd4099c21174c0cae9a9e49e07057d2852c8c610a9097887cf32f4e0ea26bcR33), and MessageQueryParamsWrapper
(https://github.com/xmtp/xmtp-react-native/pull/737/files#diff-d9424643f5bb51c458eaf180ea342967aa362c93597de3e4ee625bc7bd12837bR32), JSON numeric fields are cast with as? Int64
, but JSONSerialization
produces NSNumber
, causing the casts to fail and drop valid values. Instead, cast to NSNumber
and use .int64Value
, or switch to JSONDecoder
with typed models for robust numeric parsing.
- let chainId = jsonOptions["chainId"] as? Int64
- let blockNumber = jsonOptions["blockNumber"] as? Int64
+ let chainId = (jsonOptions["chainId"] as? NSNumber)?.int64Value
+ let blockNumber = (jsonOptions["blockNumber"] as? NSNumber)?.int64Value
🚀 Reply to ask Macroscope to explain or update this suggestion.
👍 Helpful? React to give us feedback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issue on line in example/src/GroupScreen.tsx:1159
:
In the reply branch of MessageContents
(https://github.com/xmtp/xmtp-react-native/pull/737/files#diff-f54a9a16dba92196ab3dcf0d8acf5d8d8501f3d49944522a325055b66b5aae85R1159), replies are decoded and rendered with the wrong contentTypeId
. You currently look up the 'xmtp.org/reply:1.0'
codec to decode the inner payload and pass the same contentTypeId
to the nested MessageContents
, which can lead to undefined results or infinite recursion. Use the nested replyContent.contentTypeId
when selecting the codec and when rendering the inner MessageContents
, and add a guard for missing codecs so unsupported content displays gracefully instead of crashing.
- const codec = Client.codecRegistry[contentTypeId]
+ const codec = Client.codecRegistry[replyContent.contentTypeId]
- contentTypeId={contentTypeId}
+ contentTypeId={replyContent.contentTypeId}
🚀 Reply to ask Macroscope to explain or update this suggestion.
👍 Helpful? React to give us feedback.
tl;dr
shouldPush
field to all ContentCodecs