Repository: thunderbird/thunderbird-android (language: kotlin)

Issue:
more than 8 new messages always says there are only 8 new messages in notification
### Checklist

- [X] I have used the search function to see if someone else has already submitted the same bug report.
- [X] I will describe the problem with as much detail as possible.

### App version

6.511

### Where did you get the app from?

Google Play

### Android version

12

### Device model

Samsung Galaxy Tab S6

### Steps to reproduce

Receive more than 8 new messages

### Expected behavior

The message count in the notification should tell you how many new messages you actually have, even if there are only 8 of them displayed in the notification.

I know this is possible to do because Twitter does it. There will only be 8 of them actually displayed, but the count at the top shows 15 or 20, etc.

### Actual behavior

K9 only shows 8 messages in the notification, which is fine, except that it also tells you that there are only 8, even though there are actually more. When you swipe them away or otherwise deal with them, additional message notifications appear to fill up the space freed up by the one you actioned. If it told you how many were actually there then you would know to expect the new ones to fill in as you deal with them.

### Logs

_No response_


Discussion hints:
Since Android doesn't display more than 8 notifications per group, the app never creates more than 8 system notifications per account. K-9 Mail does keep track of all new messages and will create new system notifications as needed (i.e. when one or more of the existing notifications has been dismissed).

The total number of notifications an app is allowed to create is limited. The number is device-specific and 50 most of the time. But I found reports of it being as low as 24 on some devices.

We could create 9 notifications per account. At least then you'd know that there are more new messages than the 8 you can see.
Yeah, my devices (all Samsung) seem to top out at 24 for GMail and Twitter, both of which tell me how many there are (up to 24) at the top of the group, but only actually shows 8 of them.

Pull request: Increase number of active notifications to 9
This way users can know that when the number 9 is displayed in the group summary, there's more notifications than the 8 they can currently see.

Fixes #6820

Test command: ./gradlew :app:core:testDebugUnitTest --tests "com.fsck.k9.notification.NotificationDataStoreTest"

Fix patch:
diff --git a/app/core/src/main/java/com/fsck/k9/notification/NotificationDataStore.kt b/app/core/src/main/java/com/fsck/k9/notification/NotificationDataStore.kt
index b9f63f3bba4..f3e80d344e9 100644
--- a/app/core/src/main/java/com/fsck/k9/notification/NotificationDataStore.kt
+++ b/app/core/src/main/java/com/fsck/k9/notification/NotificationDataStore.kt
@@ -3,7 +3,7 @@ package com.fsck.k9.notification
 import com.fsck.k9.Account
 import com.fsck.k9.controller.MessageReference
 
-internal const val MAX_NUMBER_OF_NEW_MESSAGE_NOTIFICATIONS = 8
+internal const val MAX_NUMBER_OF_NEW_MESSAGE_NOTIFICATIONS = 9
 
 /**
  * Stores information about new message notifications for all accounts.


Test patch:
diff --git a/app/core/src/test/java/com/fsck/k9/notification/NotificationDataStoreTest.kt b/app/core/src/test/java/com/fsck/k9/notification/NotificationDataStoreTest.kt
index 3e1d869b074..781acaf6554 100644
--- a/app/core/src/test/java/com/fsck/k9/notification/NotificationDataStoreTest.kt
+++ b/app/core/src/test/java/com/fsck/k9/notification/NotificationDataStoreTest.kt
@@ -52,8 +52,9 @@ class NotificationDataStoreTest : RobolectricTest() {
         notificationDataStore.addNotification(account, createNotificationContent("6"), TIMESTAMP)
         notificationDataStore.addNotification(account, createNotificationContent("7"), TIMESTAMP)
         notificationDataStore.addNotification(account, createNotificationContent("8"), TIMESTAMP)
+        notificationDataStore.addNotification(account, createNotificationContent("9"), TIMESTAMP)
 
-        val result = notificationDataStore.addNotification(account, createNotificationContent("9"), TIMESTAMP)
+        val result = notificationDataStore.addNotification(account, createNotificationContent("10"), TIMESTAMP)
 
         assertNotNull(result)
         assertThat(result.shouldCancelNotification).isTrue()
@@ -86,7 +87,8 @@ class NotificationDataStoreTest : RobolectricTest() {
         notificationDataStore.addNotification(account, createNotificationContent("7"), TIMESTAMP)
         notificationDataStore.addNotification(account, createNotificationContent("8"), TIMESTAMP)
         notificationDataStore.addNotification(account, createNotificationContent("9"), TIMESTAMP)
-        val latestContent = createNotificationContent("10")
+        notificationDataStore.addNotification(account, createNotificationContent("10"), TIMESTAMP)
+        val latestContent = createNotificationContent("11")
         notificationDataStore.addNotification(account, latestContent, TIMESTAMP)
 
         val result = notificationDataStore.removeNotifications(account) { listOf(latestContent.messageReference) }
@@ -207,7 +209,8 @@ class NotificationDataStoreTest : RobolectricTest() {
         notificationDataStore.addNotification(account, createNotificationContent("6"), TIMESTAMP)
         notificationDataStore.addNotification(account, createNotificationContent("7"), TIMESTAMP)
         notificationDataStore.addNotification(account, createNotificationContent("8"), TIMESTAMP)
-        val latestNotificationContent = createNotificationContent("9")
+        notificationDataStore.addNotification(account, createNotificationContent("9"), TIMESTAMP)
+        val latestNotificationContent = createNotificationContent("10")
         notificationDataStore.addNotification(account, latestNotificationContent, TIMESTAMP)
         val content = createNotificationContent("1")