RichButton

Package: com.salesforce.marketingcloud.pushmodels.rich.buttons

Module: Push Models Module v1.0.2

Hierarchy: RichButtonTemplate > RichButton

Overview 

1data class RichButton(
2    val identifier: String,
3    val title: Text? = null,
4    val icon: String? = null,
5    val style: Style? = null,
6    val actions: List<Action>? = listOf(Action.OpenApp)
7) : Parcelable, PushView

A data class representing a rich button component in the Salesforce Marketing Cloud Unified SDK. This class implements Parcelable for Android serialization and PushView for view representation.

Constructors 

RichButton 

1constructor(
2    identifier: String,
3    title: Text? = null,
4    icon: String? = null,
5    style: Style? = null,
6    actions: List<Action>? = listOf(Action.OpenApp)
7)

Creates a new RichButton instance with the specified parameters.

Properties 

identifier 

1val identifier: String

Unique identifier for the button.

title 

1val title: Text?

Optional text content for the button.

icon 

1val icon: String?

Optional icon resource identifier.

style 

1open override val style: Style?

Optional styling configuration (overrides PushView).

actions 

1open override val actions: List<Action>?

List of actions to execute when the button is pressed. Defaults to listOf(Action.OpenApp) (overrides PushView).

Methods 

toJson 

1fun toJson(): JSONObject

Converts the RichButton instance to a JSON object representation.

Returns: JSONObject containing the serialized button data.

toString 

1open override fun toString(): String

Returns a string representation of the RichButton instance.

Returns: String representation of the object.