@@ -3,7 +3,7 @@ import 'package:bloc_concurrency/bloc_concurrency.dart';
3
3
import 'package:equatable/equatable.dart' ;
4
4
import 'package:ht_data_repository/ht_data_repository.dart' ; // Generic Data Repository
5
5
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
7
7
8
8
part 'headlines_search_event.dart' ;
9
9
part 'headlines_search_state.dart' ;
@@ -14,11 +14,11 @@ class HeadlinesSearchBloc
14
14
required HtDataRepository <Headline > headlinesRepository,
15
15
required HtDataRepository <Category > categoryRepository,
16
16
required HtDataRepository <Source > sourceRepository,
17
- required HtDataRepository <Country > countryRepository,
17
+ // required HtDataRepository<Country> countryRepository, // Removed
18
18
}) : _headlinesRepository = headlinesRepository,
19
19
_categoryRepository = categoryRepository,
20
20
_sourceRepository = sourceRepository,
21
- _countryRepository = countryRepository,
21
+ // _countryRepository = countryRepository, // Removed
22
22
super (const HeadlinesSearchInitial ()) {
23
23
on < HeadlinesSearchModelTypeChanged > (_onHeadlinesSearchModelTypeChanged);
24
24
on < HeadlinesSearchFetchRequested > (
@@ -30,7 +30,7 @@ class HeadlinesSearchBloc
30
30
final HtDataRepository <Headline > _headlinesRepository;
31
31
final HtDataRepository <Category > _categoryRepository;
32
32
final HtDataRepository <Source > _sourceRepository;
33
- final HtDataRepository <Country > _countryRepository;
33
+ // final HtDataRepository<Country> _countryRepository; // Removed
34
34
static const _limit = 10 ;
35
35
36
36
Future <void > _onHeadlinesSearchModelTypeChanged (
@@ -49,11 +49,6 @@ class HeadlinesSearchBloc
49
49
: null ;
50
50
51
51
emit (HeadlinesSearchInitial (selectedModelType: event.newModelType));
52
-
53
- // Removed automatic re-search:
54
- // if (currentSearchTerm != null && currentSearchTerm.isNotEmpty) {
55
- // add(HeadlinesSearchFetchRequested(searchTerm: currentSearchTerm));
56
- // }
57
52
}
58
53
59
54
Future <void > _onSearchFetchRequested (
@@ -103,12 +98,12 @@ class HeadlinesSearchBloc
103
98
limit: _limit,
104
99
startAfterId: successState.cursor,
105
100
);
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
+ // );
112
107
}
113
108
emit (
114
109
successState.copyWith (
@@ -154,11 +149,11 @@ class HeadlinesSearchBloc
154
149
'q' : searchTerm,
155
150
'model' : modelType.toJson (),
156
151
}, 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,);
162
157
}
163
158
emit (
164
159
HeadlinesSearchSuccess (
0 commit comments