Skip to content

Conversation

@fulleni
Copy link
Member

@fulleni fulleni commented Nov 12, 2025

Status

READY

Description

This pull request undertakes a significant refactoring effort to align the application with recent updates in the core package. The primary focus is on modernizing user content preference management by replacing the 'Interest' model with more specific 'SavedHeadlineFilters' and 'SavedSourceFilters'. This change is supported by a new database migration and an updated remote configuration for granular, role-based limits. The overall goal is to enhance flexibility, maintain data integrity, and ensure compatibility with the evolving core library.

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

- Update core package reference from 93ca190 to 064c438
- This change affects both pubspec.lock and pubspec.yaml files
Creates a new database migration to align the schema with the updated `core` package models.

- Adds `savedHeadlineFilters` and `savedSourceFilters` to `user_content_preferences` and removes the old `interests` field.
- Refactors `remote_configs` to use the new map-based `UserPreferenceConfig` structure and removes the deprecated `interestConfig`.
- Implements both `up` and `down` methods for schema transformation and rollback.
Removes the old `UnifyInterestsAndRemoteConfig` migration and registers the new `RefactorUserPreferencesAndRemoteConfig` migration. This ensures the database migration service applies the correct schema transformation.
Updates the `_ensureUserDataExists` method in `AuthService` to use the new `UserContentPreferences` constructor. This removes the deprecated `interests` field and adds the required `savedHeadlineFilters` and `savedSourceFilters` fields, ensuring new users are initialized with the correct data structure.
Updates the `_createUserSubDocuments` method in `DatabaseSeedingService` to use the new `UserContentPreferences` constructor. This removes the deprecated `interests` field and adds the required `savedHeadlineFilters` and `savedSourceFilters` fields, ensuring default user data is correctly structured.
Updates `DefaultUserPreferenceLimitService` to enforce limits using the new map-based `UserPreferenceConfig` from `RemoteConfig`. This includes validating `followedItemsLimit`, `savedHeadlinesLimit`, `savedHeadlineFiltersLimit`, and `savedSourceFiltersLimit` against user roles. Removes reliance on the deprecated `interestConfig` and individual limit properties.
Updates the `sendBreakingNewsNotification` method in `DefaultPushNotificationService` to query `user_content_preferences` using the new `savedHeadlineFilters.deliveryTypes` field. This aligns the notification subscription logic with the updated `UserContentPreferences` model, replacing the deprecated `interests` field.
- Remove local ad related permissions from permissions.dart
- Remove local ad related permissions from role_permissions.dart
- Update guest and admin role permissions accordingly
- Rename "Interests" to "Saved Headline Filters" in the description of user-crafted notification streams
- Adjust wording to reflect that users subscribe to notifications for a specific filter
@gemini-code-assist
Copy link

gemini-code-assist bot commented Nov 12, 2025

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 undertakes a significant refactoring effort to align the application with recent updates in the core package. The primary focus is on modernizing user content preference management by replacing the 'Interest' model with more specific 'SavedHeadlineFilters' and 'SavedSourceFilters'. This change is supported by a new database migration and an updated remote configuration for granular, role-based limits. The overall goal is to enhance flexibility, maintain data integrity, and ensure compatibility with the evolving core library.

Highlights

  • User Preference Model Update: The previous 'Interest' model for user content preferences has been replaced with new 'SavedHeadlineFilters' and 'SavedSourceFilters' models, providing more granular control over user-defined content streams.
  • Database Migration: A new database migration has been introduced to transition existing user data from the deprecated 'interests' field to the new 'savedHeadlineFilters' and 'savedSourceFilters' fields, ensuring data consistency across the updated schema. The previous 'UnifyInterestsAndRemoteConfig' migration has been removed.
  • Dynamic Limit Configuration: Remote configuration for user preference limits has been enhanced to support a more flexible, role-based map structure. This includes specific limits for total saved headline filters, pinned headline filters, and notification subscriptions per delivery type, as well as limits for saved source filters.
  • Core Package Synchronization: The project's dependency on the 'core' package has been updated to a new commit, synchronizing the codebase with the latest changes and models introduced in the core library.
  • Documentation Update: The README.md file has been updated to reflect the new terminology, changing 'User-Crafted Notification Streams' from 'Interests' to 'Saved Headline Filters'.
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 refactors user preferences and remote configuration to align with updates in the core package, replacing the Interest model with SavedHeadlineFilter and SavedSourceFilter. The changes are extensive, including a new database migration, updates to services that handle user preferences and limits, and cleanup of related permissions.

My review focuses on the new database migration, which has some critical issues. Specifically, the up migration may cause data loss by not migrating existing interests data to the new fields. Additionally, the down migration is not a complete rollback and could leave the database in an inconsistent state if used. I've also noted a minor logging inconsistency in the preference limit service. The rest of the changes appear correct and consistent with the refactoring goal.

…ne filters limit

- Change log level from 'severe' to 'warning' when user exceeds the total saved headline filter limit
- This modification provides a less critical log level for this specific scenario while still alerting administrators
@fulleni fulleni merged commit be05a6a into main Nov 12, 2025
1 check failed
@fulleni fulleni deleted the refactor/sync-with-core-package-update branch November 12, 2025 14:49
@github-project-automation github-project-automation bot moved this from Backlog to Done in Flutter News App Project Nov 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants