Bug 1880483 — Add inverse triggers to messaging component

This is a breaking change.

This changes the `trigger` key to `trigger-if-all` to document that all
triggers in this list must evaluate to true.

It also adds `exclude-if-any`, a list of triggers which, if any are true
will exclude the message.

This will remove the need for triggers like `I_AM_NOT_BROWSER_DEFAULT`.
fenix/125.0
James Hugman 4 months ago committed by mergify[bot]
parent 7802427e22
commit dea7509173

@ -29,9 +29,10 @@ import:
text: default_browser_experiment_card_text
surface: homescreen
action: "MAKE_DEFAULT_BROWSER"
trigger:
- I_AM_NOT_DEFAULT_BROWSER
trigger-if-all:
- USER_ESTABLISHED_INSTALL
exclude-if-any:
- I_AM_DEFAULT_BROWSER
style: PERSISTENT
button-label: preferences_set_as_default_browser
@ -47,7 +48,8 @@ import:
text: nimbus_notification_default_browser_text
surface: notification
style: NOTIFICATION
trigger:
- I_AM_NOT_DEFAULT_BROWSER
trigger-if-all:
- DAY_3_AFTER_INSTALL
exclude-if-any:
- I_AM_DEFAULT_BROWSER
action: MAKE_DEFAULT_BROWSER

@ -66,7 +66,7 @@ class NimbusMessagingHomescreenTest {
buttonLabel = Res.string(messageButtonLabel),
text = Res.string(messageText),
title = Res.string(messageTitle),
trigger = listOf("ALWAYS"),
triggerIfAll = listOf("ALWAYS"),
),
),
styles = mapOf(

@ -113,6 +113,7 @@ class AppStoreTest {
"action",
mockk(),
emptyList(),
emptyList(),
mockk(),
)
appStore.dispatch(UpdateMessageToShow(message)).join()

@ -69,7 +69,8 @@ class DefaultMessageControllerTest {
data = data,
style = mockk(relaxed = true),
action = "action",
triggers = emptyList(),
triggerIfAll = emptyList(),
excludeIfAny = emptyList(),
metadata = Message.Metadata(
id = "id",
displayCount = 0,

@ -355,7 +355,8 @@ private fun createMessage(
action: String = "action",
styleData: StyleData = StyleData(),
triggers: List<String> = listOf("triggers"),
) = Message(messageId, data, action, styleData, triggers, metadata)
except: List<String> = listOf(),
) = Message(messageId, data, action, styleData, triggers, except, metadata)
private fun createMetadata(
displayCount: Int = 0,

@ -52,7 +52,7 @@ class MessagingReducerTest {
data = MessageData(surface = surface),
action = action,
style = StyleData(),
triggers = listOf(),
triggerIfAll = listOf(),
metadata = Message.Metadata(id = id),
)

Loading…
Cancel
Save