News-feed behavior, content ingestion, categories, personalization, and likes.
The feed is the main For You reading surface. It loads a broad discover pool from content, personalizes ordering client-side, and lets the user tune, save, like, open, and verify articles.
Primary table: content
Relevant columns:
title, body, body_text, summarycategory, subcategory, tags, languagesource, author, sourceUrl, imageUrl, publishedAtreadTimeMinutes, confidenceScore, isFactChecked, isFeaturedlikeCountSupporting tables:
saved_items for saved state.content_likes for per-user likes.users for profile interests and persisted feed tuning.The discover category list is defined in content_repository_support.dart and ContentCategory:
newsarticleopinionreviewdiscoverbusinesssciencetechnologyhealthpoliticsculturesportsContentCategory.unknown exists in the Flutter model as a fallback but is not declared in the Appwrite enum.
FeedRepository.fetchDiscoverBatch queries content with:
Query.equal('category', categories)Query.orderDesc('publishedAt')Query.limit(limit)Query.offset(offset)Query.isNotNull('title')Rows map into ContentItem, then deduplicate by sourceUrl when present, otherwise by normalized title.
feedPersonalizationSnapshotProvider builds a snapshot from:
ForYouNotifier uses this snapshot to:
prioritizeItemsFeedTuningController handles:
Local preferences are stored in shared_preferences. For signed-in users, backend sync writes:
users.feedPreferencesusers.boostedTagsusers.suppressedTagsusers.interests when profile interests are adjustedThe feed refreshes the off-screen tail after tuning, keeping the current story in place.
Feed cards use LikeService:
isLiked(contentId) checks content_likes.setLiked(contentId, liked: true) creates a content_likes row, then runs like_sync with increment.setLiked(contentId, liked: false) deletes the like row, then runs like_sync with decrement.getLikeCount(contentId) reads content.likeCount.The UI supports double-tap heart animation and signed-out like gating.
news_refresh fetches NewsAPI and Guardian content, normalizes it, quality-filters it, deduplicates by URL, skips existing content with matching sourceUrl, and inserts rows into content.
Inserted rows include:
body_textisFactChecked: falseisFeatured: falsetags: []ForYouScreen is a one-item-at-a-time vertical feed. It uses a controlled PageView, keyboard and wheel navigation, touch swipe detection, pull-to-refresh on the first item, search shortcut, save button, like button, and tuning bottom sheets.