-
Notifications
You must be signed in to change notification settings - Fork 0
Refactor/sync with core package update #96
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
Conversation
- 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
Summary of ChangesHello @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
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this 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.
lib/src/database/migrations/20251112000000_refactor_user_preferences_and_remote_config.dart
Show resolved
Hide resolved
lib/src/database/migrations/20251112000000_refactor_user_preferences_and_remote_config.dart
Show resolved
Hide resolved
…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
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