Skip to content

Commit 4ffe883

Browse files
authored
Merge pull request #85 from flutter-news-app-full-source-code/feat/define-User-Generated-Content-data
Feat/define user generated content data
2 parents 3779a8b + 754d1e5 commit 4ffe883

File tree

91 files changed

+3787
-2945
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+3787
-2945
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Upcoming
22

3+
- **feat**: Added a comprehensive **Community & Engagement System**. This major feature introduces the foundational data models, fixtures and tests for user reactions, comments, a multi-entity reporting system, and a smart app review funnel. The entire system is remotely configurable via a new unified `CommunityConfig` model and extends `UserLimitsConfig` to support role-based limits for comments and reports.
4+
- **BREAKING** refactor!: Overhauled data models and configuration to align with the new identity pivot toward news aggregator. This major refactor introduces a more scalable remote configuration structure, standardizes enums and models for broader use (e.g., `FeedItem` settings), and simplifies ad, notification, and headline data structures for improved clarity and maintainability.
35
- **feat**: Introduce data models to support a filter-based push notification system. This includes `SavedHeadlineFilter`, `SavedSourceFilter`, and related configuration models, providing the architectural foundation for clients to implement notification subscriptions.
46
- **BREAKING** refactor!: Rework `UserPreferenceConfig` to support the new notification system with a more scalable, role-based map structure for all user limits.
57
- **test**: Add comprehensive unit tests for all new and refactored models.

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,27 @@ Provides data structures for persisting all user-specific configurations, from a
6666
6767
</details>
6868

69+
<details>
70+
<summary><strong>💬 Community & Engagement System</strong></summary>
71+
72+
---
73+
74+
### 💬 Reactions, Comments & Reporting
75+
76+
Provides a complete suite of models for building a rich community interaction layer. This includes individualized reactions, a robust commenting system with a built-in moderation workflow, and a flexible reporting system for headlines, sources, and comments.
77+
78+
> **Your Advantage:** Foster a vibrant and safe user community, maintain high content quality through effective moderation, and gather direct user feedback on your content.
79+
80+
---
81+
82+
### ⭐ Smart App Review Funnel
83+
84+
Implements the data structures for a strategic, two-layer review funnel. This system intelligently prompts engaged users for public reviews while channeling critical feedback from dissatisfied users into private channels.
85+
86+
> **Your Advantage:** Maximize positive app store ratings and improve your app's reputation by proactively managing user feedback and preventing negative public reviews.
87+
88+
</details>
89+
6990
<details>
7091
<summary><strong>🔔 Notification & Alerting System</strong></summary>
7192

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import 'package:json_annotation/json_annotation.dart';
2+
3+
/// {@template comment_report_reason}
4+
/// Defines the specific reasons a user can provide for reporting a comment.
5+
/// {@endtemplate}
6+
@JsonEnum()
7+
enum CommentReportReason {
8+
/// The comment is unsolicited advertising or promotion.
9+
@JsonValue('spamOrAdvertising')
10+
spamOrAdvertising,
11+
12+
/// The comment contains abusive language, personal attacks, or bullying.
13+
@JsonValue('harassmentOrBullying')
14+
harassmentOrBullying,
15+
16+
/// The comment targets certain groups with hateful language.
17+
@JsonValue('hateSpeech')
18+
hateSpeech,
19+
}

lib/src/enums/comment_status.dart

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import 'package:json_annotation/json_annotation.dart';
2+
3+
/// {@template comment_status}
4+
/// Defines the lifecycle status of a user-submitted comment.
5+
/// {@endtemplate}
6+
@JsonEnum()
7+
enum CommentStatus {
8+
/// The comment has been submitted and is awaiting moderation.
9+
@JsonValue('pendingReview')
10+
pendingReview,
11+
12+
/// The comment has been approved by a moderator and is publicly visible.
13+
@JsonValue('approved')
14+
approved,
15+
16+
/// The comment has been rejected by a moderator and is not visible.
17+
@JsonValue('rejected')
18+
rejected,
19+
20+
/// The comment has been automatically flagged by an AI moderation service.
21+
@JsonValue('flaggedByAI')
22+
flaggedByAI,
23+
24+
/// The comment has been hidden by the user who posted it.
25+
@JsonValue('hiddenByUser')
26+
hiddenByUser,
27+
}

lib/src/enums/engageable_type.dart

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import 'package:json_annotation/json_annotation.dart';
2+
3+
/// {@template engageable_type}
4+
/// Defines the types of entities that can be engaged with (reacted to or
5+
/// commented on).
6+
/// {@endtemplate}
7+
@JsonEnum()
8+
enum EngageableType {
9+
/// The engagement is for a news headline.
10+
@JsonValue('headline')
11+
headline,
12+
}

lib/src/enums/engagement_mode.dart

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import 'package:json_annotation/json_annotation.dart';
2+
3+
/// {@template engagement_mode}
4+
/// Defines the engagement features available to users.
5+
/// {@endtemplate}
6+
@JsonEnum()
7+
enum EngagementMode {
8+
/// Users can only react to headlines.
9+
@JsonValue('reactionsOnly')
10+
reactionsOnly,
11+
12+
/// Users can both react and comment on headlines.
13+
@JsonValue('reactionsAndComments')
14+
reactionsAndComments,
15+
}

lib/src/enums/enums.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,25 @@ export 'app_font_weight.dart';
66
export 'app_text_scale_factor.dart';
77
export 'app_user_role.dart';
88
export 'banner_ad_shape.dart';
9+
export 'comment_report_reason.dart';
10+
export 'comment_status.dart';
911
export 'content_status.dart';
1012
export 'content_type.dart';
1113
export 'dashboard_user_role.dart';
1214
export 'device_platform.dart';
15+
export 'engageable_type.dart';
16+
export 'engagement_mode.dart';
1317
export 'feed_decorator_category.dart';
1418
export 'feed_decorator_type.dart';
1519
export 'feed_item_click_behavior.dart';
1620
export 'feed_item_density.dart';
1721
export 'feed_item_image_style.dart';
22+
export 'headline_report_reason.dart';
1823
export 'push_notification_provider.dart';
1924
export 'push_notification_subscription_delivery_type.dart';
25+
export 'reaction_type.dart';
26+
export 'report_status.dart';
27+
export 'reportable_entity.dart';
2028
export 'sort_order.dart';
29+
export 'source_report_reason.dart';
2130
export 'source_type.dart';
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import 'package:json_annotation/json_annotation.dart';
2+
3+
/// {@template headline_report_reason}
4+
/// Defines the specific reasons a user can provide for reporting a headline.
5+
/// {@endtemplate}
6+
@JsonEnum()
7+
enum HeadlineReportReason {
8+
/// The content is factually incorrect or considered fake news.
9+
@JsonValue('misinformationOrFakeNews')
10+
misinformationOrFakeNews,
11+
12+
/// The headline is clickbait or does not reflect the article's content.
13+
@JsonValue('clickbaitTitle')
14+
clickbaitTitle,
15+
16+
/// The content contains hate speech, graphic violence, or other inappropriate
17+
/// material.
18+
@JsonValue('offensiveOrHateSpeech')
19+
offensiveOrHateSpeech,
20+
21+
/// The link leads to advertising, phishing, or fraudulent content.
22+
@JsonValue('spamOrScam')
23+
spamOrScam,
24+
25+
/// The article URL does not work.
26+
@JsonValue('brokenLink')
27+
brokenLink,
28+
29+
/// The content requires a subscription that was not disclosed.
30+
@JsonValue('paywalled')
31+
paywalled,
32+
}

lib/src/enums/reaction_type.dart

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import 'package:json_annotation/json_annotation.dart';
2+
3+
/// {@template reaction_type}
4+
/// Defines the types of reactions a user can have to a headline.
5+
/// {@endtemplate}
6+
@JsonEnum()
7+
enum ReactionType {
8+
/// Represents a "like" or "thumbs up" reaction.
9+
/// General positive approval.
10+
@JsonValue('like')
11+
like,
12+
13+
/// Represents an "insightful" or "lightbulb" reaction.
14+
/// Signals the article provided new information or a valuable perspective.
15+
@JsonValue('insightful')
16+
insightful,
17+
18+
/// Represents an "amusing" or "funny" reaction.
19+
/// For lighthearted or humorous content.
20+
@JsonValue('amusing')
21+
amusing,
22+
23+
/// Represents a "sad" reaction.
24+
/// For news that evokes empathy or sadness.
25+
@JsonValue('sad')
26+
sad,
27+
28+
/// Represents an "angry" or "outrageous" reaction.
29+
/// For news that provokes a strong negative emotional response.
30+
@JsonValue('angry')
31+
angry,
32+
33+
/// Represents a "skeptical" or "questionable" reaction.
34+
/// Signals that the user questions the validity, bias, or sourcing of the
35+
/// article without formally reporting it.
36+
@JsonValue('skeptical')
37+
skeptical,
38+
}

lib/src/enums/report_status.dart

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import 'package:json_annotation/json_annotation.dart';
2+
3+
/// {@template report_status}
4+
/// Defines the moderation workflow status for a user-submitted report.
5+
/// {@endtemplate}
6+
@JsonEnum()
7+
enum ReportStatus {
8+
/// The report has been submitted by a user and is awaiting review.
9+
@JsonValue('submitted')
10+
submitted,
11+
12+
/// A moderator is actively reviewing the report.
13+
@JsonValue('inReview')
14+
inReview,
15+
16+
/// The report has been reviewed and a decision has been made.
17+
@JsonValue('resolved')
18+
resolved,
19+
}

0 commit comments

Comments
 (0)