Mark all messages as "not new" when summary notification is dismissed
This commit is contained in:
parent
a8937a2a2d
commit
fd920971b8
6 changed files with 28 additions and 13 deletions
|
@ -2407,7 +2407,7 @@ public class MessagingController {
|
|||
clearFetchingMailNotification(account);
|
||||
|
||||
if (getUnreadMessageCount(account) == 0) {
|
||||
notificationController.clearNewMailNotifications(account);
|
||||
notificationController.clearNewMailNotifications(account, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2493,7 +2493,7 @@ public class MessagingController {
|
|||
}
|
||||
|
||||
public void deleteAccount(Account account) {
|
||||
notificationController.clearNewMailNotifications(account);
|
||||
notificationController.clearNewMailNotifications(account, false);
|
||||
memorizingMessagingListener.removeAccount(account);
|
||||
}
|
||||
|
||||
|
@ -2549,8 +2549,14 @@ public class MessagingController {
|
|||
}
|
||||
}
|
||||
|
||||
public void removeNotificationsForAccount(Account account) {
|
||||
put("removeNotificationsForAccount", null, () -> {
|
||||
notificationController.clearNewMailNotifications(account, false);
|
||||
});
|
||||
}
|
||||
|
||||
public void cancelNotificationsForAccount(Account account) {
|
||||
notificationController.clearNewMailNotifications(account);
|
||||
notificationController.clearNewMailNotifications(account, true);
|
||||
}
|
||||
|
||||
public void cancelNotificationForMessage(Account account, MessageReference messageReference) {
|
||||
|
|
|
@ -38,8 +38,8 @@ internal class NewMailNotificationController(
|
|||
}
|
||||
}
|
||||
|
||||
fun clearNewMailNotifications(account: Account) {
|
||||
val cancelNotificationIds = newMailNotificationManager.clearNewMailNotifications(account)
|
||||
fun clearNewMailNotifications(account: Account, clearNewMessageState: Boolean) {
|
||||
val cancelNotificationIds = newMailNotificationManager.clearNewMailNotifications(account, clearNewMessageState)
|
||||
|
||||
cancelNotifications(cancelNotificationIds)
|
||||
}
|
||||
|
|
|
@ -100,8 +100,8 @@ internal class NewMailNotificationManager(
|
|||
)
|
||||
}
|
||||
|
||||
fun clearNewMailNotifications(account: Account): List<Int> {
|
||||
notificationRepository.clearNotifications(account)
|
||||
fun clearNewMailNotifications(account: Account, clearNewMessageState: Boolean): List<Int> {
|
||||
notificationRepository.clearNotifications(account, clearNewMessageState)
|
||||
return NotificationIds.getAllMessageNotificationIds(account)
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ class NotificationController internal constructor(
|
|||
newMailNotificationController.removeNewMailNotification(account, messageReference)
|
||||
}
|
||||
|
||||
fun clearNewMailNotifications(account: Account) {
|
||||
newMailNotificationController.clearNewMailNotifications(account)
|
||||
fun clearNewMailNotifications(account: Account, clearNewMessageState: Boolean) {
|
||||
newMailNotificationController.clearNewMailNotifications(account, clearNewMessageState)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,9 +51,12 @@ internal class NotificationRepository(
|
|||
}
|
||||
|
||||
@Synchronized
|
||||
fun clearNotifications(account: Account) {
|
||||
return notificationDataStore.clearNotifications(account).also {
|
||||
clearNotificationStore(account)
|
||||
fun clearNotifications(account: Account, clearNewMessageState: Boolean) {
|
||||
notificationDataStore.clearNotifications(account)
|
||||
clearNotificationStore(account)
|
||||
|
||||
if (clearNewMessageState) {
|
||||
clearNewMessageState(account)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -90,6 +93,11 @@ internal class NotificationRepository(
|
|||
}
|
||||
}
|
||||
|
||||
private fun clearNewMessageState(account: Account) {
|
||||
val messageStore = messageStoreManager.getMessageStore(account)
|
||||
messageStore.clearNewMessageState()
|
||||
}
|
||||
|
||||
private fun clearNotificationStore(account: Account) {
|
||||
val notificationStore = notificationStoreProvider.getNotificationStore(account)
|
||||
notificationStore.clearNotifications()
|
||||
|
|
|
@ -476,7 +476,8 @@ class MessageListFragment :
|
|||
messagingController.addListener(activityListener)
|
||||
|
||||
for (account in localSearch.getAccounts(preferences)) {
|
||||
messagingController.cancelNotificationsForAccount(account)
|
||||
// TODO: Only remove notifications for messages in the currently displayed message list
|
||||
messagingController.removeNotificationsForAccount(account)
|
||||
}
|
||||
|
||||
updateTitle()
|
||||
|
|
Loading…
Reference in a new issue