Skip to content

feat: flash the transfer arrow icon for per-peripheral switches#42

Merged
MegaManSec merged 1 commit into
mainfrom
feat/per-peripheral-transfer-icon
Jun 3, 2026
Merged

feat: flash the transfer arrow icon for per-peripheral switches#42
MegaManSec merged 1 commit into
mainfrom
feat/per-peripheral-transfer-icon

Conversation

@MegaManSec
Copy link
Copy Markdown
Owner

Problem

The menu-bar transfer arrows (arrow.up.right.circle.fill "sending" / arrow.down.left.circle.fill "receiving") only appear during a full-set switch — clicking a Mac row, which runs CONNECT_ALL / UNREGISTER_ALL. A per-peripheral switch — clicking a single peripheral row in the menu, or the Peripheral tab's per-device buttons — changed only that peripheral's row ((Pairing…) / checkmark) and left the status-bar icon idle on both Macs. It should reflect a single-peripheral handoff too.

Change

Add two direction-based signals, magicSwitchPeripheralIncoming / magicSwitchPeripheralOutgoing, posted by:

  • the local per-peripheral senders — takePeripheralFromPeer -> incoming, sendPeripheralToPeer -> outgoing (posted after the no-peer guard, so a local-only fallback with no reachable peer doesn't flash a cross-gap arrow); and
  • the incoming .connectOne (-> incoming) / .unregisterOne (-> outgoing) handlers.

AppDelegate observes both and drives the existing .receiving / .sending icon via beginTransferAutoEnd, so both Macs show arrows pointing the same physical way during a one-peripheral handoff — exactly like the full-set switch. Posting at the store layer covers both entry points (menu rows and the Peripheral tab).

Both sides use the receiver's 5s auto-end (the all-set sender tracks exact completion because it orchestrates rollback; a per-peripheral switch is fire-and-forget, and the per-row (Pairing…) state still carries exact progress, so a fixed flash is the right fit).

Testing

  • xcodebuild -project "Magic Switch.xcodeproj" -scheme "Magic Switch" -configuration Debug build CODE_SIGNING_ALLOWED=NO -> BUILD SUCCEEDED.
  • swift format lint -> no new warnings (only the pre-existing .forEach style nits already on main).

The menu-bar sending/receiving arrows previously fired only for the
full-set switch (CONNECT_ALL / UNREGISTER_ALL). A single-peripheral
switch — from the menu's per-peripheral rows or the Peripheral tab —
moved only that peripheral's row, leaving the status-bar icon idle on
both Macs.

Add two direction-based signals (magicSwitchPeripheralIncoming /
magicSwitchPeripheralOutgoing) posted both by the local per-peripheral
senders (takePeripheralFromPeer / sendPeripheralToPeer, after the
no-peer guard so a local-only fallback doesn't flash a cross-gap arrow)
and by the incoming .connectOne / .unregisterOne handlers. AppDelegate
observes them and drives the same .receiving / .sending icon through
beginTransferAutoEnd, so both Macs show arrows pointing the same
physical way during a one-peripheral handoff — matching the full-set
behaviour. Both sides use the receiver's 5s auto-end; the per-row
(Pairing…) state still carries exact progress.
@MegaManSec MegaManSec merged commit cf04957 into main Jun 3, 2026
2 checks passed
@MegaManSec MegaManSec deleted the feat/per-peripheral-transfer-icon branch June 3, 2026 15:58
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 3, 2026

🎉 This PR is included in version 2.12.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant