Skip to content

Fix newly connected devices#130

Draft
NullPointerDepressiveDisorder wants to merge 7 commits intomainfrom
fix-newly-connected-devices
Draft

Fix newly connected devices#130
NullPointerDepressiveDisorder wants to merge 7 commits intomainfrom
fix-newly-connected-devices

Conversation

@NullPointerDepressiveDisorder
Copy link
Copy Markdown
Owner

Description

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to change)
  • 📚 Documentation update
  • 🔧 Refactor (code change that neither fixes a bug nor adds a feature)
  • 🧪 Test improvement

Related Issues

Testing Performed

  • Tested with built-in trackpad
  • Tested with Magic Trackpad (if available)
  • Verified system gestures (Mission Control, etc.) still work
  • Tested in target apps (list any specific apps tested):

Checklist

  • My code follows the project's code style guidelines
  • I have tested my changes thoroughly
  • I have added comments for non-obvious logic
  • My changes don't break existing functionality
  • I have updated documentation if needed

Code Coverage

  • I have added tests for new functionality (where applicable)
  • My changes meet the 80% patch coverage requirement

Note: Codecov will automatically check patch coverage. PRs that don't meet the 80% threshold will fail the coverage check. Files in MiddleDragTests/, AppDelegate.swift, MiddleDragApp.swift, and UpdateManager.swift are excluded from coverage requirements.

Screenshots / Recordings

Additional Notes

@sentry
Copy link
Copy Markdown
Contributor

sentry bot commented Apr 16, 2026

⚠️ JUnit XML file not found

The CLI was unable to find any JUnit XML files to upload.
For more help, visit our troubleshooting guide.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 DeviceMonitor to re-enumerate devices while running and register newly connected devices.
  • Introduced DeviceEnumerating + SystemDeviceEnumerator to 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.

Comment thread MiddleDrag/Managers/DeviceMonitor.swift Outdated
Comment thread MiddleDrag/Managers/DeviceMonitor.swift Outdated
Comment thread MiddleDrag/Managers/DeviceMonitor.swift Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Karan Mohindroo <karankmohindroo@gmail.com>
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.

Should work for trackpads connected after starting the app

3 participants