Skip to content

feat: Implement update checker functionality#42

Merged
duartebarbosadev merged 2 commits intomainfrom
feat/automatic-check-for-updates
Sep 8, 2025
Merged

feat: Implement update checker functionality#42
duartebarbosadev merged 2 commits intomainfrom
feat/automatic-check-for-updates

Conversation

@duartebarbosadev
Copy link
Copy Markdown
Owner

  • Added UpdateChecker class to handle checking for application updates from GitHub releases.
  • Integrated automatic and manual update checks in the AppController.
  • Created UpdateNotificationDialog to inform users about available updates.
  • Added UpdateCheckWorker for background update checking.
  • Implemented version comparison logic and parsing in UpdateChecker.
  • Added tests for update checking functionality, including version comparison and API response handling.
  • Updated UI components to include update check actions in the menu and main window.

This pull request introduces an automatic update notification system to the application, enabling both manual and scheduled checks for new releases from GitHub. It includes core logic for update checking, UI dialogs for update notifications, new settings and constants for update management, and integration with the application's worker and controller layers. Additionally, the developer documentation and README have been updated to reflect these new capabilities.

Update Notification System

  • Added src/core/update_checker.py which encapsulates all logic for checking updates from GitHub, comparing versions, and parsing release information. Includes robust error handling and platform-specific download URL selection.
  • New background worker update_worker.py (documented in DEVELOPER_GUIDE.md) enables non-blocking update checks, managed by WorkerManager.
  • UI dialogs for update notifications and manual check results are now included (update_dialog.py), providing user feedback on update status.

Settings and Configuration

  • Centralized update-related constants and settings in src/core/app_settings.py, including enable/disable flag, last check timestamp, check intervals, and GitHub repo info. Added getter/setter functions for these settings. [1] [2] [3]

Application Integration

  • Integrated update check workflow into AppController, with handlers for automatic and manual checks, and UI notification dialogs. Connected worker signals for update completion. [1] [2]
  • Automatic update check is triggered on startup via a delayed QTimer in MainWindow.
  • Added "Check for Updates..." action to the Help menu, allowing users to manually trigger update checks. [1] [2] [3]

Documentation and User Communication

  • Updated README.md and DEVELOPER_GUIDE.md to describe the new update notification feature and its integration points. [1] [2]

- Added UpdateChecker class to handle checking for application updates from GitHub releases.
- Integrated automatic and manual update checks in the AppController.
- Created UpdateNotificationDialog to inform users about available updates.
- Added UpdateCheckWorker for background update checking.
- Implemented version comparison logic and parsing in UpdateChecker.
- Added tests for update checking functionality, including version comparison and API response handling.
- Updated UI components to include update check actions in the menu and main window.
Copilot AI review requested due to automatic review settings September 8, 2025 21:44

This comment was marked as outdated.

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 implements a comprehensive update notification system for PhotoSort, enabling both automatic and manual checks for new releases from the GitHub repository. The system automatically checks for updates on startup and provides users with manual update checking through a Help menu option, complete with visual update dialogs and configurable settings.

  • Introduced automatic and manual update checking functionality integrated with the application lifecycle
  • Added user interface components for update notifications and manual check dialogs
  • Implemented background workers for non-blocking update operations and version comparison logic

Reviewed Changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
tests/test_update_checker.py Comprehensive test suite for update checking functionality including version comparison, API responses, and platform-specific download URL detection
src/workers/update_worker.py Background worker for non-blocking update checks with Qt signal integration
src/workers/preview_preloader_worker.py Existing preview preloader worker (no functional changes)
src/ui/worker_manager.py Added update check worker management and signals to existing worker infrastructure
src/ui/update_dialog.py New UI dialogs for update notifications and manual check results with drag support
src/ui/menu_manager.py Added "Check for Updates" action to Help menu
src/ui/main_window.py Integrated automatic update check on startup with timer delay
src/ui/dark_theme.qss Added comprehensive styling for update notification dialogs
src/ui/app_controller.py Added update check handlers for both manual and automatic workflows
src/core/update_checker.py Core update checking logic with GitHub API integration and version comparison
src/core/app_settings.py Added update-related settings and GitHub repository configuration
README.md Updated feature list to include update notifications
DEVELOPER_GUIDE.md Added documentation for update system architecture and workers directory

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

import logging
from PyQt6.QtCore import QObject, pyqtSignal

from core.update_checker import UpdateChecker
Copy link

Copilot AI Sep 8, 2025

Choose a reason for hiding this comment

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

Import path is inconsistent with other imports in the file. The import should be from src.core.update_checker import UpdateChecker to match the project structure and be consistent with the test imports.

Suggested change
from core.update_checker import UpdateChecker
from src.core.update_checker import UpdateChecker

Copilot uses AI. Check for mistakes.
import logging
from PyQt6.QtCore import QObject, pyqtSignal

from core.image_pipeline import ImagePipeline
Copy link

Copilot AI Sep 8, 2025

Choose a reason for hiding this comment

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

Import path is inconsistent with project structure. The import should be from src.core.image_pipeline import ImagePipeline to match the expected project layout and be consistent with other imports.

Suggested change
from core.image_pipeline import ImagePipeline
from src.core.image_pipeline import ImagePipeline

Copilot uses AI. Check for mistakes.
patch(
"src.core.update_checker.get_update_check_enabled", return_value=True
),
patch("core.build_info.VERSION", "dev"),
Copy link

Copilot AI Sep 8, 2025

Choose a reason for hiding this comment

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

Import path inconsistency. The patches reference core.build_info.VERSION but should be consistent with the project structure. Consider using src.core.build_info.VERSION to match the other imports in the test file.

Copilot uses AI. Check for mistakes.
patch(
"src.core.update_checker.get_update_check_enabled", return_value=True
),
patch("core.build_info.VERSION", "dev-abc123"),
Copy link

Copilot AI Sep 8, 2025

Choose a reason for hiding this comment

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

Import path inconsistency. The patches reference core.build_info.VERSION but should be consistent with the project structure. Consider using src.core.build_info.VERSION to match the other imports in the test file.

Copilot uses AI. Check for mistakes.
),
patch("src.core.update_checker.get_last_update_check_time", return_value=0),
patch("src.core.update_checker.time.time", return_value=100000),
patch("core.build_info.VERSION", "1.0.0"),
Copy link

Copilot AI Sep 8, 2025

Choose a reason for hiding this comment

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

Import path inconsistency. The patches reference core.build_info.VERSION but should be consistent with the project structure. Consider using src.core.build_info.VERSION to match the other imports in the test file.

Copilot uses AI. Check for mistakes.
"src.core.update_checker.get_last_update_check_time", return_value=99999
),
patch("src.core.update_checker.time.time", return_value=100000),
patch("core.build_info.VERSION", "1.0.0"),
Copy link

Copilot AI Sep 8, 2025

Choose a reason for hiding this comment

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

Import path inconsistency. The patches reference core.build_info.VERSION but should be consistent with the project structure. Consider using src.core.build_info.VERSION to match the other imports in the test file.

Copilot uses AI. Check for mistakes.
@duartebarbosadev duartebarbosadev merged commit f889b8b into main Sep 8, 2025
3 checks passed
@duartebarbosadev duartebarbosadev deleted the feat/automatic-check-for-updates branch September 8, 2025 22:30
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.

2 participants