Fix: "Mark as Read" buttons don't work (#398) (#399)

Signed-off-by: Mark Bestavros <markbest@bu.edu>
This commit is contained in:
Mark Bestavros 2023-05-16 01:10:29 -04:00 committed by GitHub
parent b6ff8dfafa
commit 470dff5eec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View File

@ -19,7 +19,7 @@ enum class MarkAsReadConditions {
;
fun toDate(): Date? = when (this) {
All -> null
All -> Date()
else -> Calendar.getInstance().apply {
time = Date()
add(Calendar.DAY_OF_MONTH, when (this@MarkAsReadConditions) {

View File

@ -199,12 +199,13 @@ class FeverRssRepository @Inject constructor(
) {
super.markAsRead(groupId, feedId, articleId, before, isUnread)
val feverAPI = getFeverAPI()
var beforeUnixTimestamp = (before?.time ?: Date(Long.MAX_VALUE).time) / 1000
when {
groupId != null -> {
feverAPI.markGroup(
status = if (isUnread) FeverDTO.StatusEnum.Unread else FeverDTO.StatusEnum.Read,
id = groupId.dollarLast().toLong(),
before = before?.time ?: Date(Long.MAX_VALUE).time
before = beforeUnixTimestamp
)
}
@ -212,7 +213,7 @@ class FeverRssRepository @Inject constructor(
feverAPI.markFeed(
status = if (isUnread) FeverDTO.StatusEnum.Unread else FeverDTO.StatusEnum.Read,
id = feedId.dollarLast().toLong(),
before = before?.time ?: Date(Long.MAX_VALUE).time
before = beforeUnixTimestamp
)
}
@ -228,7 +229,7 @@ class FeverRssRepository @Inject constructor(
feverAPI.markFeed(
status = if (isUnread) FeverDTO.StatusEnum.Unread else FeverDTO.StatusEnum.Read,
id = it.id.dollarLast().toLong(),
before = before?.time ?: Date(Long.MAX_VALUE).time
before = beforeUnixTimestamp
)
}
}