This repository was archived by the owner on May 23, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
app/src/main/java/com/keylesspalace/tusky/components/notifications Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -95,12 +95,13 @@ class NotificationsPagingSource @Inject constructor(
9595
9696 // TODO this is the only location with the "raw" data for answering the TODO in NotificationsViewModel.hasNewestNotificationId()?
9797 // However the heuristic there would need (at least) the full range of notification ids here (so multiple calls to this method)?
98- val apiNotificationIds = response.body()!! .map { it.id }
99- Log .w(TAG , " Got notifications from api " + apiNotificationIds.first()+ " -" + apiNotificationIds.last())
98+ val notificationList = response.body()!!
99+ val apiNotificationIds = notificationList.map { it.id }
100+ Log .w(TAG , (if (params is LoadParams .Refresh ) " R" else " A/P" ) + " Got notifications from api " + apiNotificationIds.firstOrNull()+ " -" + apiNotificationIds.lastOrNull())
100101
101102 val links = Links .from(response.headers()[" link" ])
102103 return LoadResult .Page (
103- data = response.body() !! ,
104+ data = notificationList ,
104105 nextKey = links.next,
105106 prevKey = links.prev
106107 )
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ import com.keylesspalace.tusky.settings.PrefKeys
4141import com.keylesspalace.tusky.usecase.TimelineCases
4242import com.keylesspalace.tusky.util.StatusDisplayOptions
4343import com.keylesspalace.tusky.util.deserialize
44- import com.keylesspalace.tusky.util.isLessThan
44+ import com.keylesspalace.tusky.util.isLessThanOrEqual
4545import com.keylesspalace.tusky.util.serialize
4646import com.keylesspalace.tusky.util.throttleFirst
4747import com.keylesspalace.tusky.util.toViewData
@@ -531,9 +531,7 @@ class NotificationsViewModel @Inject constructor(
531531 return @filter if (hasNewestNotificationId(notification.type, status.id, notification.id)) {
532532 true
533533 } else {
534- // TODO this now leads sometimes (?) to a "List is empty" being displayed as first item.
535-
536- Log .d(TAG , " Filtering notification " + (n- 1 )+ " for " + status.id+ " at " + status.createdAt)
534+ Log .d(TAG , " Filtering notification " + (n- 1 )+ " for " + status.id+ " /" + notification.id+ " at " + status.createdAt)
537535 false
538536 }
539537 }
@@ -568,7 +566,7 @@ class NotificationsViewModel @Inject constructor(
568566
569567 val highestNotificationId = trackerArray[statusId]
570568
571- return if (highestNotificationId == null || highestNotificationId.isLessThan (notificationId)) {
569+ return if (highestNotificationId == null || highestNotificationId.isLessThanOrEqual (notificationId)) {
572570 trackerArray[statusId] = notificationId
573571
574572 true
You can’t perform that action at this time.
0 commit comments