Fix newly connected devices#130
Draft
NullPointerDepressiveDisorder wants to merge 7 commits intomainfrom
Draft
Conversation
…r for improved device management
…ith 'unsafe' keyword
Copilot started reviewing on behalf of
NullPointerDepressiveDisorder
April 16, 2026 00:15
View session
Contributor
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to fix detection/handling of newly connected multitouch devices (e.g., connecting a Magic Trackpad after the app is already running) by making device monitoring refresh periodically and by making device enumeration testable via dependency injection.
Changes:
- Added a periodic refresh timer to
DeviceMonitorto re-enumerate devices while running and register newly connected devices. - Introduced
DeviceEnumerating+SystemDeviceEnumeratorto abstract private MultitouchSupport calls for testability. - Added mock-backed unit tests covering refresh timer lifecycle and registration behavior without requiring hardware.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| MiddleDrag/Managers/DeviceMonitor.swift | Adds refresh timer, enumerator injection, and new registration/refresh logic. |
| MiddleDrag/Core/MultitouchFramework.swift | Adds DeviceEnumerating protocol and SystemDeviceEnumerator implementation around private framework calls. |
| MiddleDrag/MiddleDragTests/DeviceMonitorTests.swift | Adds mock-backed tests for refresh/registration logic plus a MockDeviceEnumerator. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Karan Mohindroo <karankmohindroo@gmail.com>
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.
Description
Type of Change
Related Issues
Testing Performed
Checklist
Code Coverage
Screenshots / Recordings
Additional Notes