Keep per-kind facts on SourceKind and the Briefing's input in one place (review items 4, 5, 6, 7)

- SourceKind carries whether it feeds the Briefing, its fixed time window
  (Learning, Fun) and whether reading is picture-led (Fun); windowOf and
  the reader read from it.
- AppState.briefingArticles is the one place that says only News sources
  feed the Briefing; generateBriefing and the Briefing tab use it.
- articlesOf, hiddenCountOf and briefingArticles share one filter.
- FeedService.fetchAll takes windowOf: like AppState.windowOf.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
CedricandClaude Opus 5.5 committed 2026-10-16 16:07:37 +02:00
1 parent 49982c5467
commit 246564f1d9
8 files changed
+80 -30

No files matched your search

+4 -4
View File
@@ -23,15 +23,15 @@ class FeedService {
static const _timeout = Duration(seconds: 20);
/// Fetches all [sources] in parallel and drops articles older than the age
/// [maxAgeOf] gives for their Source. Failing feeds are reported in
/// Fetches all [sources] in parallel and drops articles older than the time
/// window [windowOf] gives for their Source. Failing feeds are reported in
/// [FeedResult.errors] instead of failing the whole refresh.
///
/// [corsProxy] is only used on web, where browsers block cross-origin feed
/// requests. It is prepended to the feed URL, e.g. `https://proxy/?url=`.
Future<FeedResult> fetchAll(
List<Source> sources, {
required Duration Function(Source source) maxAgeOf,
required Duration Function(Source source) windowOf,
String corsProxy = '',
}) async {
final errors = <String, String>{};
@@ -50,7 +50,7 @@ class FeedService {
for (final (i, list) in results.indexed)
for (final a in list)
if ((a.published == null ||
a.published!.isAfter(now.subtract(maxAgeOf(sources[i])))) &&
a.published!.isAfter(now.subtract(windowOf(sources[i])))) &&
seen.add(a.id))
a,
];