Skip to content

Commit 07b4527

Browse files
committed
feat(content_management): enhance breaking news filtering with enum support
- Introduce BreakingNewsFilterStatus enum to handle breaking news filter options - Update ContentManagementBloc to use the new enum for more granular filtering - Add support for 'breaking only', 'non-breaking only', and 'all' options
1 parent 4a57839 commit 07b4527

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

lib/content_management/bloc/content_management_bloc.dart

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import 'package:equatable/equatable.dart';
77
import 'package:flutter_news_app_web_dashboard_full_source_code/content_management/bloc/headlines_filter/headlines_filter_bloc.dart';
88
import 'package:flutter_news_app_web_dashboard_full_source_code/content_management/bloc/sources_filter/sources_filter_bloc.dart';
99
import 'package:flutter_news_app_web_dashboard_full_source_code/content_management/bloc/topics_filter/topics_filter_bloc.dart';
10+
import 'package:flutter_news_app_web_dashboard_full_source_code/content_management/models/breaking_news_filter_status.dart';
1011
import 'package:flutter_news_app_web_dashboard_full_source_code/shared/constants/app_constants.dart';
1112
import 'package:flutter_news_app_web_dashboard_full_source_code/shared/services/pending_deletions_service.dart';
1213
import 'package:ui_kit/ui_kit.dart';
@@ -153,8 +154,15 @@ class ContentManagementBloc
153154
filter['eventCountry.id'] = {r'$in': state.selectedCountryIds};
154155
}
155156

156-
if (state.isBreaking != null) {
157-
filter['isBreaking'] = state.isBreaking;
157+
// Handle the breaking news filter based on the enum status.
158+
switch (state.isBreaking) {
159+
case BreakingNewsFilterStatus.breakingOnly:
160+
filter['isBreaking'] = true;
161+
case BreakingNewsFilterStatus.nonBreakingOnly:
162+
filter['isBreaking'] = false;
163+
case BreakingNewsFilterStatus.all:
164+
// For 'all', we don't add the 'isBreaking' key to the filter.
165+
break;
158166
}
159167

160168
return filter;

0 commit comments

Comments
 (0)