2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-17 15:26:23 +00:00

Bug 1822899 - Limit Nimbus message display count to max display count

This commit is contained in:
Roger Yang 2023-03-16 16:02:34 -04:00 committed by mergify[bot]
parent b1ad36df71
commit 126591afd6
2 changed files with 8 additions and 1 deletions

View File

@ -78,7 +78,7 @@ class NimbusMessagingStorage(
?: return@mapNotNull null, ?: return@mapNotNull null,
) )
}.filter { }.filter {
it.maxDisplayCount >= it.metadata.displayCount && !it.isExpired &&
!it.metadata.dismissed && !it.metadata.dismissed &&
!it.metadata.pressed !it.metadata.pressed
}.sortedByDescending { }.sortedByDescending {

View File

@ -193,12 +193,19 @@ class NimbusMessagingStorageTest {
id = "shown-many-times-message", id = "shown-many-times-message",
displayCount = 10, displayCount = 10,
), ),
"shown-two-times-message" to Message.Metadata(
id = "shown-two-times-message",
displayCount = 2,
),
"normal-message" to Message.Metadata(id = "normal-message", displayCount = 0), "normal-message" to Message.Metadata(id = "normal-message", displayCount = 0),
) )
val messages = mapOf( val messages = mapOf(
"shown-many-times-message" to createMessageData( "shown-many-times-message" to createMessageData(
style = "high-priority", style = "high-priority",
), ),
"shown-two-times-message" to createMessageData(
style = "high-priority",
),
"normal-message" to createMessageData(style = "high-priority"), "normal-message" to createMessageData(style = "high-priority"),
) )
val styles = mapOf( val styles = mapOf(