-
Notifications
You must be signed in to change notification settings - Fork 110
Add support for editing attachments #806
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SDK Size
|
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.
Works well and looks good, just left few minor comments
Sources/StreamChatSwiftUI/ChatChannel/Composer/MessageComposerViewModel.swift
Outdated
Show resolved
Hide resolved
Generated by 🚫 Danger |
|
martinmitrevski
approved these changes
Apr 18, 2025
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.
LGTM! ✅
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🔗 Issue Links
https://linear.app/stream/issue/IOS-648/[swiftui]-cant-edit-attachments-for-messages
🎯 Goal
Add support for editing message attachments. Plus, fixes minor issues related to editing messages.
📝 Summary
ComposerConfig.attachmentPayloadConverter
in favour ofMessageComposerViewModel.inputAttachmentsAsPayloads()
🛠 Implementation
I had to be a bit creative in order to be able to convert the existing attachments of a message to our composer "Added" assets.
The main issue is that when editing a message, we used
ComposerConfig.defaultAttachmentPayloadConverter
to retain the existing attachments of the message. But now, this does not work well because the attachments do not come from aChatMessage
anymore but from our "Added" assets, just like we do with our Draft messages. For this reason, I had to deprecate theComposerConfig.defaultAttachmentPayloadConverter
. However, if a customer uses it, we fall back on it and ignore the new implementation.I reused most of the logic of the Drafts implementation, but the difference is that the draft attachments are all local attachments, while the existing attachments of a message are already on the server, so I had to make some adjustments when converting the attachments to Added Assets.
Another challenge was that we expose the
addedFileUrls
as simplyURL
s. So, I had to create an additional property to store additional information about the removed file URLs.🧪 Manual Testing Notes
Add support for editing message attachments
Note: Test with multiple types of attachments (image, video, file, voice recording etc)
Fix scrolling to the bottom when editing a message
Fix having message edit action on Giphy messages
Fix being able to long press an unsent Giphy message
Fix being able to swipe to reply an unsent Giphy message
☑️ Contributor Checklist
docs-content
repo