Skip to content

Fix newly connected devices#130

Open
NullPointerDepressiveDisorder wants to merge 11 commits intomainfrom
fix-newly-connected-devices
Open

Fix newly connected devices#130
NullPointerDepressiveDisorder wants to merge 11 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

Codecov Report

❌ Patch coverage is 85.84475% with 31 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
MiddleDrag/Core/MultitouchFramework.swift 37.93% 18 Missing ⚠️
MiddleDrag/Managers/DeviceMonitor.swift 93.15% 13 Missing ⚠️

📢 Thoughts on this report? Let us know!

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>
@NullPointerDepressiveDisorder NullPointerDepressiveDisorder marked this pull request as ready for review April 16, 2026 17:22
Comment thread MiddleDrag/Managers/DeviceMonitor.swift
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