From 92ba53a8c30c3199b42a43bc37df14152309ae2f Mon Sep 17 00:00:00 2001 From: Nik Clayton Date: Mon, 15 May 2023 23:11:14 +0200 Subject: [PATCH] Compare notification IDs by length as well as value (#3657) --- .../tusky/components/notifications/NotificationFetcher.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/components/notifications/NotificationFetcher.kt b/app/src/main/java/com/keylesspalace/tusky/components/notifications/NotificationFetcher.kt index ea76288bc..420dd8213 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/notifications/NotificationFetcher.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/notifications/NotificationFetcher.kt @@ -10,6 +10,7 @@ import com.keylesspalace.tusky.db.AccountManager import com.keylesspalace.tusky.entity.Marker import com.keylesspalace.tusky.entity.Notification import com.keylesspalace.tusky.network.MastodonApi +import com.keylesspalace.tusky.util.isLessThan import javax.inject.Inject import kotlin.math.min @@ -116,7 +117,7 @@ class NotificationFetcher @Inject constructor( val minId = when (val marker = fetchMarker(authHeader, account)) { null -> account.lastNotificationId.takeIf { it != "0" } - else -> if (marker.lastReadId > account.lastNotificationId) marker.lastReadId else account.lastNotificationId + else -> if (account.lastNotificationId.isLessThan(marker.lastReadId)) marker.lastReadId else account.lastNotificationId } Log.d(TAG, "getting Notifications for ${account.fullName}, min_id: $minId")