fix: Group updates by date and not time

This commit is contained in:
jmir1 2024-07-18 16:01:36 +02:00
parent 291c24b405
commit c83ebf322f
No known key found for this signature in database
GPG key ID: 7B3B624787A072BD
6 changed files with 14 additions and 14 deletions

View file

@ -30,7 +30,7 @@ import tachiyomi.presentation.core.screens.EmptyScreen
import tachiyomi.presentation.core.screens.LoadingScreen
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
import java.time.LocalDateTime
import java.time.LocalDate
import kotlin.time.Duration.Companion.seconds
@Composable
@ -153,6 +153,6 @@ private fun AnimeUpdatesBottomBar(
}
sealed interface AnimeUpdatesUiModel {
data class Header(val date: LocalDateTime) : AnimeUpdatesUiModel
data class Header(val date: LocalDate) : AnimeUpdatesUiModel
data class Item(val item: AnimeUpdatesItem) : AnimeUpdatesUiModel
}

View file

@ -32,7 +32,7 @@ import androidx.compose.ui.platform.LocalHapticFeedback
import androidx.compose.ui.text.font.FontStyle
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import eu.kanade.presentation.components.relativeDateTimeText
import eu.kanade.presentation.components.relativeDateText
import eu.kanade.presentation.entries.anime.components.EpisodeDownloadAction
import eu.kanade.presentation.entries.anime.components.EpisodeDownloadIndicator
import eu.kanade.presentation.entries.components.DotSeparatorText
@ -96,7 +96,7 @@ internal fun LazyListScope.animeUpdatesUiItems(
is AnimeUpdatesUiModel.Header -> {
ListGroupHeader(
modifier = Modifier.animateItem(),
text = relativeDateTimeText(item.date),
text = relativeDateText(item.date),
)
}
is AnimeUpdatesUiModel.Item -> {

View file

@ -27,7 +27,7 @@ import tachiyomi.presentation.core.components.material.PullRefresh
import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.screens.EmptyScreen
import tachiyomi.presentation.core.screens.LoadingScreen
import java.time.LocalDateTime
import java.time.LocalDate
import kotlin.time.Duration.Companion.seconds
@Composable
@ -141,6 +141,6 @@ private fun MangaUpdatesBottomBar(
}
sealed interface MangaUpdatesUiModel {
data class Header(val date: LocalDateTime) : MangaUpdatesUiModel
data class Header(val date: LocalDate) : MangaUpdatesUiModel
data class Item(val item: MangaUpdatesItem) : MangaUpdatesUiModel
}

View file

@ -32,7 +32,7 @@ import androidx.compose.ui.platform.LocalHapticFeedback
import androidx.compose.ui.text.font.FontStyle
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import eu.kanade.presentation.components.relativeDateTimeText
import eu.kanade.presentation.components.relativeDateText
import eu.kanade.presentation.entries.components.DotSeparatorText
import eu.kanade.presentation.entries.components.ItemCover
import eu.kanade.presentation.entries.manga.components.ChapterDownloadAction
@ -92,7 +92,7 @@ internal fun LazyListScope.mangaUpdatesUiItems(
is MangaUpdatesUiModel.Header -> {
ListGroupHeader(
modifier = Modifier.animateItem(),
text = relativeDateTimeText(item.date),
text = relativeDateText(item.date),
)
}
is MangaUpdatesUiModel.Item -> {

View file

@ -16,7 +16,7 @@ import eu.kanade.tachiyomi.data.download.anime.AnimeDownloadCache
import eu.kanade.tachiyomi.data.download.anime.AnimeDownloadManager
import eu.kanade.tachiyomi.data.download.anime.model.AnimeDownload
import eu.kanade.tachiyomi.data.library.anime.AnimeLibraryUpdateJob
import eu.kanade.tachiyomi.util.lang.toLocalDateTime
import eu.kanade.tachiyomi.util.lang.toLocalDate
import kotlinx.collections.immutable.PersistentList
import kotlinx.collections.immutable.mutate
import kotlinx.collections.immutable.persistentListOf
@ -392,8 +392,8 @@ class AnimeUpdatesScreenModel(
return items
.map { AnimeUpdatesUiModel.Item(it) }
.insertSeparators { before, after ->
val beforeDate = before?.item?.update?.dateFetch?.toLocalDateTime()
val afterDate = after?.item?.update?.dateFetch?.toLocalDateTime()
val beforeDate = before?.item?.update?.dateFetch?.toLocalDate()
val afterDate = after?.item?.update?.dateFetch?.toLocalDate()
when {
beforeDate != afterDate && afterDate != null -> AnimeUpdatesUiModel.Header(afterDate)
// Return null to avoid adding a separator between two items.

View file

@ -16,7 +16,7 @@ import eu.kanade.tachiyomi.data.download.manga.MangaDownloadCache
import eu.kanade.tachiyomi.data.download.manga.MangaDownloadManager
import eu.kanade.tachiyomi.data.download.manga.model.MangaDownload
import eu.kanade.tachiyomi.data.library.manga.MangaLibraryUpdateJob
import eu.kanade.tachiyomi.util.lang.toLocalDateTime
import eu.kanade.tachiyomi.util.lang.toLocalDate
import kotlinx.collections.immutable.PersistentList
import kotlinx.collections.immutable.mutate
import kotlinx.collections.immutable.persistentListOf
@ -373,8 +373,8 @@ class MangaUpdatesScreenModel(
return items
.map { MangaUpdatesUiModel.Item(it) }
.insertSeparators { before, after ->
val beforeDate = before?.item?.update?.dateFetch?.toLocalDateTime()
val afterDate = after?.item?.update?.dateFetch?.toLocalDateTime()
val beforeDate = before?.item?.update?.dateFetch?.toLocalDate()
val afterDate = after?.item?.update?.dateFetch?.toLocalDate()
when {
beforeDate != afterDate && afterDate != null -> MangaUpdatesUiModel.Header(afterDate)
// Return null to avoid adding a separator between two items.