Skip to content

feat(chat): stage images dropped on the composer - #1746

Open
bmc08gt wants to merge 1 commit into
code/cashfrom
feat/composer-drop-images
Open

bmc08gt wants to merge 1 commit into
code/cashfrom
feat/composer-drop-images

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

Dragging an image onto the chat bottom bar now stages it as a photo, the same as picking it. Keyboard image insertion and rich paste into the field go through the same path.

Modifier.composerImageReceiver is a contentReceiver on the bar's outer Column. BasicTextField reads its drop and paste configuration from an ancestor contentReceiver, so one receiver covers the field and the attachment strip. Compose's drop handling also requests the drag-and-drop URI permission before onReceive, which dragAndDropTarget would leave to us.

Only items whose ContentResolver.getType starts with image/ are taken; anything else stays unconsumed, so text still reaches the field. Nothing is taken when acceptsMedia is false, and items past the remaining photo slots are skipped.

The picker path reads its URI later, after the blob sealer and a possible preload fetch. A drag URI's grant only lasts as long as the activity, so each dropped image is copied into cacheDir/chat_capture on drop and staged through StagePhotos(captured = true), the camera's path, which already cleans up those files.

iOS counterpart: code-payments/code-ios-app#1032

Images dropped on the bottom bar, pasted, or inserted from a keyboard are
copied into the capture directory and staged like picked photos. Rejected
when the conversation does not accept media or for non-image items.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: feature New functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant