Add favorites and history tracking with Settings UI#1032
Merged
Conversation
Co-authored-by: tisfeng <25194972+tisfeng@users.noreply.github.com>
Co-authored-by: tisfeng <25194972+tisfeng@users.noreply.github.com>
Co-authored-by: tisfeng <25194972+tisfeng@users.noreply.github.com>
Co-authored-by: tisfeng <25194972+tisfeng@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add favorites and history functionality to query interface
Add favorites and history tracking with Settings UI
Nov 19, 2025
This commit applies formatting and code organization improvements across multiple files: - QueryRecord.swift: Reorder methods (equality operator before hash) - HistoryManager.swift: Move maxHistoryCount declaration to the end - FavoritesTab.swift: Add MARK comments for Internal and Private sections These changes improve code readability and follow Swift style conventions without altering functionality.
This commit fixes build configuration errors by adding the missing TTSServiceType.swift file references to the Xcode project file (project.pbxproj). The file was created but not properly registered in the build phases, causing compilation issues. Changes include: - Add TTSServiceType.swift to Sources build phase - Add corresponding file reference definitions This resolves the file reference error and allows the project to build successfully.
This commit fixes compilation errors across multiple files and adds localization support: - Fix type mismatches and property errors in FavoritesManager, HistoryManager, and FavoritesTab - Add comprehensive localization strings for favorites/history features (English, Simplified Chinese, Traditional Chinese) - Add language extension utilities to handle string formatting - Update Objective-C code in EZTitlebar for compatibility - Clean up unnecessary build configuration entries These changes resolve build failures and enable proper localization for the new favorites and history features.
Replace the standalone favorite button in the titlebar with a menu item in the quick action menu. This improves UI organization by consolidating related actions into a single menu, reducing visual clutter while maintaining the same functionality. Changes: - Remove favoriteButton property and UI element from titlebar - Remove updateFavoriteButton method and related constraints - Remove favorite button initialization and notification observer - Update localization strings for menu item context
Consolidate the separate history tab into the favorites tab to simplify the settings UI. This reduces the number of tabs while keeping both favorites and history management in a single, unified interface. Changes: - Delete HistoryTab.swift component - Expand FavoritesTab to include history display and management - Update SettingView tab configuration to remove history tab - Remove HistoryTab project references from pbxproj
…splay Simplify the favorites tab by removing the clear/delete all button and enhancing the timestamp display styling. This reduces unnecessary UI complexity while improving the visual presentation of item timestamps. Changes: - Remove clear button and associated localization strings - Enhance timestamp display formatting and styling - Refactor FavoritesTab layout for improved clarity - Update SettingView configuration
Fix the favorites tab to use the word selection window (rather than opening a new query window) when clicking on favorite items. This provides a consistent and efficient lookup experience aligned with the app's primary interaction pattern. Changes: - Update favorites item tap action to use word selection window - Simplify FavoritesTab query logic - Refactor SettingView integration
… padding This commit improves the visual consistency and layout of the FavoritesTab view by replacing manual frame sizing with the reusable `borderedCard()` modifier and adding consistent padding. Changes: - FavoritesTab.swift: Replace .frame(maxWidth, maxHeight) with .borderedCard() and .padding(20) - project.pbxproj: Reorder file reference in build project (cleanup) This change ensures the Favorites tab follows the same styling pattern as other tabs in the settings view, improving code consistency and maintainability.
…o unified QueryRecordManager This commit consolidates the separate `FavoritesManager` and `HistoryManager` classes into a unified `QueryRecordManager` class that manages both favorites and history operations. This reduces code duplication and improves maintainability. Changes: - Delete FavoritesManager.swift and HistoryManager.swift - Create QueryRecordManager.swift with combined functionality for favorites and history management - Update FavoritesTab.swift to use QueryRecordManager - Update EZTitlebar.m and EZBaseQueryViewController.m to use QueryRecordManager - Update project.pbxproj with new file references and build settings The unified manager provides a cleaner API while maintaining backward compatibility through @objc annotations for Objective-C interoperability.
…perations This commit refactors QueryRecordManager to introduce a unified API for managing both favorites and history records. The changes introduce a `RecordType` enum and deduplication policies to eliminate code duplication and improve flexibility. Changes: - Add RecordType enum with storageKey, maxCount, and deduplicationPolicy properties - Add DeduplicationPolicy enum to handle different duplicate handling strategies - Consolidate favorites/history methods into generic addRecord, removeRecord, getAllRecords, and clearAllRecords methods - Replace type-specific logic with dynamic record type handling - Update FavoritesTab.swift to use new generic API - Update EZTitlebar.m to use containsRecord and addRecord methods - Update EZBaseQueryViewController.m to use generic addRecord method The refactoring maintains backward compatibility while providing a cleaner, more maintainable codebase.
This commit updates the Xcode project configuration to reflect compatibility with Xcode 16.2 (build version 16.2). The LastUpgradeCheck version is bumped from 2610 to 2620 to maintain project metadata consistency. Changes: - Update project.pbxproj LastUpgradeCheck from 2610 to 2620 - Update Easydict.xcscheme LastUpgradeVersion from 2610 to 2620 This ensures the project configuration is properly aligned with the latest Xcode version requirements.
Owner
Contributor
There was a problem hiding this comment.
Pull request overview
This PR implements a favorites and query history feature for Easydict, allowing users to bookmark translations and automatically track query history.
Changes:
- Added data models (
QueryRecord,QueryRecordManager) with UserDefaults persistence using the Defaults library - Implemented a unified FavoritesTab UI with segmented control for viewing favorites and history
- Integrated automatic history tracking into the query flow and added manual favorite functionality via quick action menu
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
QueryRecord.swift |
New Codable model for storing query text, language pair, and timestamp |
QueryRecordManager.swift |
Singleton manager handling CRUD operations with deduplication and history capping at 1,000 entries |
Language+Extension.swift |
Added Codable conformance to Language type for QueryRecord serialization |
Defaults.Keys+Extension.swift |
Added storage keys for favorites and query history arrays |
FavoritesTab.swift |
SwiftUI view with segmented control for favorites/history, swipe-to-delete, and click-to-requery |
SettingView.swift |
Added favorites tab to settings with 640px height configuration |
EZBaseQueryViewController.m |
Integrated automatic history recording after query execution |
EZBaseQueryViewController.h |
Exposed queryModel as readonly property for titlebar access |
EZTitlebar.m |
Added "Add to Favorites" menu item to quick action menu |
Localizable.xcstrings |
Added localized strings for favorites/history UI (en, zh-Hans, zh-Hant) |
project.pbxproj |
Added new Swift files to Xcode project build configuration |
Easydict.xcscheme |
Updated Xcode version to 2620 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Collaborator
Contributor
|
LGTM |
Owner
Owner
Owner
This commit redesigns the `QueryRecordRow` in the Favorites tab to improve user interaction. Key changes: - Replaced the tap-to-query behavior with explicit "Query" and "Delete" buttons for better usability. - Updated the layout to a horizontal stack (`HStack`) to accommodate the new actions. - Added necessary localization keys (`common.query`) in `Localizable.xcstrings`.
This commit introduces the ability to export saved favorites and query history records as CSV files. Key changes: - Added an "Export" menu in the Favorites/History tab header. - Implemented CSV generation logic with proper escaping for special characters. - Integrated `NSSavePanel` for a native file saving experience on macOS. - Added necessary localization strings for the new export actions.
Owner
This commit updates the `Localizable.xcstrings` file to synchronize and add new localization keys related to the favorites and history features. Key changes: - Added Slovak (sk) translations for multiple core and feature-specific strings. - Updated and consolidated strings for favorites/history empty states and export actions. - Cleaned up stale localization keys and synchronized translations across English, Chinese (Simplified/Traditional), and Slovak.
Owner
|
Later, we can consider also recording the query results for easy viewing. |
Owner
|
pls review |
Collaborator
|
I added localization for |
|
Looking good! Will this be available in the next release (if so, when)? |
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.






Implements vocabulary notebook functionality: user-initiated favorites and automatic query history, both accessible via Settings tabs.
Architecture
Data Layer
QueryRecord: Codable model storing query text, language pair, and timestampFavoritesManager/HistoryManager: Singleton managers with UserDefaults persistence via Defaults libraryUI Components
FavoritesTab/HistoryTab: SwiftUI list views with swipe-to-delete and bulk clearEZWindowManager.showMainWindowIfNeeded()→startQueryText()Integration Points
EZBaseQueryViewController.queryAllSerives:after query executionEZTitlebarobservesNSNotification.serviceHasUpdatedto refresh button statequeryModelas readonly property onEZBaseQueryViewControllerfor titlebar accessExample Usage
Localized for en, zh-Hans, zh-Hant. All new files added to Xcode project configuration.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.