-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/user generated content #221
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
…dency - Update core git reference from 3779a8b to 8bae6eb - Add in_app_review dependency version ^2.0.11 - Update in_app_review_platform_interface transitive dependency
- Add new translations for feedback, reporting, and comments features - Include both Arabic and English translations - Cover various aspects such as report content, comments, rating app, and providing feedback
Introduces the `NativeReviewService` abstract interface and a concrete `InAppReviewService` implementation using the `in_app_review` package.
This service abstracts the interaction with the native OS review prompt, allowing for a clean separation of concerns and improved testability. It gracefully handles cases where the review prompt is unavailable.
Updates the bootstrap process to instantiate and provide `DataRepository<Engagement>`, `DataRepository<Report>`, and `DataRepository<AppReview>`.
Also initializes and provides the new `AppReviewService` and its dependency, `NativeReviewService`, making them available to the entire application. This change extends the dependency injection setup to support all new user-generated content features.
Updates the `App` widget to accept and provide the new `DataRepository` instances for `Engagement`, `Report`, and `AppReview`, as well as the `AppReviewService`.
This ensures that all new user content features have their required dependencies available throughout the widget tree.
Introduces a new `AppPositiveInteractionOcurred` event and its handler in the `AppBloc`.
When this event is dispatched, the BLoC now delegates to the `AppReviewService` to increment the user's positive interaction count and check if an app review prompt should be triggered. This is the core mechanism for the `positiveInteractionThreshold` feature.
Adds `positiveInteractionCount` to the `AppState`. This field will hold the session-based count of positive user actions, which is used by the `AppReviewService` to determine eligibility for the review prompt.
Adds the `AppPositiveInteractionOcurred` event. This event will be dispatched from various parts of the UI when a user performs a positive action, such as bookmarking an article, which contributes to triggering the app review funnel.
This change adds the 'one_member_abstracts' rule to the list of ignored lint rules in the analysis options. It allows developers to use abstract classes or mixins with a single member without triggering a lint warning. - Added 'one_member_abstracts: ignore' to the analyzer's ignore list in analysis_options.yaml
- Replace InAppReviewService with AppReviewService - Update import paths and service instantiation - Modify AppBloc and App widget to use new AppReviewService - Update bootstrap process for AppReviewService initialization
Implements the `AppReviewService` to manage the app review funnel. This service encapsulates all business logic for tracking positive interactions, checking eligibility based on cooldowns and thresholds, and triggering the appropriate review prompts. It uses `KVStorageService` to persist the interaction count.
Creates the `RateAppBottomSheet`, which serves as the initial prompt in the app review funnel. This widget displays a simple "Yes/No" question and delegates the response handling to the `AppReviewService`.
Creates the `ProvideFeedbackBottomSheet` for collecting detailed user feedback after a negative response in the review funnel. It allows users to select from predefined reasons or provide custom text feedback.
Extends the `ContentLimitationService` to include checks for `commentsPerDay` and `reportsPerDay`. This ensures that user actions for the new engagement and reporting features are gated by the limits defined in `RemoteConfig`.
Updates the `DemoDataInitializerService` to create fixture data for `Engagement`, `Report`, and `AppReview` models when a new demo user is created. This ensures a consistent and populated experience in the demo environment.
Updates the `DemoDataMigrationService` to handle the migration of `Engagement`, `Report`, and `AppReview` data when an anonymous demo user authenticates.
Introduces the `HeadlineActionsRow` widget. This new, compact row contains subtle icon buttons for like, dislike, comment, bookmark, share, and more options, providing a unified interaction point on every headline tile.
Removes the "more" (`...`) icon button from the `HeadlineSourceRow` widget. This action is now handled by the new, centralized `HeadlineActionsRow`, simplifying the UI and consolidating actions.
Adds the new `HeadlineActionsRow` to the `HeadlineTileTextOnly` widget. This integrates the new user engagement actions (like, comment, etc.) into the text-only feed item layout.
Adds the new `HeadlineActionsRow` to the `HeadlineTileImageStart` widget, bringing the unified user engagement actions to this feed item layout.
Adds the new `HeadlineActionsRow` to the `HeadlineTileImageTop` widget, completing the integration of user engagement actions across all headline tile variants.
Refactors the `HeadlineActionsBottomSheet` to focus primarily on the "Report" action, as other actions like sharing and bookmarking are now directly on the `HeadlineActionsRow`.
Also updates the bookmarking action to dispatch the `AppPositiveInteractionOcurred` event, connecting it to the app review funnel.
Creates the `ReportContentBottomSheet` for the user content reporting flow. This widget implements a multi-step process, first allowing the user to select a reason for the report, and then providing an optional field for additional comments before submission.
Adds a "Report" option to the app bar menu on the `EntityDetailsPage` for reporting topics and sources.
Also updates the "follow" action to dispatch the `AppPositiveInteractionOcurred` event, integrating this key user action into the app review funnel.
Defines the `EngagementState` and `EngagementStatus` for the `EngagementBloc`. This will manage the state for a single headline's engagement data, including loading status, reactions, and comments.
Defines the events for the `EngagementBloc`, including events for starting the bloc, posting/updating engagements, and handling UI interactions.
Implements the `EngagementBloc` to manage the full lifecycle of engagement for a single headline. It handles fetching comments and reactions, posting new engagements, and updating existing ones, interacting with the `DataRepository<Engagement>`.
Creates the `ReactionSelector` widget, a horizontally scrollable list of reaction icons used within the `EngagementBottomSheet`. It allows users to select their reaction and provides visual feedback.
Creates the `EngagementBottomSheet`, the central hub for user engagement. This widget provides the `EngagementBloc`, displays the `ReactionSelector`, shows a list of comments, and includes a text input field for posting new comments. It enforces the "reaction is mandatory for a comment" rule.
- Replace placeholder user icon with UserAvatar widget - Show user email if available, otherwise display partial user ID - Display "You" for comments from the current user - Update localization strings for commenter name display
- Change core git ref from e66e076 to b1110a4 - This update ensures the project uses the latest version of the core dependency
- Remove DataRepository<Engagement>, DataRepository<Report>, and DataRepository<AppReview> from DemoDataInitializerService and DemoDataMigrationService - Delete related fixture data lists and initialization/migration methods - Update dependencies in bootstrap.dart - Update pubspec.yaml and pubspec.lock with new core ref
…nd logout - Add FeedCacheService to AppBloc dependencies - Implement cache clearing logic in AppBloc for: - App logout - User change (anonymous to authenticated, or between different users) - Update App widget to provide FeedCacheService to AppBloc
- Remove engagement migration logic from DemoDataMigrationService - Remove engagementRepository dependency from DemoDataMigrationService - Update bootstrap.dart to reflect changes in DemoDataMigrationService
- Update translations for "yes" and "no" buttons in app rating prompt - Changes made in both Arabic and English localization files
- Remove conditional logic for displaying user email - Use consistent method for displaying commenter name
- Remove outer SafeArea widget - Swap SafeArea and Padding widgets - Ensure proper spacing and safe area handling for bottom sheet content
- Modify the column crossAxisAlignment to CrossAxisAlignment.start - Reorganize the widget tree to improve layout structure - Add spacing between headline actions row and headline content - Remove redundant SizedBox wrapper
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 delivers a major feature update by integrating user-generated content capabilities and an intelligent app review system. It allows users to react to and comment on headlines, and report inappropriate content, fostering a more interactive community. The underlying content limitation service has been upgraded to manage these new interactions, ensuring fair usage based on user roles and remote configurations. Additionally, the app now intelligently prompts users for reviews, directing positive feedback to app stores and capturing constructive criticism privately. 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 introduces a comprehensive set of features for user-generated content, including reactions, comments, content reporting, and a sophisticated app review funnel. The implementation is extensive, involving significant refactoring and the addition of several new services and UI components. The overall architecture is robust, with good separation of concerns in many areas, such as the new AppReviewService and the refactored ContentLimitationService. However, there are a few key areas for improvement. There is significant code duplication, particularly in the implementation of the 'Follow' button and the logic for displaying content limitation bottom sheets. Centralizing this logic into shared, reusable components would greatly improve maintainability. Additionally, there's an architectural issue where BuildContext is passed into BLoC events, which couples the business logic and UI layers. Addressing these points will make the new features even more solid and easier to maintain in the long run.
lib/account/view/followed_contents/countries/add_country_to_follow_page.dart
Outdated
Show resolved
Hide resolved
| required BuildContext context, | ||
| required AppLocalizations l10n, | ||
| required LimitationStatus status, | ||
| required AppUserRole? userRole, |
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.
The userRole parameter is passed to _getBottomSheetContent but is never used within the function's body. This is dead code and should be removed to simplify the function signature. This also applies to the duplicated versions of this function in add_source_to_follow_page.dart and add_topic_to_follow_page.dart.
| required AppUserRole? userRole, | |
| required LimitationStatus status, |
- Add remote config check for headline reporting feature - Conditionally display report action in headline actions bottom sheet - Improve feature flag handling for better control and scalability
- Add remote config check for source reporting enabled feature - Display report option in popup menu for sources only when the feature is enabled - Keep the report option hidden for topics and when the feature is disabled
- Add check for parent community feature enablement - Clarify log message when app review feature is disabled - Reorganize code to improve readability and maintainability
- Use communityConfig.enabled to check if community feature is enabled - Only enable headline reporting if community feature is enabled and headlineReportingEnabled is true - Improve readability and maintainability of the code
- Refactor the logic to check if source reporting is enabled - Add communityConfig variable for better readability - Ensure community feature is enabled before checking source reporting
- Remove "standardLimitTitle" translations from app_ar.arb and app_en.arb files - This change reflects the removal of the corresponding English string
- Remove duplicate _getBottomSheetContent function from multiple files - Replace custom bottom sheet logic with showContentLimitationBottomSheet function - Remove unnecessary imports and simplify code
…ion bottom sheet - Replace inline showModalBottomSheet calls with showContentLimitationBottomSheet function - Remove duplicate ContentLimitationBottomSheet widget creation - Simplify function calls by passing status and action parameters
- Extract content limitation bottom sheet logic to a separate function - Update content limitation messages and actions - Rename some ContentAction values for clarity - Adjust content limitation checks in various parts of the app
Status
READY
Description
This pull request delivers a major feature update by integrating user-generated content capabilities and an intelligent app review system. It allows users to react to and comment on headlines, and report inappropriate content, fostering a more interactive community. The underlying content limitation service has been upgraded to manage these new interactions, ensuring fair usage based on user roles and remote configurations. Additionally, the app now intelligently prompts users for reviews, directing positive feedback to app stores and capturing constructive criticism privately.
Type of Change