Skip to content

Commit f516788

Browse files
committed
refactor(search): remove country search
- Removed country repository - Removed country search logic
1 parent 04d368f commit f516788

File tree

1 file changed

+15
-20
lines changed

1 file changed

+15
-20
lines changed

lib/headlines-search/bloc/headlines_search_bloc.dart

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import 'package:bloc_concurrency/bloc_concurrency.dart';
33
import 'package:equatable/equatable.dart';
44
import 'package:ht_data_repository/ht_data_repository.dart'; // Generic Data Repository
55
import 'package:ht_main/headlines-search/models/search_model_type.dart'; // Import SearchModelType
6-
import 'package:ht_shared/ht_shared.dart'; // Shared models, including Headline
6+
import 'package:ht_shared/ht_shared.dart' show Headline, Category, Source, HtHttpException, PaginatedResponse; // Shared models
77

88
part 'headlines_search_event.dart';
99
part 'headlines_search_state.dart';
@@ -14,11 +14,11 @@ class HeadlinesSearchBloc
1414
required HtDataRepository<Headline> headlinesRepository,
1515
required HtDataRepository<Category> categoryRepository,
1616
required HtDataRepository<Source> sourceRepository,
17-
required HtDataRepository<Country> countryRepository,
17+
// required HtDataRepository<Country> countryRepository, // Removed
1818
}) : _headlinesRepository = headlinesRepository,
1919
_categoryRepository = categoryRepository,
2020
_sourceRepository = sourceRepository,
21-
_countryRepository = countryRepository,
21+
// _countryRepository = countryRepository, // Removed
2222
super(const HeadlinesSearchInitial()) {
2323
on<HeadlinesSearchModelTypeChanged>(_onHeadlinesSearchModelTypeChanged);
2424
on<HeadlinesSearchFetchRequested>(
@@ -30,7 +30,7 @@ class HeadlinesSearchBloc
3030
final HtDataRepository<Headline> _headlinesRepository;
3131
final HtDataRepository<Category> _categoryRepository;
3232
final HtDataRepository<Source> _sourceRepository;
33-
final HtDataRepository<Country> _countryRepository;
33+
// final HtDataRepository<Country> _countryRepository; // Removed
3434
static const _limit = 10;
3535

3636
Future<void> _onHeadlinesSearchModelTypeChanged(
@@ -49,11 +49,6 @@ class HeadlinesSearchBloc
4949
: null;
5050

5151
emit(HeadlinesSearchInitial(selectedModelType: event.newModelType));
52-
53-
// Removed automatic re-search:
54-
// if (currentSearchTerm != null && currentSearchTerm.isNotEmpty) {
55-
// add(HeadlinesSearchFetchRequested(searchTerm: currentSearchTerm));
56-
// }
5752
}
5853

5954
Future<void> _onSearchFetchRequested(
@@ -103,12 +98,12 @@ class HeadlinesSearchBloc
10398
limit: _limit,
10499
startAfterId: successState.cursor,
105100
);
106-
case SearchModelType.country:
107-
response = await _countryRepository.readAllByQuery(
108-
{'q': searchTerm, 'model': modelType.toJson()},
109-
limit: _limit,
110-
startAfterId: successState.cursor,
111-
);
101+
// case SearchModelType.country: // Removed
102+
// response = await _countryRepository.readAllByQuery(
103+
// {'q': searchTerm, 'model': modelType.toJson()},
104+
// limit: _limit,
105+
// startAfterId: successState.cursor,
106+
// );
112107
}
113108
emit(
114109
successState.copyWith(
@@ -154,11 +149,11 @@ class HeadlinesSearchBloc
154149
'q': searchTerm,
155150
'model': modelType.toJson(),
156151
}, limit: _limit,);
157-
case SearchModelType.country:
158-
response = await _countryRepository.readAllByQuery({
159-
'q': searchTerm,
160-
'model': modelType.toJson(),
161-
}, limit: _limit,);
152+
// case SearchModelType.country: // Removed
153+
// response = await _countryRepository.readAllByQuery({
154+
// 'q': searchTerm,
155+
// 'model': modelType.toJson(),
156+
// }, limit: _limit,);
162157
}
163158
emit(
164159
HeadlinesSearchSuccess(

0 commit comments

Comments
 (0)