Skip to content

#951 Clear the declined-drop card when an iOS drag ends - #962

Merged
ivanfenenko merged 1 commit into
mainfrom
fix/951-ios-declined-drop-card
Nov 2, 2026
Merged

ivanfenenko merged 1 commit into
mainfrom
fix/951-ios-declined-drop-card

Conversation

@ivanfenenko

@ivanfenenko ivanfenenko commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Fixes #951

On iOS, the "Can't attach this" card stayed on the Session Chat composer after a declined drag ended, until the next drag. SwiftUI's drop delegate never reports the end of a drag it declined, and onDropSessionUpdated needs iOS 26 (the app supports 17.5).

  • Session Chat now takes drops through a UIDropInteraction on the view that hosts the chat. UIKit calls sessionDidEnd for every drag, so the card clears when the drag ends, whether it was declined or accepted.
  • The card's routing and wording are unchanged (AttachmentDropRouting). A small SessionChatAttachmentDropTracker holds the card through one drag and decides the drop operation; it has unit tests.
  • Android already clears the card in onEnded, so it needs no change.

Checks

  • iOS and Android both covered: iOS fix only; Android already handles the end of a drag (SessionChatAttachmentDrop.kt).
  • Screenshots for UI changes (GIFs in a comment)
  • Tests run
    • New SessionChatAttachmentDropTrackerTests and the existing AttachmentDropRoutingTests pass.
    • Full iOS unit suite: 3,108 Swift Testing tests in 300 suites and 99 XCTest tests passed on the iPhone Duo simulator.
  • Checked on the iPhone Duo simulator against the scenario harness (v2). The harness model takes image uploads, so a temporary in-app drag source (not committed) supplied a folder for the declined case and an image for the accepted case.

Risks / Follow-ups

  • Not checked on an iPad, in split view, or with a drag from another app: this machine has only the iPhone Duo runtime. Drags outside the chat's bounds are cancelled in code for the split view case.
  • Text drags into the prompt field were not rechecked on device. The chat's interaction declines text-only drags as before, so the prompt field keeps them.

🤖 Generated with Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

SwiftUI's drop delegate never reports the end of a drag it declined, so
after a "Can't attach this" card the card stayed on the composer until
the next drag. Session Chat now takes drops through a UIDropInteraction
on the view that hosts the chat, whose sessionDidEnd fires for every
drag, declined or not.

A small tracker holds the card through one drag and decides the drop
operation; it is unit-tested. Android already clears the card in
onEnded, so it is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ivanfenenko

Copy link
Copy Markdown
Collaborator Author

iOS, iPhone Duo simulator, scenario harness (v2). The drag sources are a temporary change, not part of this PR.

Declined drag: the card clears on release Accepted drag: drop attaches, card clears
Declined folder drag Accepted image drag

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review: no finding that 2+ of 3 passes agreed on.

2 finding(s) from a single pass, not posted
  • ios/OpenCode Mobile/OpenCode Mobile/UI/SessionChat/SessionChatAttachmentDrop.swift:27 medium: Returning UIDropOperation.cancel aborts the whole drag where the old code only declined the position (deepseek-v4.1-flash)
  • ios/OpenCode Mobile/OpenCode Mobile/UI/SessionChat/SessionChatAttachmentDrop.swift:151 low: Tracker keeps its own summary, so clearing attachmentDropSummary no longer blocks a drop (deepseek-v4.1-flash)

opencode pr-review · passes: muse-spark-1.3-contributor, glm-5.3-flash, deepseek-v4.1-flash · $0.081

@ivanfenenko
ivanfenenko merged commit 646a671 into main Nov 2, 2026
@ivanfenenko
ivanfenenko deleted the fix/951-ios-declined-drop-card branch November 2, 2026 20:31
@ivanfenenko ivanfenenko mentioned this pull request Nov 3, 2026
13 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

iOS: declined-drop card stays on the composer after the drag ends

1 participant