Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,17 @@ internal class PreApprovalElementTypeAdapter : TypeAdapter<PreApprovalElement>()
}
PreApprovalElement.Type.ALERT -> {
val style = map["style"]?.parseEnumOrNull<PreApprovalElement.Style>()
PreApprovalElementAlert(id = id, style = style, icon = icon, text = text)
PreApprovalElementAlert(id = id, style = style, text = text)
}
PreApprovalElement.Type.BUTTON -> {
val action = map["action"]?.parseEnumOrNull<PreApprovalElementButton.ButtonAction>()
val actionSettings = map["actionSettings"]
val href = map["href"]
PreApprovalElementButton(id = id, action = action, actionSettings = actionSettings, href = href, icon = icon, text = text)
PreApprovalElementButton(id = id, action = action, actionSettings = actionSettings, href = href, text = text)
}
PreApprovalElement.Type.UNKNOWN -> {
// keep base instance for forward compatibility
PreApprovalElement(id = id, type = PreApprovalElement.Type.UNKNOWN, icon = icon, text = text)
PreApprovalElement(id = id, type = PreApprovalElement.Type.UNKNOWN, text = text)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ open class PreApprovalElement(
@SerializedName("type")
val type: Type,

/** Icon name (asset identifier). */
@SerializedName("icon")
val icon: String?,

/** Textual content. */
@SerializedName("text")
val text: String?
Expand Down Expand Up @@ -91,12 +87,9 @@ class PreApprovalElementButton(
@SerializedName("href")
val href: String? = null,

/** Icon name (asset identifier). */
icon: String? = null,

/** Textual content. */
text: String? = null
) : PreApprovalElement(id, Type.BUTTON, icon, text) {
) : PreApprovalElement(id, Type.BUTTON, text) {
enum class ButtonAction {

@SerializedName("LINK")
Expand All @@ -120,12 +113,9 @@ class PreApprovalElementAlert(
@SerializedName("style")
val style: PreApprovalElement.Style? = null,

/** Icon name (asset identifier). */
icon: String? = null,

/** Textual content. */
text: String? = null
) : PreApprovalElement(id, Type.ALERT, icon, text)
) : PreApprovalElement(id, Type.ALERT, text)

/** List item (one row with optional icon + text + optional style). */
class PreApprovalElementListItem(
Expand All @@ -138,8 +128,9 @@ class PreApprovalElementListItem(
val style: PreApprovalElement.Style? = null,

/** Icon name (asset identifier). */
icon: String? = null,
@SerializedName("icon")
val icon: String? = null,

/** Textual content. */
text: String? = null
) : PreApprovalElement(id, Type.LIST_ITEM, icon, text)
) : PreApprovalElement(id, Type.LIST_ITEM, text)
Loading