Skip to content

feat: Add UserActivityTracker to monitor user activity #1589

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

massimopaganigh
Copy link
Contributor

@massimopaganigh massimopaganigh commented Jul 16, 2025

Introduce a new UserActivityTracker class in the SourceGit.Models namespace to track user activity and determine when to perform auto-fetch operations. Update the App.axaml.cs file to initialize the tracker at startup and modify Repository.cs to utilize this new functionality, ensuring auto-fetching occurs only during user inactivity.

The aim of pr is to prevent user-defined operations from overlapping with automatic operations causing error notifications.

mpagani added 2 commits July 16, 2025 12:22
Introduce a new `UserActivityTracker` class in the `SourceGit.Models` namespace to track user activity and determine when to perform auto-fetch operations. Update the `App.axaml.cs` file to initialize the tracker at startup and modify `Repository.cs` to utilize this new functionality, ensuring auto-fetching occurs only during user inactivity.
Updated the private static readonly instance of the `UserActivityTracker` class from `_instance` to `s_instance`. This change enhances code readability by using the `s_` prefix to indicate that the variable is static.
@Copilot Copilot AI review requested due to automatic review settings July 16, 2025 10:27
Copy link

@Copilot 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 introduces a new UserActivityTracker class to enable intelligent auto-fetch operations that only occur when the user is inactive, improving the user experience by avoiding disruptive network operations during active usage.

  • Adds a singleton UserActivityTracker class that monitors window activation state and user input events
  • Replaces simple time-based auto-fetch logic with activity-aware logic that considers user idle time
  • Integrates the tracker into the application startup process

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/Models/UserActivityTracker.cs New singleton class that tracks user activity and window state to determine optimal auto-fetch timing
src/ViewModels/Repository.cs Updated auto-fetch logic to use the new activity tracker instead of simple time comparison
src/App.axaml.cs Added initialization of the UserActivityTracker at application startup

@love-linger love-linger force-pushed the develop branch 2 times, most recently from 613ac0a to c6c1fb2 Compare July 16, 2025 10:53
@love-linger love-linger force-pushed the develop branch 5 times, most recently from 05dba32 to 6822ae3 Compare July 21, 2025 09:52
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.

1 participant