From 08847ec6416a9044168cb51ec58b6e8466bcdd38 Mon Sep 17 00:00:00 2001 From: Grishka Date: Sun, 6 Oct 2024 01:11:21 +0300 Subject: [PATCH] Always reset notifications marker on "mark as read" fixes #897 --- .../android/fragments/NotificationsListFragment.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/NotificationsListFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/NotificationsListFragment.java index b774a78a..a25362ef 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/NotificationsListFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/NotificationsListFragment.java @@ -241,7 +241,7 @@ public class NotificationsListFragment extends BaseNotificationsListFragment{ public boolean onOptionsItemSelected(MenuItem item){ int id=item.getItemId(); if(id==R.id.mark_all_read){ - markAsRead(); + markAsRead(true); resetUnreadBackground(); }else if(id==R.id.filters){ showFiltersAlert(); @@ -257,11 +257,11 @@ public class NotificationsListFragment extends BaseNotificationsListFragment{ return mergeAdapter; } - private void markAsRead(){ + private void markAsRead(boolean force){ if(data.isEmpty()) return; String id=data.get(0).notification.pageMaxId; - if(ObjectIdComparator.INSTANCE.compare(id, realUnreadMarker)>0){ + if(force || ObjectIdComparator.INSTANCE.compare(id, realUnreadMarker)>0){ new SaveMarkers(null, id).exec(accountID); AccountSessionManager.get(accountID).setNotificationsMarker(id, true); realUnreadMarker=id; @@ -290,7 +290,7 @@ public class NotificationsListFragment extends BaseNotificationsListFragment{ return; for(NotificationViewModel n:items){ if(ObjectIdComparator.INSTANCE.compare(n.notification.pageMinId, realUnreadMarker)<=0){ - markAsRead(); + markAsRead(false); break; } }