Skip to content

Commit 0004980

Browse files
committed
refactor(content_management): remove country search functionality
- Remove _onCountrySearchChanged method and its associated event - Remove droppable transformer from CreateHeadlineCountrySearchChanged event - Adjust country load more functionality to not consider search term
1 parent 0ad8093 commit 0004980

File tree

1 file changed

+0
-38
lines changed

1 file changed

+0
-38
lines changed

lib/content_management/bloc/create_headline/create_headline_bloc.dart

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@ class CreateHeadlineBloc
3535
on<CreateHeadlineCountryChanged>(_onCountryChanged);
3636
on<CreateHeadlineStatusChanged>(_onStatusChanged);
3737
on<CreateHeadlineSubmitted>(_onSubmitted);
38-
on<CreateHeadlineCountrySearchChanged>(
39-
_onCountrySearchChanged,
40-
transformer: droppable(),
41-
);
4238
on<CreateHeadlineLoadMoreCountriesRequested>(_onLoadMoreCountriesRequested);
4339
}
4440

@@ -195,37 +191,6 @@ class CreateHeadlineBloc
195191
}
196192
}
197193

198-
Future<void> _onCountrySearchChanged(
199-
CreateHeadlineCountrySearchChanged event,
200-
Emitter<CreateHeadlineState> emit,
201-
) async {
202-
await Future<void>.delayed(_searchDebounceDuration);
203-
emit(state.copyWith(countrySearchTerm: event.searchTerm));
204-
try {
205-
final countriesResponse = await _countriesRepository.readAll(
206-
filter: event.searchTerm.isNotEmpty ? {'name': event.searchTerm} : null,
207-
sort: [const SortOption('name', SortOrder.asc)],
208-
);
209-
210-
emit(
211-
state.copyWith(
212-
countries: countriesResponse.items,
213-
countriesCursor: countriesResponse.cursor,
214-
countriesHasMore: countriesResponse.hasMore,
215-
),
216-
);
217-
} on HttpException catch (e) {
218-
emit(state.copyWith(status: CreateHeadlineStatus.failure, exception: e));
219-
} catch (e) {
220-
emit(
221-
state.copyWith(
222-
status: CreateHeadlineStatus.failure,
223-
exception: UnknownException('An unexpected error occurred: $e'),
224-
),
225-
);
226-
}
227-
}
228-
229194
Future<void> _onLoadMoreCountriesRequested(
230195
CreateHeadlineLoadMoreCountriesRequested event,
231196
Emitter<CreateHeadlineState> emit,
@@ -239,9 +204,6 @@ class CreateHeadlineBloc
239204
pagination: state.countriesCursor != null
240205
? PaginationOptions(cursor: state.countriesCursor)
241206
: null,
242-
filter: state.countrySearchTerm.isNotEmpty
243-
? {'name': state.countrySearchTerm}
244-
: null,
245207
sort: [const SortOption('name', SortOrder.asc)],
246208
);
247209

0 commit comments

Comments
 (0)