diff --git a/lib/models/category.dart b/lib/models/category.dart index 340917a..92422ac 100644 --- a/lib/models/category.dart +++ b/lib/models/category.dart @@ -2,11 +2,13 @@ class Category { final int? id; final String? title; final int? userId; + final bool? hideGlobally; Category({ this.id, this.title, this.userId, + this.hideGlobally, }); factory Category.fromJson(Map json) { @@ -14,6 +16,8 @@ class Category { id: json['id'], title: json['title'], userId: json['user_id'], + hideGlobally: + (json.containsKey('hide_globally') ? json['hide_globally'] : false), ); } } diff --git a/lib/models/feed.dart b/lib/models/feed.dart index 1fcd4fb..09adb27 100644 --- a/lib/models/feed.dart +++ b/lib/models/feed.dart @@ -19,6 +19,7 @@ class Feed { final String? userAgent; final int? userId; final String? userName; + final bool? hideGlobally; Feed({ this.category, @@ -39,6 +40,7 @@ class Feed { this.userAgent, this.userId, this.userName, + this.hideGlobally, }); factory Feed.fromJson(Map json) { @@ -61,6 +63,8 @@ class Feed { userAgent: json['user_agent'], userId: json['user_id'], userName: json['user_name'], + hideGlobally: + (json.containsKey('hide_globally') ? json['hide_globally'] : false), ); } } diff --git a/lib/screens/home.dart b/lib/screens/home.dart index d75a541..377720b 100644 --- a/lib/screens/home.dart +++ b/lib/screens/home.dart @@ -17,9 +17,14 @@ List filterEntries(Data data, Nav nav) { .where((i) => i!.feed!.category!.id == nav.currentCategoryId) .toList(); } else if (nav.currentFeedId != null) { - entries = data.entries.where((i) => i!.feedId == nav.currentFeedId).toList(); + entries = + data.entries.where((i) => i!.feedId == nav.currentFeedId).toList(); } else { - entries = data.entries; + entries = data.entries + .where((i) => + i!.feed!.hideGlobally == false && + i.feed!.category!.hideGlobally == false) + .toList(); } return entries; } @@ -211,10 +216,11 @@ class MyHomeEntryList extends StatelessWidget { ), ), subtitle: Row(children: [ - Text( - (nav.currentFeedId == null ? entry.feed!.title! + '\n' : '') + - DateFormat('yyy-MM-dd HH:mm') - .format(DateTime.parse(entry.publishedAt!))), + Text((nav.currentFeedId == null + ? entry.feed!.title! + '\n' + : '') + + DateFormat('yyy-MM-dd HH:mm') + .format(DateTime.parse(entry.publishedAt!))), Spacer(), entry.starred! ? Icon(