Description
Feature proposal
- Firebase Component: In-App Messaging
The InAppMessagingCardDisplay
has two action buttons, primaryActionButton
and secondaryActionButton
. We're trying to configure a new campaign that uses Cards with these two buttons. However, we have to set the behavior of the buttons at runtime. We cannot simply drop URLs into the Firebase Console because the actions are dependent on the current app state, i.e., the action would be related to the currently viewed content when the message was triggered. For example: if we wanted to recommend a related product to what the user is currently viewing, then we would need to insert the deep link to that recommended product into the message programatically at runtime- we couldn't do that in the Firebase Console, because there will be different recommended products depending on the currently displayed content.
We configured a new message campaign in the Firebase Console that has a Card with two buttons, both of which are set to dismissal behavior. At runtime, we're trying to use the InAppMessagingDisplayDelegate
function messageClicked(_:with:)
to determine which button was pressed. If and only if it was the primary button, then we will perform some action. The problem is that there is not currently a good way to determine which button was pressed. The only two properties on the InAppMessagingAction
class are actionText
and actionURL
. The former is subject to localization and shouldn't be used as an identifier, and the latter is always nil for the reason described in the previous paragraph. How are we supposed to ID which button was pressed so we can act accordingly?
My API proposal is to add a boolean property isPrimaryAction
to InAppMessagingAction
to be used to confidently determine how to respond in the messageClicked(_:with:)
delegate function.
Also, I'm getting some mixed impressions reading the docs. On one hand, it seems like there may be a way to create messages programatically at runtime where we can directly set the button URLs, but on the other hand there is no example code demonstrating this that I could find. This would be the ideal solution, even more so than the route we are trying to go with the delegate. Being able to set the URLs on the message at runtime before it is displayed would be best, but I'm having a hard time determining if this is possible.
Overall, perhaps because it is in Beta, the FIAM docs seem a bit lacking. At the moment FIAM seems to really only be setup for static campaigns, and less so for campaigns that are responsive to the application state. Please let me know if I'm missing something.