From 6aa54a0594d2722473827f94f09deec4d54e2272 Mon Sep 17 00:00:00 2001 From: kid1412621 Date: Fri, 12 Jan 2024 12:17:02 +0800 Subject: [PATCH] fix swipe to mark read article issue (#516) --- .../me/ash/reader/domain/service/AbstractRssRepository.kt | 2 +- .../main/java/me/ash/reader/ui/page/home/flow/ArticleItem.kt | 2 +- .../main/java/me/ash/reader/ui/page/home/flow/ArticleList.kt | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/me/ash/reader/domain/service/AbstractRssRepository.kt b/app/src/main/java/me/ash/reader/domain/service/AbstractRssRepository.kt index 91488ac5e..5728fccab 100644 --- a/app/src/main/java/me/ash/reader/domain/service/AbstractRssRepository.kt +++ b/app/src/main/java/me/ash/reader/domain/service/AbstractRssRepository.kt @@ -119,7 +119,7 @@ abstract class AbstractRssRepository( ) } - feedId != null -> { + feedId != null && articleId == null -> { articleDao.markAllAsReadByFeedId( accountId = accountId, feedId = feedId, diff --git a/app/src/main/java/me/ash/reader/ui/page/home/flow/ArticleItem.kt b/app/src/main/java/me/ash/reader/ui/page/home/flow/ArticleItem.kt index bb740c08f..bd800bd77 100644 --- a/app/src/main/java/me/ash/reader/ui/page/home/flow/ArticleItem.kt +++ b/app/src/main/java/me/ash/reader/ui/page/home/flow/ArticleItem.kt @@ -162,7 +162,7 @@ fun ArticleItem( } @ExperimentalMaterialApi @Composable -fun swipeToDismiss( +fun SwipeableArticleItem( articleWithFeed: ArticleWithFeed, onClick: (ArticleWithFeed) -> Unit = {}, onSwipeOut: (ArticleWithFeed) -> Unit = {}, diff --git a/app/src/main/java/me/ash/reader/ui/page/home/flow/ArticleList.kt b/app/src/main/java/me/ash/reader/ui/page/home/flow/ArticleList.kt index cc64423d3..0b1d3fde9 100644 --- a/app/src/main/java/me/ash/reader/ui/page/home/flow/ArticleList.kt +++ b/app/src/main/java/me/ash/reader/ui/page/home/flow/ArticleList.kt @@ -25,8 +25,8 @@ fun LazyListScope.ArticleList( when (val item = pagingItems.peek(index)) { is ArticleFlowItem.Article -> { item(key = item.articleWithFeed.article.id) { - swipeToDismiss( - articleWithFeed = (pagingItems[index] as ArticleFlowItem.Article).articleWithFeed, + SwipeableArticleItem( + articleWithFeed = item.articleWithFeed, onClick = { onClick(it) }, onSwipeOut = { onSwipeOut(it) } )