From c83ebf322f48d41ca1ad0105262160ecb7cde991 Mon Sep 17 00:00:00 2001 From: jmir1 Date: Thu, 18 Jul 2024 16:01:36 +0200 Subject: [PATCH] fix: Group updates by date and not time --- .../kanade/presentation/updates/anime/AnimeUpdatesScreen.kt | 4 ++-- .../kanade/presentation/updates/anime/AnimeUpdatesUiItem.kt | 4 ++-- .../kanade/presentation/updates/manga/MangaUpdatesScreen.kt | 4 ++-- .../kanade/presentation/updates/manga/MangaUpdatesUiItem.kt | 4 ++-- .../tachiyomi/ui/updates/anime/AnimeUpdatesScreenModel.kt | 6 +++--- .../tachiyomi/ui/updates/manga/MangaUpdatesScreenModel.kt | 6 +++--- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/eu/kanade/presentation/updates/anime/AnimeUpdatesScreen.kt b/app/src/main/java/eu/kanade/presentation/updates/anime/AnimeUpdatesScreen.kt index 10e3ec556..36428dfc5 100644 --- a/app/src/main/java/eu/kanade/presentation/updates/anime/AnimeUpdatesScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/updates/anime/AnimeUpdatesScreen.kt @@ -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 } diff --git a/app/src/main/java/eu/kanade/presentation/updates/anime/AnimeUpdatesUiItem.kt b/app/src/main/java/eu/kanade/presentation/updates/anime/AnimeUpdatesUiItem.kt index 6a253cb13..d42157e13 100644 --- a/app/src/main/java/eu/kanade/presentation/updates/anime/AnimeUpdatesUiItem.kt +++ b/app/src/main/java/eu/kanade/presentation/updates/anime/AnimeUpdatesUiItem.kt @@ -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 -> { diff --git a/app/src/main/java/eu/kanade/presentation/updates/manga/MangaUpdatesScreen.kt b/app/src/main/java/eu/kanade/presentation/updates/manga/MangaUpdatesScreen.kt index cd5b5e591..818f38bb9 100644 --- a/app/src/main/java/eu/kanade/presentation/updates/manga/MangaUpdatesScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/updates/manga/MangaUpdatesScreen.kt @@ -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 } diff --git a/app/src/main/java/eu/kanade/presentation/updates/manga/MangaUpdatesUiItem.kt b/app/src/main/java/eu/kanade/presentation/updates/manga/MangaUpdatesUiItem.kt index 3d425a20f..546af1f1e 100644 --- a/app/src/main/java/eu/kanade/presentation/updates/manga/MangaUpdatesUiItem.kt +++ b/app/src/main/java/eu/kanade/presentation/updates/manga/MangaUpdatesUiItem.kt @@ -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 -> { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/updates/anime/AnimeUpdatesScreenModel.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/updates/anime/AnimeUpdatesScreenModel.kt index 38ada49e2..daec3dac0 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/updates/anime/AnimeUpdatesScreenModel.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/updates/anime/AnimeUpdatesScreenModel.kt @@ -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. diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/updates/manga/MangaUpdatesScreenModel.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/updates/manga/MangaUpdatesScreenModel.kt index 71c2cf4a8..0b21e3ed1 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/updates/manga/MangaUpdatesScreenModel.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/updates/manga/MangaUpdatesScreenModel.kt @@ -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.