feat: flash the transfer arrow icon for per-peripheral switches#42
Merged
Conversation
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.
|
🎉 This PR is included in version 2.12.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
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 runsCONNECT_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: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.connectOne(-> incoming) /.unregisterOne(-> outgoing) handlers.AppDelegateobserves both and drives the existing.receiving/.sendingicon viabeginTransferAutoEnd, 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.forEachstyle nits already onmain).