Repository navigation
feat(mcp): iphone_swipe holds before moving with hold, to drag icons - #144
Merged
Merged
Conversation
Home-screen icons, files and reorderable rows have to be long-pressed before they can be dragged. iphone_swipe moves as soon as the finger is down, so it only scrolls or pages. Holding with a W3C pause before the move doesn't pick them up either; holding with a pointerMove in place does. hold (seconds, default 0) adds that in-place move before the stroke; over HID the finger is held, reporting its position every 100 ms like a long press, and then dragged without lifting. On an iPhone 12 mini, moving the Settings icon to an empty slot worked 5/5 each with hold 0.5, 0.6 and 1 s, and 0/5 without it. A swipe without hold is the same request as before, and seconds + hold is bounded by the existing 10 s gesture limit. Regression case Derrors#149. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 17, 2026
Resolve the conflicts with Derrors#139, Derrors#141 and Derrors#143 by keeping both sides: drag_steps next to tap_sequence_body, the exports of both, the protocol helpers, the MCP tests, CHANGELOG lines and regression rows Derrors#146-Derrors#149 in order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Only the sum was checked, so a negative seconds passed when the hold made up for it (-0.5 + 1), and a sum over the limit said "seconds must be between 0 and 10" although seconds alone was fine. Now seconds keeps its own range, hold can't be negative, and a sum over the limit names both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Derrors
added a commit
to cosinec/iphone-control
that referenced
this pull request
Nov 17, 2026
Resolve the conflicts with Derrors#141, Derrors#143 and Derrors#144: keep both sides (Tap's count and TapSequence next to TapElement's scroll, the protocol helpers, the MCP tests, CHANGELOG lines, doc rows with iphone_tap's count and iphone_tap_element's scroll, regression rows Derrors#146-Derrors#149 then Derrors#151). The search scroll now builds the Stroke that Derrors#144's swipe takes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 17, 2026
Merged
Merged
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.
What and why
Things that have to be long-pressed before they can be dragged (home-screen icons, files, reorderable list rows) can't be moved with
iphone_swipe: the finger moves as soon as it's down, so the screen just scrolls or pages.iphone_long_pressfollowed byiphone_swipelifts the finger in between. There is no way to hold and then drag in one touch.iphone_swipegets an optionalhold(seconds, default 0):drag_stepsputs apointerMovein place forholdms between the down and the move. I tried apausefirst, which is the obvious encoding, and it doesn't work: on the home screen a pause of 0.6–1 s before the move picked the icon up 0/6 times (it just paged), while an in-place move of 0.5 s did 3/3 and 0.3 s did 0/3 (raw/actionsprobes, same phone). Withhold0 the steps are exactlyswipe_steps, so a plain swipe sends the same request as before.HidSession::held_dragpresses, re-reports the position every 100 ms forholdseconds likelong_pressdoes, then runs the same interpolateddragwithout lifting.Request::Swipegetsholdwith#[serde(default, skip_serializing_if = zero)]. A swipe without it is byte-for-byte what it was (asserted inrequests_round_trip_as_tagged_json). An older daemon ignores the field and swipes as before (checked with 0.2.7 below).check_requestboundsseconds + holdby the existingMAX_GESTURE_SECONDS(10), since HID sends samples for both parts, and rejects a negative or non-finitehold.holdin theiphone_swipeschema; its description says when to use it and that under 0.5 s usually picks nothing up. The result line adds,先按住 0.6 秒/, held 0.6 s firstonly whenhold> 0.swipenow takes a smallStroke { from, to, seconds, hold }instead of a fourth loose parameter (clippy's argument limit).The viewer's own swipe and unlock swipes are unchanged (
hold: 0). Tool names, existing parameters and default output don't change (D10).Tests
1. Unit tests
cargo test --workspace --all-features --locked,cargo clippy --workspace --all-targets --all-features --locked -- -D warningsandcargo fmt --check(per package) pass (Rust 1.99.1, macOS)ictl-wda:client::tests::a_held_drag_holds_with_a_move_in_place: down, in-place move forhold, move to the end, up;hold0 equalsswipe_steps.ictl-mcp:tests::swipe_hold_defaults_to_zero: default 0, passed through when given, a non-number is an error.ictl-daemon:core::tests::gesture_seconds_are_boundednow also coversseconds + hold(5+5 ok, 5+5.5 rejected) and negative/NaNhold.ictl-protocol:tests::requests_round_trip_as_tagged_jsonchecks the exact JSON of a plain swipe (noholdkey) and round-trips a held one.Request::Swipe { .. }constructions in tests only gainedhold: 0.0.#[ignore]tests of the changed area run by hand: none apply2. Real-device regression
tests/device/run.pydefault steps pass on this branch (exit code 0): 16 calls, 0 failed, 15.8s in alliphone_swipestep takes 1.80 s on the branch and 1.87 s on 0.2.7.run.py output
3. Regression cases (docs/dev/regression-cases.md)
holdsends the same steps, and the run.py swipe above behaves as before4. Real-device proof of the fix or feature
Steps and results
Home screen, the Settings icon alone in row 4 at (62,580); the target is the empty slot at (232,580). Each run:
iphone_swipefrom the icon to the slot, theniphone_list_elementsfor the icon's position. When it moved, it was dragged back withhold0.6 and edit mode was left with Home, and its position was checked before the next run. Times are theiphone_swipecall (it waits for the screen to settle afterwards).The 20 drags back to the original slot (also with
hold0.6) all landed, so 35/35 held drags worked in total.v0.2.7 with
hold(the field is ignored, a plain swipe):Checklist
Docs:
docs/tools.md,website/guide/tools.md,website/en/guide/tools.md,CHANGELOG.md,CHANGELOG.zh-CN.md.🤖 Generated with Claude Code