Repository navigation
feat(chat): stage images dropped on the composer - #1032
Merged
Merged
Conversation
Dropping an image on the bottom bar (the system screenshot thumbnail, or an image from another app in split view) stages it as a photo chip through the same load, decode and cap path as a picked photo. A chat that takes no photos answers the drag with a forbidden proposal.
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
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.
Dragging an image onto the conversation bottom bar now stages it as a photo chip, the same as picking it from the library. This is mainly for the floating screenshot thumbnail: take a screenshot, drag the thumbnail onto the composer, and it's attached.
The bar takes the drop with
.onDrop(of: [.image]), covering the text field, the chip strip and the margins.ChatPhotoStaging.loadImage(_ NSItemProvider)loads the image data and runs it through the existingdecode, so a full-size screenshot gets the same downsampling as a picked photo.stageDroppedreusesstage, so drop order and the full-composer stop match the picker.A drop is refused with a forbidden proposal when the chat doesn't accept media or a message is being edited, and
stageDroppedImageschecksacceptsMediaagain before staging.The text field is a SwiftUI
TextField, and its inner text view passes image-only drags up to the bar. Pasting an image into the field isn't handled here.Android counterpart: code-payments/code-android-app#1746