Skip to content
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

Bug: iOS missing millisecond precision for group createdAt and message sent #283

Open
cameronvoell opened this issue Feb 22, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@cameronvoell
Copy link
Contributor

Describe the bug

On iOS group createdAt (which is supposed to be unix timestamp or milliseconds since 1970) always ends in three 0s on iOS. The same can be seen for the sent field on group messages which should also be the millisecond unix timestamp.

An example from the log would be, Android logging:
LOG Group createdAt: 1708614527922
LOG Conversation createdAt: 1708614528344
LOG Group message sent: 1708614547377
LOG Conversation message sent: 1708614547353

while iOS would log:
LOG Group createdAt: 1708614407000
LOG Conversation createdAt: 1708614407244
LOG Group message sent: 1708614407000
LOG Conversation message sent: 1708614407820

I also added the following tests in a draft PR which pass on RN Android but fail on RN iOS (just the group assertions fail) - https://github.com/xmtp/xmtp-react-native/pull/281/files#diff-4b96887b4344b96a5d9e30cad1e87d74d6d9eab735f00c9c0cbad5e976f1ccb4

This would mess up the order of things in automated tests, and when streaming messages quickly.

This is strange because the code looks like it should break for Conversations and Groups, but somehow the precision looks fine for Conversations. Relevant code for taking timestamps from the xmtp-ios SDK and converting them into a JSON object that is imported into React Native typescript can be seen below:

GroupWrapper.swift - https://github.com/xmtp/xmtp-react-native/blob/beta/ios/Wrappers/GroupWrapper.swift#L23
ConversationWrapper.swift - https://github.com/xmtp/xmtp-react-native/blob/beta/ios/Wrappers/ConversationWrapper.swift#L23
DecodedMessageWrapper.swift - https://github.com/xmtp/xmtp-react-native/blob/beta/ios/Wrappers/DecodedMessageWrapper.swift#L14

Notice they all use a similar syntax UInt64(conversation.createdAt.timeIntervalSince1970 * 1000) vs UInt64(group.createdAt.timeIntervalSince1970 * 1000),

So I belive the question should be where in xmtp-ios are the group.createdAt and message.sent fields being handled differently from conversation.createdAt and conversation message.sent.

Expected behavior

No response

Steps to reproduce the bug

No response

@cameronvoell cameronvoell added the bug Something isn't working label Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant