Skip to content

Commit 374f0d7

Browse files
committed
feat(reporting): add conditional headline reporting
- 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
1 parent a07a194 commit 374f0d7

File tree

1 file changed

+22
-16
lines changed

1 file changed

+22
-16
lines changed

lib/shared/widgets/headline_actions_bottom_sheet.dart

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ class _HeadlineActionsBottomSheetState
3737
false,
3838
);
3939

40+
final remoteConfig = context.watch<AppBloc>().state.remoteConfig;
41+
final isHeadlineReportingEnabled = remoteConfig
42+
?.features.community.reporting.headlineReportingEnabled ??
43+
false;
44+
4045
return Wrap(
4146
children: [
4247
ListTile(
@@ -72,22 +77,23 @@ class _HeadlineActionsBottomSheetState
7277
Share.share(widget.headline.url);
7378
},
7479
),
75-
ListTile(
76-
leading: const Icon(Icons.flag_outlined),
77-
title: Text(l10n.reportActionLabel),
78-
onTap: () async {
79-
// Pop the current sheet before showing the new one.
80-
Navigator.of(context).pop();
81-
await showModalBottomSheet<void>(
82-
context: context,
83-
isScrollControlled: true,
84-
builder: (_) => ReportContentBottomSheet(
85-
entityId: widget.headline.id,
86-
reportableEntity: ReportableEntity.headline,
87-
),
88-
);
89-
},
90-
),
80+
if (isHeadlineReportingEnabled)
81+
ListTile(
82+
leading: const Icon(Icons.flag_outlined),
83+
title: Text(l10n.reportActionLabel),
84+
onTap: () async {
85+
// Pop the current sheet before showing the new one.
86+
Navigator.of(context).pop();
87+
await showModalBottomSheet<void>(
88+
context: context,
89+
isScrollControlled: true,
90+
builder: (_) => ReportContentBottomSheet(
91+
entityId: widget.headline.id,
92+
reportableEntity: ReportableEntity.headline,
93+
),
94+
);
95+
},
96+
),
9197
],
9298
);
9399
}

0 commit comments

Comments
 (0)