Always reset notifications marker on "mark as read"

fixes #897
This commit is contained in:
Grishka 2024-10-06 01:11:21 +03:00
parent 805fc5d8c7
commit 08847ec641
1 changed files with 4 additions and 4 deletions

View File

@ -241,7 +241,7 @@ public class NotificationsListFragment extends BaseNotificationsListFragment{
public boolean onOptionsItemSelected(MenuItem item){ public boolean onOptionsItemSelected(MenuItem item){
int id=item.getItemId(); int id=item.getItemId();
if(id==R.id.mark_all_read){ if(id==R.id.mark_all_read){
markAsRead(); markAsRead(true);
resetUnreadBackground(); resetUnreadBackground();
}else if(id==R.id.filters){ }else if(id==R.id.filters){
showFiltersAlert(); showFiltersAlert();
@ -257,11 +257,11 @@ public class NotificationsListFragment extends BaseNotificationsListFragment{
return mergeAdapter; return mergeAdapter;
} }
private void markAsRead(){ private void markAsRead(boolean force){
if(data.isEmpty()) if(data.isEmpty())
return; return;
String id=data.get(0).notification.pageMaxId; 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); new SaveMarkers(null, id).exec(accountID);
AccountSessionManager.get(accountID).setNotificationsMarker(id, true); AccountSessionManager.get(accountID).setNotificationsMarker(id, true);
realUnreadMarker=id; realUnreadMarker=id;
@ -290,7 +290,7 @@ public class NotificationsListFragment extends BaseNotificationsListFragment{
return; return;
for(NotificationViewModel n:items){ for(NotificationViewModel n:items){
if(ObjectIdComparator.INSTANCE.compare(n.notification.pageMinId, realUnreadMarker)<=0){ if(ObjectIdComparator.INSTANCE.compare(n.notification.pageMinId, realUnreadMarker)<=0){
markAsRead(); markAsRead(false);
break; break;
} }
} }