Remove 'new message' notification when user marks the message as read
We already handled the case where the message was marked as read on the server. This handles the case where the user marks the message as read locally.
@@ -1167,6 +1167,10 @@ public class MessagingController {
l.folderStatusChanged(account, folderId);
}
+ if (flag == Flag.SEEN && newState) {
+ cancelNotificationsForMessages(account, folderId, uids);
+ }
+
if (accountSupportsFlags) {
LocalFolder localFolder = localStore.getFolder(folderId);
try {
@@ -1183,6 +1187,13 @@ public class MessagingController {
}
}
+ private void cancelNotificationsForMessages(Account account, long folderId, List<String> uids) {
+ for (String uid : uids) {
+ MessageReference messageReference = new MessageReference(account.getUuid(), folderId, uid);
+ notificationController.removeNewMailNotification(account, messageReference);
+ }
+ }
+
/**
* Set or remove a flag for a set of messages in a specific folder.
* <p>
