1+ import 'package:core/src/enums/positive_interaction_type.dart' ;
12import 'package:equatable/equatable.dart' ;
23import 'package:json_annotation/json_annotation.dart' ;
34import 'package:meta/meta.dart' ;
@@ -15,8 +16,9 @@ part 'app_review_config.g.dart';
1516/// ### Architectural Workflow
1617///
1718/// 1. **Eligibility**: A user becomes eligible to see the internal prompt after
18- /// reaching the [positiveInteractionThreshold] of positive actions (e.g.,
19- /// saving headlines).
19+ /// performing a total number of positive actions, as defined in
20+ /// [eligiblePositiveInteractions]. The required number of actions is set by
21+ /// `interactionCycleThreshold`.
2022///
2123/// 2. **Display Logic**: The `FeedDecoratorType.rateApp` decorator's visibility
2224/// is controlled by the user's `UserFeedDecoratorStatus` for `rateApp`. The
@@ -50,8 +52,9 @@ class AppReviewConfig extends Equatable {
5052 /// {@macro app_review_config}
5153 const AppReviewConfig ({
5254 required this .enabled,
53- required this .positiveInteractionThreshold ,
55+ required this .interactionCycleThreshold ,
5456 required this .initialPromptCooldownDays,
57+ required this .eligiblePositiveInteractions,
5558 required this .isNegativeFeedbackFollowUpEnabled,
5659 required this .isPositiveFeedbackFollowUpEnabled,
5760 });
@@ -63,14 +66,18 @@ class AppReviewConfig extends Equatable {
6366 /// A master switch to enable or disable the entire app review funnel.
6467 final bool enabled;
6568
66- /// The number of positive interactions (e.g., saving a headline) required
67- /// to trigger the initial review prompt.
68- final int positiveInteractionThreshold ;
69+ /// The number of positive interactions required to trigger the review prompt.
70+ /// the user's action counter resets after each prompt cycle .
71+ final int interactionCycleThreshold ;
6972
7073 /// The number of days to wait before showing the initial prompt again if the
7174 /// user provides negative feedback.
7275 final int initialPromptCooldownDays;
7376
77+ /// A list of user actions that are considered "positive" and count towards
78+ /// the `interactionCycleThreshold` .
79+ final List <PositiveInteractionType > eligiblePositiveInteractions;
80+
7481 /// A switch to enable or disable the follow-up prompt that asks for a
7582 /// text reason after a user provides negative feedback.
7683 final bool isNegativeFeedbackFollowUpEnabled;
@@ -87,8 +94,9 @@ class AppReviewConfig extends Equatable {
8794 @override
8895 List <Object > get props => [
8996 enabled,
90- positiveInteractionThreshold ,
97+ interactionCycleThreshold ,
9198 initialPromptCooldownDays,
99+ eligiblePositiveInteractions,
92100 isNegativeFeedbackFollowUpEnabled,
93101 isPositiveFeedbackFollowUpEnabled,
94102 ];
@@ -97,17 +105,20 @@ class AppReviewConfig extends Equatable {
97105 /// replaced with the new values.
98106 AppReviewConfig copyWith ({
99107 bool ? enabled,
100- int ? positiveInteractionThreshold ,
108+ int ? interactionCycleThreshold ,
101109 int ? initialPromptCooldownDays,
110+ List <PositiveInteractionType >? eligiblePositiveInteractions,
102111 bool ? isNegativeFeedbackFollowUpEnabled,
103112 bool ? isPositiveFeedbackFollowUpEnabled,
104113 }) {
105114 return AppReviewConfig (
106115 enabled: enabled ?? this .enabled,
107- positiveInteractionThreshold :
108- positiveInteractionThreshold ?? this .positiveInteractionThreshold ,
116+ interactionCycleThreshold :
117+ interactionCycleThreshold ?? this .interactionCycleThreshold ,
109118 initialPromptCooldownDays:
110119 initialPromptCooldownDays ?? this .initialPromptCooldownDays,
120+ eligiblePositiveInteractions:
121+ eligiblePositiveInteractions ?? this .eligiblePositiveInteractions,
111122 isNegativeFeedbackFollowUpEnabled:
112123 isNegativeFeedbackFollowUpEnabled ??
113124 this .isNegativeFeedbackFollowUpEnabled,
0 commit comments