-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/push notification #127
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 dependency to latest version with ref 064c4387b3f7df835565c41c918dc2d80dd2f49a - Update http-client dependency to version v1.1.0 with ref e3540bcd27de93f96f4bce79cc20ff55dfe3b2bf - Remove TODO comment in pubspec.yaml
…n settings - Add Arabic translations for saved headline filter limits - Include translations for saved source filter limits - Add descriptions for total, pinned, and notification subscription limits - Translate push notification subscription delivery types
Creates a new reusable `SavedFilterLimitsForm` widget to manage the complex configuration for both headline and source saved filter limits. This stateful widget uses a `TabBar` to separate configurations by user role (Guest, Standard, Premium) and dynamically builds form fields for total, pinned, and notification subscription limits based on the filter type. It manages its own controllers and uses a robust callback system to propagate changes to the parent, ensuring a clean separation of concerns and high reusability.
Refactors the `UserPreferenceLimitsForm` to align with the new map-based structure of `UserPreferenceConfig`. - Updates helper methods (`_getFollowedItemsLimit`, `_getSavedHeadlinesLimit`, `_updateFollowedItemsLimit`, `_updateSavedHeadlinesLimit`) to read from and write to `Map<AppUserRole, int>` instead of using individual properties and switch statements. - This change resolves all related compile-time errors regarding undefined getters and parameters. - Updates all relevant doc comments to accurately describe the new map-based logic, improving maintainability.
Repurposes `SavedFeedFiltersLimitForm` to act as a container for two new `SavedFilterLimitsForm` instances, one for headline filters and one for source filters. - Transforms `SavedFeedFiltersLimitForm` from a StatefulWidget with direct form logic into a StatelessWidget that composes the new reusable `SavedFilterLimitsForm` widgets. - Removes all previous internal state management, TextEditingControllers, and helper methods related to the old flat `UserPreferenceConfig` structure. - Integrates two `ExpansionTile` widgets within `SavedFeedFiltersLimitForm` to logically separate the headline and source filter limit configurations, enhancing UI organization. - Passes down the `remoteConfig` and `onConfigChanged` callbacks to the child `SavedFilterLimitsForm` instances. - Updates the widget's documentation to reflect its new role as a container.
Updates `FeedConfigurationTab` to correctly integrate the refactored `SavedFeedFiltersLimitForm`. - Replaces the outdated `savedFeedFiltersLimitLabel` and `savedFeedFiltersLimitDescription` localization keys with the new, more generic `savedFeedFilterLimitsTitle` and `savedFeedFilterLimitsDescription`. - This ensures the main `ExpansionTile` on the feed tab has the correct title and description, reflecting that it is now a container for both headline and source filter limit configurations.
…onDeliveryType Creates a new extension file to provide localized string representations for the `PushNotificationSubscriptionDeliveryType` enum. This resolves the compile-time error where the `.l10n()` method was undefined.
Refactors the naming of the saved filter limit widgets to improve clarity and better reflect their distinct roles, addressing confusion while upholding the DRY principle. - Renames `saved_feed_filters_limit_form.dart` to `saved_filter_limits_section.dart`. - Renames the class `SavedFeedFiltersLimitForm` to `SavedFilterLimitsSection`. - This change clarifies that this widget's role is a high-level UI **section** or container, not a form itself. - Updates `feed_configuration_tab.dart` to import and use the newly named `SavedFilterLimitsSection`. The name of the reusable `SavedFilterLimitsForm` is kept, as its purpose as a specific **form** is now unambiguous in contrast to the container **section**.
Adds the `CreateHeadlineIsBreakingChanged` event to the `CreateHeadlineBloc` to handle changes to the breaking news status.
Adds the `isBreaking` property to `CreateHeadlineState` with a default value of `false`. Updates the `copyWith` method and `props` list to include `isBreaking`. Modifies the `isFormValid` getter to ensure that a headline marked as breaking news (`isBreaking: true`) cannot be saved as a draft, enforcing that breaking news must be published.
…e creation Updates `CreateHeadlineBloc` to manage the `isBreaking` status. - Adds a handler for the `CreateHeadlineIsBreakingChanged` event to update the state. - Modifies the `_onSavedAsDraft` and `_onPublished` methods to include the `isBreaking` value from the state when creating the new `Headline` object.
Implements the UI and logic for the "Mark as Breaking News" feature on the `CreateHeadlinePage`. - Adds a `Switch` widget to the form, bound to the `isBreaking` property in the `CreateHeadlineState`. - Includes descriptive text below the switch to inform the user of its impact. - Refactors the save logic into a `_handleSave` method to improve clarity and handle the new confirmation flow. - Implements a mandatory confirmation dialog that appears only when an admin attempts to publish a new headline with the `isBreaking` flag enabled. - Prevents saving a breaking news article as a draft by showing an informational dialog, enforcing the rule that breaking news must be published. - Updates the save button's enabled state to correctly reflect form validity for both draft and publish actions.
Adds the `EditHeadlineIsBreakingChanged` event to the `EditHeadlineBloc` to handle changes to the breaking news status during an edit operation.
Adds the `isBreaking` property to `EditHeadlineState` with a default value of `false`. Updates the `copyWith` method and `props` list to include `isBreaking`. The `isFormValid` getter remains unchanged, as `isBreaking` does not affect form validity during editing.
…update Updates `EditHeadlineBloc` to manage the `isBreaking` status for existing headlines. - Initializes the `isBreaking` state from the loaded headline data in `_onEditHeadlineLoaded`. - Adds a handler for the `EditHeadlineIsBreakingChanged` event to update the state. - Modifies the `_onSavedAsDraft` and `_onPublished` methods to include the `isBreaking` value from the state when updating the `Headline` object.
Adds the UI elements and logic for the "Mark as Breaking News" feature on the `EditHeadlinePage`. - Introduces a `Switch` widget to the form, bound to the `isBreaking` property in the `EditHeadlineState`. - Includes descriptive text below the switch to inform the user that changing the `isBreaking` status during editing will *not* trigger new push notifications. - Adds a comment to the `listener` block to clarify why `isBreaking` is not handled there.
Updates the `HeadlinesPage` data table to provide a clear visual indicator for breaking news. - A lightning bolt icon (`Icons.flash_on`) is now displayed next to the title of any headline where `isBreaking` is `true`. - The title `Text` widget is wrapped in an `Expanded` widget within a `Row` to ensure proper layout and prevent overflow issues.
…tures - Add Arabic translations for breaking news labels, descriptions, and dialog messages - Add English translations for breaking news labels, descriptions, and dialog messages - Include translations for new features such as marking news as breaking, publishing confirmation, and error messages
- Add context.mounted check before popping routes in dialog actions - Add import for AppLocalizations - Improve null safety by checking context.mounted in other places
…port Refactors the `HeadlinesPage` data table to enhance the display of the "breaking news" icon. - Replaces the `Row` layout with a `Stack` to overlay the icon. This ensures that all headline titles are vertically aligned at their starting point, whether the icon is present or not, creating a cleaner look. - Uses `EdgeInsetsDirectional` for padding to provide correct spacing in both LTR and RTL layouts, fixing the previous alignment issue in RTL mode.
Adds a nullable `bool? isBreaking` property to `HeadlinesFilterState` to support filtering by breaking news status. - `null` (default) includes all headlines. - `true` includes only breaking news. - `false` includes only non-breaking news. Updates the constructor, `copyWith`, and `props` to accommodate the new property.
Updates `headlines_filter_event.dart` to support filtering by breaking news status. - Adds a new `HeadlinesBreakingNewsFilterChanged` event to manage the three-state filter (`true`, `false`, `null`). - Updates the `HeadlinesFilterApplied` event to carry the `isBreaking` state when filters are applied.
Updates `HeadlinesFilterBloc` to manage the `isBreaking` filter state. - Adds a handler for the `HeadlinesBreakingNewsFilterChanged` event to update the state with `true`, `false`, or `null`. - Updates the `_onHeadlinesFilterApplied` handler to persist the `isBreaking` state when filters are applied. - The existing `_onHeadlinesFilterReset` handler correctly resets `isBreaking` to `null` by re-emitting the initial state.
Modifies the `buildHeadlinesFilterMap` method in `ContentManagementBloc` to include the new `isBreaking` filter. - If `state.isBreaking` is not null, it adds an `'isBreaking'` entry to the filter map with the corresponding boolean value. - This allows the backend query to filter headlines based on their breaking news status.
Updates `FilterDialogState` to include a nullable `bool? isBreaking` property. This allows the filter dialog to temporarily manage the state of the new breaking news filter while the dialog is open. The constructor, `copyWith`, and `props` are updated accordingly.
Adds the `FilterDialogBreakingNewsChanged` event to the `FilterDialogBloc`. This event allows the UI to update the temporary `isBreaking` filter status (`true`, `false`, or `null`) while the dialog is open.
Updates `FilterDialogBloc` to manage the temporary state of the `isBreaking` filter. - Adds a handler for the `FilterDialogBreakingNewsChanged` event to update the dialog's state. - Updates the `_onFilterDialogInitialized` handler to correctly initialize the `isBreaking` state from the main `HeadlinesFilterBloc` when the dialog is opened for headlines. - The existing `_onFilterDialogReset` handler correctly resets `isBreaking` to `null`.
Refactors `FilterDialogBreakingNewsChanged` event to use the `BreakingNewsFilterStatus` enum instead of a nullable boolean, ensuring type safety.
… event - Replace bool? with BreakingNewsFilterStatus for better type safety - Simplify props list by removing nullable types
- Replace boolean values with BreakingNewsFilterStatus enum - Update default selection to BreakingNewsFilterStatus.all - Enhance readability of breaking news filter chip options - Refactor filter update logic for better maintainability
- Add import statement for BreakingNewsFilterStatus model - Improve code readability by formatting emit statement in _onBreakingNewsChanged method
…tatus - Replace direct boolean values with BreakingNewsFilterStatus enum - Improve code readability and maintainability
…upport - Introduce BreakingNewsFilterStatus enum to handle breaking news filter options - Update ContentManagementBloc to use the new enum for more granular filtering - Add support for 'breaking only', 'non-breaking only', and 'all' options
…ggle changes - Add condition to check for changes in isBreaking state - Ensure headlines are reloaded when the breaking news toggle is switched
…ility - Replace individual ChoiceChip widgets with a dynamic list - Add localization support for breaking news filter options - Implement theming for selected and unselected chips - Improve code maintainability and reduce duplication
Fixes an issue where the search text in the filter dialog would become automatically selected after typing. This was caused by unnecessarily updating the `TextEditingController`'s text on every state change. The fix ensures the controller is only updated if its text differs from the BLoC state, preserving the user's cursor position and selection.
- Add Arabic and English translations for push notification settings - Include labels, descriptions, and titles for various notification-related UI elements - Cover translations for Firebase and OneSignal providers
- Implement PushNotificationSettingsForm widget for configuring push notification settings - Add system status, primary provider, and delivery types configuration sections - Use ExpansionTile for collapsible sections - Implement SwitchListTile and SegmentedButton for user interactions - Localize all strings using AppLocalizations
- Import PushNotificationSettingsForm widget - Update TabController length to 4 - Add new tab for notifications configuration - Implement PushNotificationSettingsForm in AppConfigurationPage
- Create new extension file for PushNotificationProvider enum - Implement l10n method to return localized string representations - Add cases for firebase and oneSignal push notification providers
- Remove nested ExpansionTile for system status section - Replace with a single SwitchListTile at the top level - Adjust padding and layout for primary provider and delivery types sections - Remove unnecessary containers and adjust alignments
- Update Arabic and English descriptions for push notification system status - Change title from "Push Notification System" to "Enable Notifications" - Clarify that the switch disables/enables all push notifications
- Add new localization keys for push notification provider configuration information - Include titles and messages for backend configuration notes in both Arabic and English
- Remove separate configuration info entries for push notification providers - Integrate configuration instructions directly into the primary provider description - Update descriptions in both English and Arabic localization files
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 significantly enhances the application's administrative capabilities by introducing a comprehensive push notification management system and integrating 'breaking news' functionality directly into the content creation and management workflows. It also improves the flexibility and extensibility of saved filter limit configurations, providing a more robust and user-friendly experience for managing application settings and content. 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
|
- Added a new bullet point under the 'Dynamically control the mobile app's behavior and operational state directly from your back-end' section - Described the capabilities of remotely managing the notification system, switching providers, and toggling delivery types - This update provides clearer information about the Global Notification Control feature
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 introduces a major new feature for push notifications, including breaking news alerts. The implementation is comprehensive, covering UI for configuration, state management with BLoC, and full localization. I'm particularly impressed with the thoughtful UX additions, such as the confirmation dialog for sending breaking news notifications and the visual indicator in the headlines list. The related refactoring of the filter limit forms into more reusable and scalable widgets is also a great improvement. I have one medium-severity suggestion regarding a hardcoded height in a form widget that could affect layout robustness, but overall this is a high-quality contribution.
Status
READY
Description
This pull request significantly enhances the application's administrative capabilities by introducing a comprehensive push notification management system and integrating 'breaking news' functionality directly into the content creation and management workflows. It also improves the flexibility and extensibility of saved filter limit configurations, providing a more robust and user-friendly experience for managing application settings and content.
Type of Change