From 52d7877fccd60a1dae33d877ba6aa765dc098a52 Mon Sep 17 00:00:00 2001 From: Peter Stone Date: Wed, 22 Jul 2026 16:26:45 +0000 Subject: First round of testing feedback: images, unread landing, dark, delete - Fix OPML import status message reporting the raw pre-dedup count (144) instead of the actual unique feed count after Room's upsert collapses duplicates (108) -- cosmetic bug, the DB was already correct. - Article thumbnails: extract media:thumbnail/enclosure or the first in feed content, show via Coil in the article list. - App now lands on Unread instead of the feed list; a top-bar icon gets from there to the feed list (forward nav, not back-stack pop, since Unread is now the root). - Dark color scheme by default. - Delete-feed action (with confirmation) on each feed row -- was entirely missing. Deletes its non-saved articles too, so they don't linger as orphaned rows in the cross-feed Unread view; saved articles are kept regardless. - Room migration 1->2 for the new imageUrl column (real migration, not destructive fallback, since there's now real on-device subscription data from testing). Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01EZ7ikw2ukGJFTHE3bJS7zL --- .../main/java/org/terst/feedreader/data/AppDatabase.kt | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'app/src/main/java/org/terst/feedreader/data/AppDatabase.kt') diff --git a/app/src/main/java/org/terst/feedreader/data/AppDatabase.kt b/app/src/main/java/org/terst/feedreader/data/AppDatabase.kt index 8579341..e2f6c1a 100644 --- a/app/src/main/java/org/terst/feedreader/data/AppDatabase.kt +++ b/app/src/main/java/org/terst/feedreader/data/AppDatabase.kt @@ -4,10 +4,12 @@ import android.content.Context import androidx.room.Database import androidx.room.Room import androidx.room.RoomDatabase +import androidx.sqlite.db.SupportSQLiteDatabase +import androidx.room.migration.Migration @Database( entities = [FeedEntity::class, ArticleEntity::class, FilterRuleEntity::class], - version = 1, + version = 2, exportSchema = false ) abstract class AppDatabase : RoomDatabase() { @@ -18,12 +20,23 @@ abstract class AppDatabase : RoomDatabase() { companion object { @Volatile private var instance: AppDatabase? = null + // v2: added ArticleEntity.imageUrl (thumbnail support). Real migrations, + // not fallbackToDestructiveMigration, since this app already has real + // subscriptions/read-state on-device during active development -- + // wiping the DB on every schema tweak would mean re-importing OPML + // and losing read history each time. + private val MIGRATION_1_2 = object : Migration(1, 2) { + override fun migrate(db: SupportSQLiteDatabase) { + db.execSQL("ALTER TABLE articles ADD COLUMN imageUrl TEXT") + } + } + fun get(context: Context): AppDatabase = instance ?: synchronized(this) { instance ?: Room.databaseBuilder( context.applicationContext, AppDatabase::class.java, "feedreader.db" - ).build().also { instance = it } + ).addMigrations(MIGRATION_1_2).build().also { instance = it } } } } -- cgit v1.2.3