summaryrefslogtreecommitdiff
path: root/app/src/main/java/org/terst/feedreader/data/Entities.kt
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-07-22 08:08:58 +0000
committerPeter Stone <thepeterstone@gmail.com>2026-07-22 08:08:58 +0000
commitd8ce4b3c0f383e844b125d2d3abd618715bb3c89 (patch)
treeb586ff9b42392f2c44645773c2a2f2aadb9db406 /app/src/main/java/org/terst/feedreader/data/Entities.kt
Initial commit: Feeds, an Android RSS reader
Feed subscriptions (RSS 2.0 + Atom, hand-rolled parser), OPML import/export, WorkManager periodic fetch with conditional GET, Room-backed local storage (feeds/articles/filter rules), keyword mute/highlight filtering. Reader mode: on-device extraction via Mozilla's Readability.js (vendored from github.com/mozilla/readability, pinned to release 0.6.0) run in a hidden WebView, for feed articles whose provided content is too thin to be the real article body. Save: explicit action (from a feed article, or the Android share-sheet target for any URL) archives to Stash via POST /artifacts?sync=true, while a local on-device copy (Readability-extracted) is always kept so saved articles read offline regardless of Stash's reachability. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EZ7ikw2ukGJFTHE3bJS7zL
Diffstat (limited to 'app/src/main/java/org/terst/feedreader/data/Entities.kt')
-rw-r--r--app/src/main/java/org/terst/feedreader/data/Entities.kt43
1 files changed, 43 insertions, 0 deletions
diff --git a/app/src/main/java/org/terst/feedreader/data/Entities.kt b/app/src/main/java/org/terst/feedreader/data/Entities.kt
new file mode 100644
index 0000000..d71e1eb
--- /dev/null
+++ b/app/src/main/java/org/terst/feedreader/data/Entities.kt
@@ -0,0 +1,43 @@
+package org.terst.feedreader.data
+
+import androidx.room.ColumnInfo
+import androidx.room.Entity
+import androidx.room.PrimaryKey
+
+@Entity(tableName = "feeds")
+data class FeedEntity(
+ @PrimaryKey val id: String, // the feed URL itself -- naturally unique, no need for a separate id scheme
+ val title: String,
+ val siteUrl: String? = null, // the human-facing site link, if the feed provides one (distinct from the feed XML URL)
+ val lastFetchedAt: Long? = null,
+ val etag: String? = null, // conditional-GET caching (If-None-Match) to avoid re-downloading unchanged feeds
+ val lastModified: String? = null, // conditional-GET caching (If-Modified-Since)
+ val lastError: String? = null // set when a fetch fails; cleared on the next successful fetch
+)
+
+@Entity(tableName = "articles")
+data class ArticleEntity(
+ @PrimaryKey val id: String, // guid if the feed provides one, else a hash of the link
+ @ColumnInfo(index = true) val feedId: String?, // null for a standalone article saved via the share-sheet target, not tied to any feed
+ val title: String,
+ val link: String,
+ val author: String? = null,
+ val publishedAt: Long? = null,
+ val feedContentHtml: String? = null, // whatever content the feed itself provided (may be a summary, may be full text)
+ val extractedContent: String? = null, // Readability-extracted full text, filled in on first read if feedContentHtml was thin
+ val isRead: Boolean = false,
+ val isSaved: Boolean = false, // explicitly kept (independent of read state) -- triggers a Stash save
+ val stashArtifactId: String? = null, // set once successfully archived to Stash; null means not yet saved or save failed
+ val createdAt: Long
+)
+
+enum class FilterAction { MUTE, HIGHLIGHT }
+
+@Entity(tableName = "filter_rules")
+data class FilterRuleEntity(
+ @PrimaryKey(autoGenerate = true) val id: Long = 0,
+ val pattern: String, // plain substring match, case-insensitive -- see FilterRuleEngine
+ val action: FilterAction,
+ val feedId: String? = null, // null applies globally across all feeds
+ val createdAt: Long
+)