Compare commits

...

2 Commits

Author SHA1 Message Date
Matthew Witman
c561f9d404 Updated header creation logic... again 2024-02-24 14:16:33 -05:00
Matthew Witman
20a7db6c63 Updated header creation logic 2024-02-24 14:05:57 -05:00

View File

@@ -40,13 +40,10 @@ class UpdateUpcomingScreenModel(
private fun List<Manga>.toUpcomingUIModels(): ImmutableList<UpcomingUIModel> {
return map { UpcomingUIModel.Item(it) }
.insertSeparators { before, after ->
val beforeDate = before?.item?.expectedNextUpdate?.toLocalDate() ?: LocalDate.MAX
val afterDate = after?.item?.expectedNextUpdate?.toLocalDate() ?: LocalDate.MAX
val beforeDate = before?.item?.expectedNextUpdate?.toLocalDate()
val afterDate = after?.item?.expectedNextUpdate?.toLocalDate()
when {
beforeDate.isBefore(afterDate)
or beforeDate.equals(LocalDate.MAX)
and !afterDate.equals(LocalDate.MAX)
-> UpcomingUIModel.Header(afterDate)
beforeDate != afterDate && afterDate != null -> UpcomingUIModel.Header(afterDate)
// Return null to avoid adding a separator between two items.
else -> null
}