Skip to content

Commit f4a141d

Browse files
committed
Merge branch 'main' into feat/add-go-router
2 parents d1291db + 0832430 commit f4a141d

File tree

106 files changed

+850
-776
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+850
-776
lines changed

.github/CODEOWNERS

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Every request must be reviewed and accepted by:
22

3-
- @felangel @AnnaPS @simpson-peter @marwfair @valentinallavayol
3+
- @marwfair @matiasleyba @SofiaRey

flutter_news_example/api/lib/client.dart

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ export 'package:news_blocks/news_blocks.dart'
99
ImageBlock,
1010
NewsBlock,
1111
NewsBlocksConverter,
12-
PostCategory,
1312
PostGridGroupBlock,
1413
PostGridTileBlock,
1514
PostLargeBlock,

flutter_news_example/api/lib/src/client/flutter_news_example_api_client.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -155,18 +155,18 @@ class FlutterNewsExampleApiClient {
155155
/// Requests news feed metadata.
156156
///
157157
/// Supported parameters:
158-
/// * [category] - The desired news [Category].
158+
/// * [categoryId] - The desired id of news category.
159159
/// * [limit] - The number of results to return.
160160
/// * [offset] - The (zero-based) offset of the first item
161161
/// in the collection to return.
162162
Future<FeedResponse> getFeed({
163-
Category? category,
163+
String? categoryId,
164164
int? limit,
165165
int? offset,
166166
}) async {
167167
final uri = Uri.parse('$_baseUrl/api/v1/feed').replace(
168168
queryParameters: <String, String>{
169-
if (category != null) 'category': category.name,
169+
if (categoryId != null) 'category': categoryId,
170170
if (limit != null) 'limit': '$limit',
171171
if (offset != null) 'offset': '$offset',
172172
},

flutter_news_example/api/lib/src/data/in_memory_news_data_source.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -102,20 +102,20 @@ class InMemoryNewsDataSource implements NewsDataSource {
102102

103103
@override
104104
Future<Feed> getFeed({
105-
Category category = Category.top,
105+
required String categoryId,
106106
int limit = 20,
107107
int offset = 0,
108108
}) async {
109109
final feed =
110-
_newsFeedData[category] ?? const Feed(blocks: [], totalBlocks: 0);
110+
_newsFeedData[categoryId] ?? const Feed(blocks: [], totalBlocks: 0);
111111
final totalBlocks = feed.totalBlocks;
112112
final normalizedOffset = math.min(offset, totalBlocks);
113113
final blocks = feed.blocks.sublist(normalizedOffset).take(limit).toList();
114114
return Feed(blocks: blocks, totalBlocks: totalBlocks);
115115
}
116116

117117
@override
118-
Future<List<Category>> getCategories() async => _newsFeedData.keys.toList();
118+
Future<List<Category>> getCategories() async => _categories;
119119

120120
@override
121121
Future<User> getUser({required String userId}) async {

flutter_news_example/api/lib/src/data/news_data_source.dart

+2-3
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ abstract class NewsDataSource {
5959
int offset = 0,
6060
});
6161

62-
/// Returns a news [Feed] for the provided [category].
63-
/// By default [Category.top] is used.
62+
/// Returns a news [Feed] for the provided [categoryId].
6463
///
6564
/// In addition, the feed can be paginated by supplying
6665
/// [limit] and [offset].
@@ -69,7 +68,7 @@ abstract class NewsDataSource {
6968
/// * [offset] - The (zero-based) offset of the first item
7069
/// in the collection to return.
7170
Future<Feed> getFeed({
72-
Category category = Category.top,
71+
required String categoryId,
7372
int limit = 20,
7473
int offset = 0,
7574
});

0 commit comments

Comments
 (0)