Any details to customize the In-App messaging? Can I show a customized popup with two buttons and the header title and subtitle for the popup using Firebase In-app messaging in ios?
Any sample or details on how to customize this?
Any details to customize the In-App messaging? Can I show a customized popup with two buttons and the header title and subtitle for the popup using Firebase In-app messaging in ios?
Any sample or details on how to customize this?
This is my code:
class MyInAppMessagingDelegate: NSObject, InAppMessagingDelegate {
func messageClicked(_ inAppMessage: InAppMessagingDisplayMessage, campaignInfo: InAppMessagingCampaignInfo?) {
// Check if the message is of type InAppMessagingModalDisplay
guard let modalDisplay = inAppMessage.displayInfo as? InAppMessagingModalDisplay else {
return
}
// Check the button ID to perform specific actions
if inAppMessage.triggerAction.actionButton?.buttonId == "updateButton" {
// Handle Update button click
// Add your custom logic here
} else if inAppMessage.triggerAction.actionButton?.buttonId == "cancelButton" {
// Handle Cancel button click
// Add your custom logic here
}
}
}
you can try this for two button (update and cancel)
To customize the display of In-App Messages in your app, you need to implement the FIRInAppMessagingDisplayDelegate protocol. This allows you to provide a custom display for your In-App Messages.
Here's an example of how you can customize the In-App Message display:
import FirebaseInAppMessaging
class CustomInAppMessagingDisplayDelegate: NSObject, FIRInAppMessagingDisplayDelegate {
func messageClicked(_ inAppMessage: FIRInAppMessagingDisplayMessage, with action: FIRInAppMessagingAction) {
// Handle the click action for the In-App message
}
func messageDismissed(_ inAppMessage: FIRInAppMessagingDisplayMessage, dismissType: FIRInAppMessagingDismissType) {
// Handle the dismiss action for the In-App message
}
func messageWillDisplay(_ inAppMessage: FIRInAppMessagingDisplayMessage) {
// Customize the display of the In-App message
// Access the message components
let title = inAppMessage.messageContent.title.text
let subtitle = inAppMessage.messageContent.body.text
let actionButton1 = inAppMessage.messageContent.actionButton?[0]
let actionButton2 = inAppMessage.messageContent.actionButton?[1]
// Create a custom popup with the message components
// Display the popup with the provided title, subtitle, and buttons
}
func impressionDetected(for inAppMessage: FIRInAppMessagingDisplayMessage) {
// Track impression events for the In-App message
}
}
// Register the custom display delegate
FIRInAppMessaging.inAppMessaging().delegate = CustomInAppMessagingDisplayDelegate()
I hope this can help you