-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/build user generated content config and moderation suite #134
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
Merged
fulleni
merged 21 commits into
main
from
feat/build-user-generated-content-config-and-moderation-suite
Dec 1, 2025
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
87affcd
feat(l10n): add community config localization keys
fulleni 2ada8d8
build(l10n): sync
fulleni 3ce025d
feat(l10n): create EngagementMode localization extension
fulleni 7ffc3ba
feat(config): create app review settings form widget
fulleni 2bc554e
feat(config): create reporting settings form widget
fulleni 16efe2d
feat(config): create main community config form widget
fulleni 3adde5e
feat(config): integrate community config form into features tab
fulleni 895796c
feat(config): create engagement settings form widget
fulleni ccb76fd
chore(deps): update core package reference
fulleni ea6bef4
fix(data): update fixture data initialization with language code
fulleni 2e8c039
feat(app_configuration): add expansion tiles for app review settings
fulleni f4da20f
feat(l10n): add arb entries for internal prompt logic and follow-up a…
fulleni 2cd4585
build(l10n): sync
fulleni 9311cf9
style(app_configuration): adjust subtitle text style for better visib…
fulleni 9fc0361
refactor(app_configuration): conditionally show app review settings
fulleni df9b90a
refactor(app_configuration): improve app review settings form layout
fulleni 154ea05
fix(layout): align app review settings to the left
fulleni 7588290
feat(community): add global community features toggle
fulleni f889261
feat(app_configuration): add switch for source reporting
fulleni 813c7e4
feat(l10n): add translations for community
fulleni f891710
build(l10n): sync
fulleni File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
234 changes: 234 additions & 0 deletions
234
lib/app_configuration/widgets/app_review_settings_form.dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,234 @@ | ||
| import 'package:core/core.dart'; | ||
| import 'package:flutter/material.dart'; | ||
| import 'package:flutter_news_app_web_dashboard_full_source_code/app_configuration/widgets/app_config_form_fields.dart'; | ||
| import 'package:flutter_news_app_web_dashboard_full_source_code/l10n/l10n.dart'; | ||
| import 'package:ui_kit/ui_kit.dart'; | ||
|
|
||
| /// {@template app_review_settings_form} | ||
| /// A form widget for configuring app review funnel settings. | ||
| /// {@endtemplate} | ||
| class AppReviewSettingsForm extends StatefulWidget { | ||
| /// {@macro app_review_settings_form} | ||
| const AppReviewSettingsForm({ | ||
| required this.remoteConfig, | ||
| required this.onConfigChanged, | ||
| super.key, | ||
| }); | ||
|
|
||
| /// The current [RemoteConfig] object. | ||
| final RemoteConfig remoteConfig; | ||
|
|
||
| /// Callback to notify parent of changes to the [RemoteConfig]. | ||
| final ValueChanged<RemoteConfig> onConfigChanged; | ||
|
|
||
| @override | ||
| State<AppReviewSettingsForm> createState() => _AppReviewSettingsFormState(); | ||
| } | ||
|
|
||
| class _AppReviewSettingsFormState extends State<AppReviewSettingsForm> { | ||
| late final TextEditingController _positiveInteractionThresholdController; | ||
| late final TextEditingController _initialPromptCooldownController; | ||
|
|
||
| @override | ||
| void initState() { | ||
| super.initState(); | ||
| _initializeControllers(); | ||
| } | ||
|
|
||
| @override | ||
| void didUpdateWidget(covariant AppReviewSettingsForm oldWidget) { | ||
| super.didUpdateWidget(oldWidget); | ||
| if (widget.remoteConfig.features.community.appReview != | ||
| oldWidget.remoteConfig.features.community.appReview) { | ||
| _updateControllers(); | ||
| } | ||
| } | ||
|
|
||
| void _initializeControllers() { | ||
| final appReviewConfig = widget.remoteConfig.features.community.appReview; | ||
| _positiveInteractionThresholdController = TextEditingController( | ||
| text: appReviewConfig.positiveInteractionThreshold.toString(), | ||
| ); | ||
| _initialPromptCooldownController = TextEditingController( | ||
| text: appReviewConfig.initialPromptCooldownDays.toString(), | ||
| ); | ||
| } | ||
|
|
||
| void _updateControllers() { | ||
| final appReviewConfig = widget.remoteConfig.features.community.appReview; | ||
| _positiveInteractionThresholdController.text = appReviewConfig | ||
| .positiveInteractionThreshold | ||
| .toString(); | ||
| _initialPromptCooldownController.text = appReviewConfig | ||
| .initialPromptCooldownDays | ||
| .toString(); | ||
| } | ||
|
|
||
| @override | ||
| void dispose() { | ||
| _positiveInteractionThresholdController.dispose(); | ||
| _initialPromptCooldownController.dispose(); | ||
| super.dispose(); | ||
| } | ||
|
|
||
| @override | ||
| Widget build(BuildContext context) { | ||
| final l10n = AppLocalizationsX(context).l10n; | ||
| final communityConfig = widget.remoteConfig.features.community; | ||
| final appReviewConfig = communityConfig.appReview; | ||
|
|
||
| return Column( | ||
| children: [ | ||
| Padding( | ||
| padding: const EdgeInsets.symmetric(horizontal: AppSpacing.lg), | ||
fulleni marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| child: Column( | ||
| crossAxisAlignment: CrossAxisAlignment.start, | ||
| children: [ | ||
| SwitchListTile( | ||
| title: Text(l10n.enableAppFeedbackSystemLabel), | ||
| subtitle: Text(l10n.enableAppFeedbackSystemDescription), | ||
| value: appReviewConfig.enabled, | ||
| onChanged: (value) { | ||
| final newConfig = communityConfig.copyWith( | ||
| appReview: appReviewConfig.copyWith(enabled: value), | ||
| ); | ||
| widget.onConfigChanged( | ||
| widget.remoteConfig.copyWith( | ||
| features: widget.remoteConfig.features.copyWith( | ||
| community: newConfig, | ||
| ), | ||
| ), | ||
| ); | ||
| }, | ||
fulleni marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ), | ||
| if (appReviewConfig.enabled) ...[ | ||
| const SizedBox(height: AppSpacing.lg), | ||
| Padding( | ||
| padding: const EdgeInsetsDirectional.only( | ||
| start: AppSpacing.lg, | ||
| ), | ||
| child: Column( | ||
| children: [ | ||
| ExpansionTile( | ||
| title: Text(l10n.internalPromptLogicTitle), | ||
| childrenPadding: const EdgeInsetsDirectional.only( | ||
| start: AppSpacing.lg, | ||
| top: AppSpacing.md, | ||
| bottom: AppSpacing.md, | ||
| ), | ||
| expandedCrossAxisAlignment: CrossAxisAlignment.start, | ||
| children: [ | ||
| AppConfigIntField( | ||
| label: l10n.positiveInteractionThresholdLabel, | ||
| description: | ||
| l10n.positiveInteractionThresholdDescription, | ||
| value: appReviewConfig.positiveInteractionThreshold, | ||
| onChanged: (value) { | ||
| final newConfig = communityConfig.copyWith( | ||
| appReview: appReviewConfig.copyWith( | ||
| positiveInteractionThreshold: value, | ||
| ), | ||
| ); | ||
| widget.onConfigChanged( | ||
| widget.remoteConfig.copyWith( | ||
| features: widget.remoteConfig.features | ||
| .copyWith( | ||
| community: newConfig, | ||
| ), | ||
| ), | ||
| ); | ||
| }, | ||
| controller: _positiveInteractionThresholdController, | ||
| ), | ||
| AppConfigIntField( | ||
| label: l10n.initialPromptCooldownLabel, | ||
| description: l10n.initialPromptCooldownDescription, | ||
| value: appReviewConfig.initialPromptCooldownDays, | ||
| onChanged: (value) { | ||
| final newConfig = communityConfig.copyWith( | ||
| appReview: appReviewConfig.copyWith( | ||
| initialPromptCooldownDays: value, | ||
| ), | ||
| ); | ||
| widget.onConfigChanged( | ||
| widget.remoteConfig.copyWith( | ||
| features: widget.remoteConfig.features | ||
| .copyWith( | ||
| community: newConfig, | ||
| ), | ||
| ), | ||
| ); | ||
| }, | ||
| controller: _initialPromptCooldownController, | ||
| ), | ||
| ], | ||
| ), | ||
| const SizedBox(height: AppSpacing.lg), | ||
| ExpansionTile( | ||
| title: Text(l10n.followUpActionsTitle), | ||
| childrenPadding: const EdgeInsetsDirectional.only( | ||
| start: AppSpacing.lg, | ||
| top: AppSpacing.md, | ||
| bottom: AppSpacing.md, | ||
| ), | ||
| expandedCrossAxisAlignment: CrossAxisAlignment.start, | ||
| children: [ | ||
| SwitchListTile( | ||
| title: Text(l10n.requestStoreReviewLabel), | ||
| subtitle: Text(l10n.requestStoreReviewDescription), | ||
| value: appReviewConfig | ||
| .isPositiveFeedbackFollowUpEnabled, | ||
| onChanged: (value) { | ||
| final newAppReviewConfig = appReviewConfig | ||
| .copyWith( | ||
| isPositiveFeedbackFollowUpEnabled: value, | ||
| ); | ||
| widget.onConfigChanged( | ||
| widget.remoteConfig.copyWith( | ||
| features: widget.remoteConfig.features | ||
| .copyWith( | ||
| community: communityConfig.copyWith( | ||
| appReview: newAppReviewConfig, | ||
| ), | ||
| ), | ||
| ), | ||
| ); | ||
| }, | ||
| ), | ||
| SwitchListTile( | ||
| title: Text(l10n.requestWrittenFeedbackLabel), | ||
| subtitle: Text( | ||
| l10n.requestWrittenFeedbackDescription, | ||
| ), | ||
| value: appReviewConfig | ||
| .isNegativeFeedbackFollowUpEnabled, | ||
| onChanged: (value) { | ||
| final newAppReviewConfig = appReviewConfig | ||
| .copyWith( | ||
| isNegativeFeedbackFollowUpEnabled: value, | ||
| ); | ||
| widget.onConfigChanged( | ||
| widget.remoteConfig.copyWith( | ||
| features: widget.remoteConfig.features | ||
| .copyWith( | ||
| community: communityConfig.copyWith( | ||
| appReview: newAppReviewConfig, | ||
| ), | ||
| ), | ||
| ), | ||
| ); | ||
| }, | ||
| ), | ||
| ], | ||
| ), | ||
| ], | ||
| ), | ||
| ), | ||
| ], | ||
| ], | ||
| ), | ||
| ), | ||
| ], | ||
| ); | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.