From 2ac74348e70261b5664746e3d6f6e9bf29a2e1bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=C2=A0Koby=C5=82ko?= Date: Mon, 12 Aug 2024 00:14:48 +0200 Subject: [PATCH] Fix sorting and colors on notifications screen --- .../twofasapp/data/notifications/NotificationsRepositoryImpl.kt | 2 +- .../feature/home/ui/notifications/NotificationsScreen.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/data/notifications/src/main/java/com/twofasapp/data/notifications/NotificationsRepositoryImpl.kt b/data/notifications/src/main/java/com/twofasapp/data/notifications/NotificationsRepositoryImpl.kt index 73f60a8e..d0aa5830 100644 --- a/data/notifications/src/main/java/com/twofasapp/data/notifications/NotificationsRepositoryImpl.kt +++ b/data/notifications/src/main/java/com/twofasapp/data/notifications/NotificationsRepositoryImpl.kt @@ -46,7 +46,7 @@ internal class NotificationsRepositoryImpl( } private fun List.sortedByTime(): List { - return sortedWith(compareBy({ it.isRead }, { it.publishTime.unaryMinus() })) + return sortedByDescending { it.publishTime } } override suspend fun getPeriodicNotificationCounter(): Int { diff --git a/feature/home/src/main/java/com/twofasapp/feature/home/ui/notifications/NotificationsScreen.kt b/feature/home/src/main/java/com/twofasapp/feature/home/ui/notifications/NotificationsScreen.kt index bbbefb43..b4d2ee6f 100644 --- a/feature/home/src/main/java/com/twofasapp/feature/home/ui/notifications/NotificationsScreen.kt +++ b/feature/home/src/main/java/com/twofasapp/feature/home/ui/notifications/NotificationsScreen.kt @@ -98,7 +98,7 @@ private fun ScreenContent( onInternalRouteClick(notification.internalRoute.orEmpty()) } } - .background(if (notification.isRead) TwTheme.color.surface else TwTheme.color.background) + .background(if (notification.isRead) TwTheme.color.background else TwTheme.color.surface) .padding(16.dp) ) HorizontalDivider(color = TwTheme.color.divider)