From 47261b9cbe0199168fad26b112c3a4eea4a61dea Mon Sep 17 00:00:00 2001 From: Kay Date: Sun, 3 May 2026 01:25:14 +0300 Subject: [PATCH] fix(greader): stop sync from undoing mark all as read markAsRead pushed only locally-known IDs via edit-tag, so unread items only on the server stayed unread and got flipped back on the next sync. Use the bulk mark-all-as-read endpoint instead. --- .../domain/service/GoogleReaderRssService.kt | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/app/src/main/java/me/ash/reader/domain/service/GoogleReaderRssService.kt b/app/src/main/java/me/ash/reader/domain/service/GoogleReaderRssService.kt index d6f8ef7ea..5b5cd6857 100644 --- a/app/src/main/java/me/ash/reader/domain/service/GoogleReaderRssService.kt +++ b/app/src/main/java/me/ash/reader/domain/service/GoogleReaderRssService.kt @@ -773,6 +773,26 @@ constructor( ) { val accountId = accountService.getCurrentAccountId() val googleReaderAPI = getGoogleReaderAPI() + + // The server can have unread items we don't have locally yet. Marking by ID + // misses those, and the next sync flips them back to unread. Mark the whole + // stream on the server instead using markAllAsRead. + if (!isUnread && articleId == null) { + val streamTag = + when { + groupId != null -> + GoogleReaderAPI.Stream.Category(groupId.dollarLast()).tag + feedId != null -> GoogleReaderAPI.Stream.Feed(feedId.dollarLast()).tag + else -> GoogleReaderAPI.Stream.AllItems.tag + } + super.markAsRead(groupId, feedId, articleId, before, isUnread) + googleReaderAPI.markAllAsRead( + streamId = streamTag, + sinceTimestamp = before?.time?.times(1000L), + ) + return + } + val markList: List = when { groupId != null -> {