Skip to content

Commit f7ff2b7

Browse files
committed
refactor(content_management): remove country search functionality
- Remove _onCountrySearchChanged method - Remove EditHeadlineCountrySearchChanged event handler - Remove state related to country search term - Remove filter logic in _onLoadMoreCountriesRequested based on search term
1 parent 5fdc6ec commit f7ff2b7

File tree

1 file changed

+0
-38
lines changed

1 file changed

+0
-38
lines changed

lib/content_management/bloc/edit_headline/edit_headline_bloc.dart

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@ class EditHeadlineBloc extends Bloc<EditHeadlineEvent, EditHeadlineState> {
3535
on<EditHeadlineCountryChanged>(_onCountryChanged);
3636
on<EditHeadlineStatusChanged>(_onStatusChanged);
3737
on<EditHeadlineSubmitted>(_onSubmitted);
38-
on<EditHeadlineCountrySearchChanged>(
39-
_onCountrySearchChanged,
40-
transformer: droppable(),
41-
);
4238
on<EditHeadlineLoadMoreCountriesRequested>(
4339
_onLoadMoreCountriesRequested,
4440
);
@@ -245,37 +241,6 @@ class EditHeadlineBloc extends Bloc<EditHeadlineEvent, EditHeadlineState> {
245241
}
246242
}
247243

248-
Future<void> _onCountrySearchChanged(
249-
EditHeadlineCountrySearchChanged event,
250-
Emitter<EditHeadlineState> emit,
251-
) async {
252-
await Future<void>.delayed(_searchDebounceDuration);
253-
emit(state.copyWith(countrySearchTerm: event.searchTerm));
254-
try {
255-
final countriesResponse = await _countriesRepository.readAll(
256-
filter: event.searchTerm.isNotEmpty ? {'name': event.searchTerm} : null,
257-
sort: [const SortOption('name', SortOrder.asc)],
258-
);
259-
260-
emit(
261-
state.copyWith(
262-
countries: countriesResponse.items,
263-
countriesCursor: countriesResponse.cursor,
264-
countriesHasMore: countriesResponse.hasMore,
265-
),
266-
);
267-
} on HttpException catch (e) {
268-
emit(state.copyWith(status: EditHeadlineStatus.failure, exception: e));
269-
} catch (e) {
270-
emit(
271-
state.copyWith(
272-
status: EditHeadlineStatus.failure,
273-
exception: UnknownException('An unexpected error occurred: $e'),
274-
),
275-
);
276-
}
277-
}
278-
279244
Future<void> _onLoadMoreCountriesRequested(
280245
EditHeadlineLoadMoreCountriesRequested event,
281246
Emitter<EditHeadlineState> emit,
@@ -289,9 +254,6 @@ class EditHeadlineBloc extends Bloc<EditHeadlineEvent, EditHeadlineState> {
289254
pagination: state.countriesCursor != null
290255
? PaginationOptions(cursor: state.countriesCursor)
291256
: null,
292-
filter: state.countrySearchTerm.isNotEmpty
293-
? {'name': state.countrySearchTerm}
294-
: null,
295257
sort: [const SortOption('name', SortOrder.asc)],
296258
);
297259

0 commit comments

Comments
 (0)