Skip to content

Commit 762e021

Browse files
committed
refactor(app-review): improve app review feature disablement logic
- Add check for parent community feature enablement - Clarify log message when app review feature is disabled - Reorganize code to improve readability and maintainability
1 parent 4c83a49 commit 762e021

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

lib/user_content/app_review/services/app_review_service.dart

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,18 @@ class AppReviewService {
5252
return;
5353
}
5454

55-
final appReviewConfig = remoteConfig.features.community.appReview;
56-
if (!appReviewConfig.enabled) {
57-
_logger.fine('App review feature is disabled.');
55+
final communityConfig = remoteConfig.features.community;
56+
// The app review feature should be disabled if the entire community
57+
// feature set is disabled.
58+
if (!communityConfig.enabled) {
59+
_logger.fine(
60+
'App review feature is disabled because the parent '
61+
'community feature is disabled.',
62+
);
63+
return;
64+
}
65+
if (!communityConfig.appReview.enabled) {
66+
_logger.fine('App review feature is disabled by its own config.');
5867
return;
5968
}
6069

@@ -65,6 +74,7 @@ class AppReviewService {
6574
return;
6675
}
6776

77+
final appReviewConfig = communityConfig.appReview;
6878
// Check initial cooldown.
6979
final daysSinceCreation = DateTime.now().difference(user.createdAt).inDays;
7080
// For the demo environment, we ignore the initial cooldown period.

0 commit comments

Comments
 (0)