Drag and drop file attachments to Finder - #7853
Conversation
002a536 to
a55a8fe
Compare
|
We won't be merging #7855; please consider updating this PR to be a standalone PR. |
a55a8fe to
7093611
Compare
Respect your decision; submitting an updated PR for #7853.
|
|
FYI I'm still testing this updated PR, don't merge it yet. I'll post again here when it's ready. |
|
Okay it's working now; good to go. |
scottnonnenberg-signal
left a comment
There was a problem hiding this comment.
Thanks for spending time on this, and thanks for separating from the other PR.
Can you make a couple changes?
- You're saving files to the OS temp directory, but Signal Desktop maintains its own temp directory, and I think that would be a better place
- When dragging is cancelled, or completed, we need to clean up the temp file. And really, ideally, we wouldn't decrypt at the moment of starting to drag, but when the dragging is complete. Is that possible?
- You're using
group_default.pngas the icon shown when dragging - what about something likegeneric-file.svginstead?
===> I'll replace tmpdir() with TEMP_PATH from basePaths.preload.ts (already platform-correct). Add onDragEnd to the wrapper div → dispatch cleanup → IPC to main → fsExtra.remove(filePath).
===> Not possible with Electron's API — startDrag requires the file to exist before being called. We have to clean up after instead.
Yes, I can change icon to generic-file.svg. |
|
Thanks for the feedback! Here's what was addressed in the latest push:
|
|
Thanks for those updates! I tested it a bit on macOS, and it doesn't seem to be cleaning up the file when the drag is completed or cancelled. That definitely needs to be fixed. Looking at the architecture, I also see that it's only set up for one historical drag file location; we probably need to be more ready for overlapping drags, just to be safe. Could have just one variable, but if it's set when we want to add a new thing, delete the old thing first. Lastly, I now realize that this is only for generic attachments. Not for any media attachments, which is what people really want to drag. Can you expand it to work with those kinds of attachments as well? |
|
Thanks for the detailed review! Here's what the latest push addresses: 1. Cleanup not working — The root cause was that 2. Overlapping drags — The main-process 3. Media attachments — Added drag support to image, video, and GIF attachment containers (gates on Still pending: SVG icon — We haven't heard back on the |
8dcd45f to
0ef6b29
Compare
Allows users to drag downloaded file attachments from Signal directly into a Finder folder. Decrypts the attachment to a temp file and uses Electron's webContents.startDrag() for native OS drag-and-drop support.
- Move temp file cleanup to main process: delete the previous drag's temp file at the start of each new drag (onDragEnd doesn't fire because event.preventDefault() in onDragStart cancels the browser drag before it starts) - Remove renderer-side cleanupDragAttachment action and cleanup-drag- temp-file IPC channel — no longer needed - Add drag support to image, video, and GIF attachment containers (single attachment only; multi-image grids not yet supported)
0ef6b29 to
1576a25
Compare
|
Update on the pending This replaces the Latest push includes this change and should be ready for another look. |

Summary
Allows users to drag a downloaded file attachment from Signal directly into a Finder folder (or any drop target). Electron's native
webContents.startDrag()API handles the OS-level drag-and-drop.Changes
app/main.main.ts— addsstart-attachment-dragIPC handler: decrypts the attachment to a temp file and callsevent.sender.startDrag()with a generic iconts/state/ducks/conversations.preload.ts— addsdragAttachmentRedux thunk andDragAttachmentActionCreatorType; decrypts attachment to OS temp dir, then sends the IPC messagets/components/conversation/Message.dom.tsx— wraps the generic attachment button in a draggablediv;onDragStartdispatchesdragAttachmentts/state/smart/TimelineItem.preload.tsx— passesdragAttachmentdown toSmartTimelineItemTest plan