diff --git a/app/src/main/java/org/mozilla/fenix/gleanplumb/NimbusMessagingStorage.kt b/app/src/main/java/org/mozilla/fenix/gleanplumb/NimbusMessagingStorage.kt index 3e75f86bb1..0873d62c53 100644 --- a/app/src/main/java/org/mozilla/fenix/gleanplumb/NimbusMessagingStorage.kt +++ b/app/src/main/java/org/mozilla/fenix/gleanplumb/NimbusMessagingStorage.kt @@ -78,7 +78,7 @@ class NimbusMessagingStorage( ?: return@mapNotNull null, ) }.filter { - it.maxDisplayCount >= it.metadata.displayCount && + !it.isExpired && !it.metadata.dismissed && !it.metadata.pressed }.sortedByDescending { diff --git a/app/src/test/java/org/mozilla/fenix/gleanplumb/NimbusMessagingStorageTest.kt b/app/src/test/java/org/mozilla/fenix/gleanplumb/NimbusMessagingStorageTest.kt index f1d5bc2481..b1a06b9725 100644 --- a/app/src/test/java/org/mozilla/fenix/gleanplumb/NimbusMessagingStorageTest.kt +++ b/app/src/test/java/org/mozilla/fenix/gleanplumb/NimbusMessagingStorageTest.kt @@ -193,12 +193,19 @@ class NimbusMessagingStorageTest { id = "shown-many-times-message", 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), ) val messages = mapOf( "shown-many-times-message" to createMessageData( style = "high-priority", ), + "shown-two-times-message" to createMessageData( + style = "high-priority", + ), "normal-message" to createMessageData(style = "high-priority"), ) val styles = mapOf(