Repository navigation
#870 Paste and drop attachments in Session Chat - #875
Merged
Merged
Conversation
Images and files can be pasted into the Session Chat composer and dropped anywhere on Session Chat on iOS and Android. A drag-over scrim card (new Drop Overlay component) says what a drop will attach, or why it can't. Pasted and dropped items go through the existing #644 routing; shared test vectors in shared/attachment-drop cover routing, the card text and Pasted image N.png naming on both platforms. Android keeps the TextFieldValue prompt field and hooks paste through the text menu, Ctrl+V/Shift+Insert and an InputConnection wrapper for keyboard image insertion. iOS overrides paste on the prompt text view and yields the field's text drop while an attachment is dragged over the chat. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ivanfenenko
marked this pull request as ready for review
October 27, 2026 21:34
There was a problem hiding this comment.
Automated review: 1 finding(s) that 2+ of 3 passes agreed on.
5 finding(s) from a single pass, not posted
android/app/src/main/java/dev/opencode/mobile/ui/components/input/OpenCodeComposerPaste.kt:98medium: Non-text clipboard without URI breaks Paste entirely (muse-spark-1.3-contributor)ios/OpenCode Mobile/OpenCode Mobile/Components/Input/OpenCodeMentionTextView.swift:363medium: Mixed text+image paste drops the text (muse-spark-1.3-contributor)ios/OpenCode Mobile/OpenCode Mobile/Domain/Message/Attachment/AttachmentItemProviders.swift:13medium: A dragged or pasted link is classified as a text file when its suggestedName contains a dot (deepseek-v4.1-flash)android/app/src/main/java/dev/opencode/mobile/ui/sessionchat/SessionChatScreen.kt:367low: Pasted folder never reports the folder error (muse-spark-1.3-contributor)android/app/src/main/java/dev/opencode/mobile/ui/components/input/OpenCodeComposerPaste.kt:160low: The text-menu Paste is hidden for any non-text clip, but the replacement Paste does nothing when the clip has no URI (deepseek-v4.1-flash)
opencode pr-review · passes: muse-spark-1.3-contributor, glm-5.3-flash, deepseek-v4.1-flash · $0.119 · 1 pass(es) stopped early
- Android: a clip counts as an attachment only when it names an image or only non-text types, so the built-in Paste is never hidden for a text clip that also carries an app-specific type. - Android: a pasted folder shows "Folders can't be attached." like a drop. - iOS: a dragged or pasted web link is never a text file, even when its suggested name has a dot (example.com). Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Summary
AttachmentDropRoutingon both platforms, tested against the same vectors inshared/attachment-drop/attachment-drop-cases.json: per-item routing through the Streamed attachment uploads in Session Chat #644 policy (folder, duplicate, model support, 20 MB, uploads), the card text, andPasted image N.pngnaming.attach_pasteandattach_drop, logged once per paste or drop that adds at least one attachment.TextFieldValueprompt field (only theTextFieldStatefield readscontentReceiver, and that one can't colour mentions). Paste goes through the text menu (appendTextContextMenuComponents/filterTextContextMenuComponents), Ctrl+V / Shift+Insert, and anInterceptPlatformTextInputwrapper that accepts keyboard image insertion (commitContent). Drops usedragAndDropTarget+requestDragAndDropPermissions.OpenCodeMentionTextViewoverridespaste(_:)/canPerformActionfor image, PDF and file-URL pasteboard items; Session Chat uses a SwiftUIDropDelegate, and the prompt field gives up its own text drop interaction while an attachment is dragged over the chat.Checks
:app:testDebugUnitTest2873 tests, 0 failures;:app:assembleDebugOK; ktlint clean on all changed lines.AttachmentDropRoutingTests,AttachmentMimeSharedVectorTestsandSessionChatViewModelTests227 tests passed.commitContent), text-menu Paste and Ctrl+V all attach; Ctrl+V of the same file → duplicate error.Screenshots
Issue
Risks / Follow-ups
text/plaintype as a text selection) but still attaches on drop.🤖 Generated with Claude Code