Skip to content

Conversation

@fulleni
Copy link
Member

@fulleni fulleni commented Oct 12, 2025

Status

READY

Description

This pull request introduces the ability for users to save and manage custom filter combinations for news headlines. It achieves this by adding a new SavedFilter data model, integrating it into the existing user content preferences, and implementing configurable limits for these saved filters based on user tiers. The changes also include a structural refactor to better organize user preset models, along with corresponding updates to documentation, tests, and fixture data.

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore

- Create a new model to represent user-defined filter combinations
- Include properties for topics, sources, and countries
- Implement JSON serialization and deserialization
- Add copyWith method for easy modification
- Add generated code for SavedFilter model serialization
- IncludefromJsonandtoJsonmethods for SavedFilter class
- Cover topics, sources, and countries serialization in the process
- Add unique identifiers for saved filter fixtures in fixture_ids.dart
- Create new saved_filter.dart file with predefined saved search data
- Update fixtures.dart to export new saved filter fixtures
- Add new fields for saved filters limits for guest, authenticated, and premium users
- Update constructor and toJson method to include new fields
- Modify class copyWith method to support new fields
- Update documentation to reflect new saved filters limits
- Add SavedFilter import to user_content_preferences.dart
- Include savedFilters in UserContentPreferences properties
- Update fromJson and toJson methods to handle savedFilters
- Modify copyWith method to include savedFilters
- Add mock saved filter to test fixtures
- Update tests to cover saved filters field in UserContentPreferences
- Modify existing tests to include saved filters in round trip and copyWith scenarios
- Add guestSavedFiltersLimit, authenticatedSavedFiltersLimit, and premiumSavedFiltersLimit to RemoteConfig fixture
- Set values to 3, 10, and 25 respectively to reflect different user capabilities
- Update import path for SavedFilter model to user_presets package
- Make sources list in kSavedFilterId2 fixture const
- Create user_presets directory inside models
- Move saved_filter.dart and saved_filter.g.dart to user_presets directory
- Update models.dart to export user_presets
- Rename user_presets directory inside models
- Update saved_filter.dart to fix typos in method names
- Change import path for saved_filter from 'models/saved_filter.dart' to 'models/user_presets/saved_filter.dart' in user_preference_config.dart and user_content_preferences.dart
- This refactor ensures consistency in the directory structure for user-related models
- Rename 'user_app_settings_fixtures.dart' to 'user_app_settings.dart'
- Rename 'user_content_preferences_fixtures.dart' to 'user_content_preferences.dart'
- Add code to handle empty 'savedFilters' list
- Ignore inference failure on collection literal
- Ensure round trip test passes with empty lists
- Add comprehensive tests for SavedFilter constructor, fromJson/toJson, copyWith, and Equatable properties
- Cover cases with populated data and empty lists
- Verify correct behavior of copyWith method with and without updates
- Ensure proper equality checks for instances with same and different properties
- Include `SavedFilter` model in the User Presets section of README.md
- Describe `SavedFilter` as a model for storing user-defined filter combinations
- Update pubspec.yaml with new version number
- Add SavedFilter model for user-defined filters
- Link SavedFilter to UserContentPreferences
- Add saved filter limits to UserPreferenceConfig
- Refactor saved models into `user_presets` directory
- Update tests and documentation for new features
- Add fixture data for SavedFilter and related models
@fulleni fulleni linked an issue Oct 12, 2025 that may be closed by this pull request
@gemini-code-assist
Copy link

Summary of Changes

Hello @fulleni, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces the ability for users to save and manage custom filter combinations for news headlines. It achieves this by adding a new SavedFilter data model, integrating it into the existing user content preferences, and implementing configurable limits for these saved filters based on user tiers. The changes also include a structural refactor to better organize user preset models, along with corresponding updates to documentation, tests, and fixture data.

Highlights

  • New SavedFilter Model: Introduced a new SavedFilter model to allow users to store and manage their custom filter combinations for headlines, including topics, sources, and countries.
  • Integration with UserContentPreferences: The SavedFilter model has been integrated into UserContentPreferences, making savedFilters a required field within user preferences. This ensures that saved filters are directly associated with a user's content settings.
  • Configurable Saved Filter Limits: Added new configuration options to UserPreferenceConfig to define limits for the number of saved filters a user can have, tiered by guest, authenticated, and premium user types. This provides granular control over feature access.
  • Model Refactoring and Organization: Refactored the project structure by organizing saved models into a new user_presets directory, improving code organization and maintainability.
  • Comprehensive Testing and Documentation: Added dedicated unit tests for the new SavedFilter model and updated existing tests for UserContentPreferences to cover the new savedFilters field. The README.md has also been updated to reflect the new 'User Presets' section.
  • Fixture Data Updates: New fixture data for SavedFilter has been added, and all related fixtures have been synchronized to align with the recent model updates, ensuring consistent test environments.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new SavedFilter model, allowing users to save combinations of filters. The changes are well-structured and include updates to related models like UserContentPreferences and UserPreferenceConfig, the addition of corresponding limits, and the creation of necessary fixtures and tests. My review includes a few suggestions to improve code consistency and address a potential issue in the tests.

- Remove unused savedFilters assignment in user_content_preferences_test.dart
- Simplify test case for round trip with empty lists
- Changed the comment for kSavedFilterId1 to "Saved filters Fixture IDs"
- This provides a more accurate description of the following constants
- Import `meta` package to use `@immutable` annotation
- Add `@immutable` annotation to `SavedFilter` class to indicate that it is intended to be immutable
@fulleni fulleni changed the title 54 feat filter bookmarked entry model feat filter bookmarked entry model Oct 12, 2025
@fulleni fulleni merged commit d052799 into main Oct 12, 2025
1 of 2 checks passed
@fulleni fulleni deleted the 54-feat-filter-bookmarked-entry-model branch October 12, 2025 07:28
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.

feat: filter bookmarked entry model

2 participants