summaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-07-22 19:04:30 +0000
committerPeter Stone <thepeterstone@gmail.com>2026-07-22 19:04:30 +0000
commit36ed34cd9ccd7388b96510e0225afe96979403a9 (patch)
treed415f601d1648e0b9d7be12768d96097e9fb9fd2 /app/src/main/java
parentbedf8a47a8b0601f4e3c253e4d2a7325c6ccbfc6 (diff)
Remove mark-as-read-on-scroll
Explicitly asked to revert: scrolling the article list shouldn't mark anything read on its own -- only opening an article (or the existing manual actions) should. Removed the LazyListState/snapshotFlow tracking in ArticleListScreen and the now-unused ArticleDao.markReadBatch. Verified: unread count in the DB is unchanged after scrolling through the list (1332 before and after).
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/org/terst/feedreader/data/Daos.kt5
-rw-r--r--app/src/main/java/org/terst/feedreader/ui/ArticleListScreen.kt18
2 files changed, 1 insertions, 22 deletions
diff --git a/app/src/main/java/org/terst/feedreader/data/Daos.kt b/app/src/main/java/org/terst/feedreader/data/Daos.kt
index 8fe2ec2..d089885 100644
--- a/app/src/main/java/org/terst/feedreader/data/Daos.kt
+++ b/app/src/main/java/org/terst/feedreader/data/Daos.kt
@@ -89,11 +89,6 @@ interface ArticleDao {
@Query("UPDATE articles SET isRead = :read WHERE id = :id")
suspend fun setRead(id: String, read: Boolean)
- // Used for mark-as-read-on-scroll in the article list -- batched per scroll-settle
- // rather than one query per row.
- @Query("UPDATE articles SET isRead = 1 WHERE id IN (:ids)")
- suspend fun markReadBatch(ids: List<String>)
-
@Query("UPDATE articles SET isRead = 1 WHERE feedId = :feedId")
suspend fun markAllReadForFeed(feedId: String)
diff --git a/app/src/main/java/org/terst/feedreader/ui/ArticleListScreen.kt b/app/src/main/java/org/terst/feedreader/ui/ArticleListScreen.kt
index 0beb523..c337492 100644
--- a/app/src/main/java/org/terst/feedreader/ui/ArticleListScreen.kt
+++ b/app/src/main/java/org/terst/feedreader/ui/ArticleListScreen.kt
@@ -8,7 +8,6 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
-import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowBack
@@ -29,7 +28,6 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
-import androidx.compose.runtime.snapshotFlow
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.layout.ContentScale
@@ -81,20 +79,6 @@ fun ArticleListScreen(
}
}
- val listState = rememberLazyListState()
- // Mark-as-read-on-scroll: once an article has scrolled fully above the viewport
- // (the user has moved past it), treat it as read -- the standard feed-reader
- // behavior, rather than requiring every article to be opened individually.
- LaunchedEffect(listState, visibleArticles) {
- snapshotFlow { listState.firstVisibleItemIndex }.collect { firstVisible ->
- val toMark = visibleArticles.take(firstVisible)
- .map { it.first }
- .filter { !it.isRead }
- .map { it.id }
- if (toMark.isNotEmpty()) db.articleDao().markReadBatch(toMark)
- }
- }
-
Scaffold(
topBar = {
TopAppBar(
@@ -123,7 +107,7 @@ fun ArticleListScreen(
)
}
) { padding ->
- LazyColumn(state = listState, modifier = Modifier.fillMaxSize().padding(padding)) {
+ LazyColumn(modifier = Modifier.fillMaxSize().padding(padding)) {
items(visibleArticles, key = { it.first.id }) { (article, result) ->
ArticleRow(
article = article,