new ModalMessage(message, messageAlignment, extras, campaignId, cardId, triggerId, clickAction, uri, openTarget, dismissType, duration, icon, imageUrl, imageStyle, iconColor, iconBackgroundColor, backgroundColor, textColor, closeButtonColor, animateIn, animateOut, header, headerAlignment, headerTextColor, frameColor, buttons, cropType, htmlId, css)
Parameters:
Name | Type | Argument | Default | Description |
---|---|---|---|---|
message |
string | The message to display to the user. |
||
messageAlignment |
ab.InAppMessage.TextAlignment |
<optional> |
ab.InAppMessage.TextAlignment.CENTER | How to align message text. |
extras |
array |
<optional> |
[] | Array of string/string key/value pairs. |
campaignId |
string |
<optional> |
If the message comes with a campaign, this is the id of the campaign that the SDK will report back to Appboy with in-app message analytics events. |
|
cardId |
string |
<optional> |
If the message comes with a card, this is the id of the card that the SDK will report back to Appboy with in-app message analytics events. |
|
triggerId |
string |
<optional> |
The id of the trigger that created this message. The SDK will report back this to Appboy with in-app message analytics events. |
|
clickAction |
ab.InAppMessage.ClickAction |
<optional> |
ab.InAppMessage.ClickAction.NONE | Where the user should be brought when clicking on this message. |
uri |
string |
<optional> |
If |
|
openTarget |
ab.InAppMessage.OpenTarget |
<optional> |
ab.InAppMessage.OpenTarget.NONE | If |
dismissType |
ab.InAppMessage.DismissType |
<optional> |
ab.InAppMessage.DismissType.MANUAL | How the message is dismissed, via a timer or requiring interaction from the user. |
duration |
integer |
<optional> |
5000 | Length of time in milliseconds until auto-dismiss should occur. Only used when dismissType is ab.InAppMessage.DismissType.AUTO_DISMISS |
icon |
string |
<optional> |
A Font Awesome unicode string, e.g. "\uf042" to fa-adjust. See the Font Awesome cheatsheet for details. |
|
imageUrl |
string |
<optional> |
Url of an image to include in this message. The message will only display an image or an icon, and will prioritize the image if present. |
|
imageStyle |
ab.InAppMessage.ImageStyle |
<optional> |
ab.InAppMessage.ImageStyle.TOP | Whether the image should be shown as normal on the top of the in-app message or used as the entire content of the message. |
iconColor |
integer |
<optional> |
0xffffffff | Color of icon. Hex value with opacity (e.g. 0xff00ff00 is opaque green). |
iconBackgroundColor |
integer |
<optional> |
0xff0073d5 | Background color of icon. Hex value with opacity (e.g. 0xff00ff00 is opaque green). |
backgroundColor |
integer |
<optional> |
0xffffffff | Background color of entire message. Hex value with opacity (e.g. 0xff00ff00 is opaque green). |
textColor |
integer |
<optional> |
0xff333333 | Text color of message. Hex value with opacity (e.g. 0xff00ff00 is opaque green). |
closeButtonColor |
integer |
<optional> |
0xff9b9b9b | Color of close button. Hex value with opacity (e.g. 0xff00ff00 is opaque green). |
animateIn |
boolean |
<optional> |
true | Whether to animate the showing of this message. |
animateOut |
boolean |
<optional> |
true | Whether to animate the hiding of this message. |
header |
string |
<optional> |
Header text to display. |
|
headerAlignment |
ab.InAppMessage.TextAlignment |
<optional> |
ab.InAppMessage.TextAlignment.CENTER | How to align header text. |
headerTextColor |
integer |
<optional> |
0xff333333 | Color of header text. Hex value with opacity (e.g. 0xff00ff00 is opaque green). |
frameColor |
integer |
<optional> |
0xC0333333 | Color of the background frame which blocks page interaction while the message is showing. |
buttons |
array |
<optional> |
[] | Array of up to two ab.InAppMessage.Button objects. |
cropType |
ab.InAppMessage.CropType |
<optional> |
ab.InAppMessage.CropType.FIT_CENTER | How to crop and fit images in the allowable space. |
htmlId |
string |
<optional> |
The ID to give the parent HTML element that this message is rendered into. |
|
css |
string |
<optional> |
Custom CSS to apply to the page while this element is shown. All selectors should be scoped to the htmlId of this message to prevent restyling elements outside of the message when it is shown. |
Extends
Methods
-
closeMessage()
-
Call this method if you wish to dismiss this in-app message programmatically.
- Inherited From:
-
removeAllSubscriptions()
-
Remove all event subscriptions from this message.
- Inherited From:
-
removeSubscription(subscriptionGuid)
-
Remove an event subscription that you previously subscribed to.
Parameters:
Name Type Description subscriptionGuid
string The identifier of the subscription you wish to remove, returned by the method you initially used to create it.
- Inherited From:
-
subscribeToClickedEvent(subscriber) → {string}
-
Subscribe to receive click events. The subscriber callback will be called whenever this message is clicked by the user.
Parameters:
Name Type Description subscriber
function The callback function to receive click events. This function will be invoked with no arguments when this message records a click.
- Inherited From:
Returns:
The identifier of the subscription created. This can be passed to removeSubscription to cancel the subscription.
- Type
- string
-
subscribeToDismissedEvent(subscriber) → {string}
-
Subscribe to receive dismissed events. The subscriber callback will be called whenever this message is closed by the user, or when it's dismissed automatically (depending on the dismissType).
Parameters:
Name Type Description subscriber
function The callback function to receive dismissed events. This function will be invoked with no arguments when this message records a dismissal.
- Inherited From:
Returns:
The identifier of the subscription created. This can be passed to removeSubscription to cancel the subscription.
- Type
- string