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

feat: support remote attachments #85

Merged
merged 2 commits into from
Aug 23, 2023
Merged

Conversation

dmccartney
Copy link
Contributor

@dmccartney dmccartney commented Aug 16, 2023

This adds support for remote attachments to the RN SDK.

Goals: do heavy lifting in native code and minimize data sent across JS/native bridge (i.e. use file references).

Note: this is the binding for remoteAttachment leftover from #81 and uses a similar approach to abstracting codec usage.

Sending:

  • the app helps the sender select a fileUri to send
  • the app asks XMTP to encrypt the file: client.encryptAttachment({ fileUri, ... })
  • the app uploads the encryptedLocalFileUri to web storage to get a url
  • the app asks XMTP to send the message: client.send({ remoteAttachment: { url, ... }})
Screenshot 2023-08-16 at 3 55 27 PM Screenshot 2023-08-16 at 3 55 40 PM

Receiving:

  • the app lists messages from XMTP having a message.content.remoteAttachment
  • when the receiver taps the attachment, the app fetches the url to an encryptedLocalFileUri
  • the app asks XMTP to decrypt the local file: client.decryptAttachment({ encryptedLocalFileUri, ...})
  • the app presents the decrypted fileUri to the user based on the mimeType
Screenshot 2023-08-16 at 3 55 50 PM Screenshot 2023-08-16 at 3 55 58 PM

This is the high-level TODO list:

  • sending
    • JS interface + demo sending UI
    • iOS sending
    • Android sending
  • receiving
    • JS interface + demo receiving UI
    • iOS receiving
    • Android receiving
  • misc
    • cleanup the ConversationScreen code in the demo app
    • find a less hacky dev rigging for upload-service testing

@dmccartney dmccartney force-pushed the daniel-remote-attachment branch 2 times, most recently from bab621f to d6cf358 Compare August 22, 2023 22:20
@dmccartney dmccartney marked this pull request as ready for review August 23, 2023 10:48
@dmccartney dmccartney requested a review from a team as a code owner August 23, 2023 10:48
@nplasterer nplasterer merged commit 8f74391 into main Aug 23, 2023
2 of 3 checks passed
@nplasterer nplasterer deleted the daniel-remote-attachment branch August 23, 2023 16:27
@github-actions
Copy link

🎉 This PR is included in version 1.10.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants