Skip to main content
Version: 4.60

chat

The chat layer creates a chat view.

Field Configurations

KeyTypeDescriptionDefault Value
"chatType"ChatTypeType of this chat."default"
"dateForeground"ColorColor of the displayed date."Depends on system."
"displayImages"BooleanFlag if displaying images is possible.true
"font"StringThe font for the messages."Depends on system."
"fontSize"UnitSizeThe font size of the messages"Depends on system."
"imageAdditionalHeaders"AdditionalHeadersHttp headers for a http request.null
"imageBaseUrl"StringThe base URL for images.null
"imageCruncher"ImageCruncherImageCruncher config to apply to images.null
"initialMessage"String(Android only) Message to display in the textfield used to type messages. Can be edited by the user.null
"inputBackground"ColorThe background color of the text input view."Depends on system."
"inputForeground"ColorThe foreground color of the text input view."Depends on system."
"linkProcessType"LinkProcessTypeIndicates how links in messages should be handled."none"
"messageComparisonMode"MessageComparisonModeHow the chat layer compares its messages to send with the actual messages of the chat."byContent"
"messageMode"MessageModeChat message mode."plain"
"myBackground"ColorThe background color of my chat bubbles."Depends on system."
"myForeground"ColorThe font color of my chat bubbles."Depends on system."
"nameForeground"ColorThe font color of the name which is displayed."Depends on system."
"namedMessageActions"ObjectActions a message can have on long press.null
"otherBackground"ColorThe background color of the chat partners bubbles."Depends on system."
"otherForeground"ColorThe font color of the chat partners bubbles."Depends on system."
"query"StringThe query of the table defined in table to use.null
"queryParams"ArrayQuery parameters to use for the query defined in query.null
"retryBodyText"StringThe body text of the retry.null
"retryConfirmationText"StringThe confirmation text of the retry.null
"retryDeclineText"StringThe decline text of the retry.null
"retryTitleText"StringThe title of the retry.null
"sendBackground"ColorThe background color of the send button."Depends on system."
"sendDisabledMessage"StringMessage shown in the send bar if send is disabled.null
"sendDisabledMessageBackgroundColor"ColorBackground color of the disabled send message."Depends on system."
"sendDisabledMessageFont"StringFont of the disabled send message."Depends on system."
"sendDisabledMessageFontColor"ColorFont color of the disabled send message."Depends on system."
"sendDisabledMessageFontSize"UnitSizeFont size of the disabled send message."Depends on system."
"sendEnabled"BooleanIndicates if the send button in enabled.true
"sendForeground"ColorThe font color of the send button."Depends on system."
"submitActions"ActionListActions fired after submitted.null
"systemMessage"StringText of the system messagenull
"systemMessageBackground"ColorBackground color for system messages."Depends on system."
"systemMessageForeground"ColorFont color for system messages."Depends on system."
"table"StringDatabase table to use.null
"uploadDesiredHeight"Numbernull
"uploadDesiredWidth"Numbernull
"uploadEvent"StringEvent to fire when media was picked.null
"uploadForm"StringThe form to use for file uploads.null
"uploadMaxDimension"Numberundefinednull
"uploadMode"UploadModeIndicates what kind of media can be uploaded."none"
"uploadTypes"UploadTypesList of upload modes, excluding none. Overrides uploadMode.null
"valueMap"ObjectThe value map to apply.null

Inherited

From Base Layer

Base Layer

Field Configurations

KeyTypeDescriptionDefault Value
"_value"Value[PREVIEW] Dynamic value of the layer.null
"accessibilityAppendState"StringDefines this layer appends its state to the accessibility text.null
"accessibilityText"StringText for accessibility navigation. Can be translated.null
"actions"ActionListList of actions, which will be executed when the layer is tapped.null
"borderColor"ColorThe color of the border in hex color value.null
"borderRadius"UnitSizeThe radius applies to all corners; with a borderWidth of 0 the border is not drawn and radius is set anyway.0
"borderWidth"UnitSizeThe width of the border.0
"bottomLeftRadius"UnitSizeRadius for the bottom left corner.0
"bottomRightRadius"UnitSizeRadius for the bottom right corner.0
"classes"ArrayList of classes for layer styles.null
"conditions"ConditionsList of conditions to alter the layer state.null
"constraints"ConstraintsA list of constraints defining the position of the layer in a layout.null
"consumesKeyboard"BooleanThis layer will be used to shrink, if a keyboard is shown.null
"dataKey"StringName for assigning data to this layer.null
"focusColor"ColorThe highlight color of this layer when it is focused. Mainly used on TV. If no color is provided, the pressedColor will be used.null
"hidden"BooleanIndicates whether the layer is hidden. Default: false.false
"isAccessibilityElement"StringDefines if this layer is important for accessibility navigation. The default depends on the layer type.null
"layerRotation"NumberThe layer is rotated by the specified degree.0
"name"StringUnique name in the layout. Used for alignment or actions.null
"opacity"NumberThe opacity of the layer.1
"overInsetBottom"BooleanDetermines if this layer ignores the save space at the bottom of the device.false
"overInsetTop"BooleanDetermines if this layer ignores the save space at the top of the device.false
"pressedColor"ColorThe highlight color of this layer when it is pressed. Mainly used on TV. If no color is provided, the focusColor will be used.null
"safeArea"SafeAreaTypeObjectDetermines the safe area behaviour.null
"shadowElevation"NumberThe elevation of this layer for casting shadows.0
"state"StringThe state the layer will use as default."default"
"states"LayerStatesA list of named states that affect the appearance of the layer.null
"topLeftRadius"UnitSizeRadius for the top left corner.0
"topRightRadius"UnitSizeRadius for the top right corner.0
"touchFeedback"TouchFeedbackDetermines if the layer should show a touch feedback if touched."visible"
"trackingKey"StringDefines a key for a scroll event.null
"type"LayerTypeThe type of the layernull
"value"Value(Initial) value of the layer.null

Examples

Example 1: Create a chat

To achieve this the following code can be used:

{
"type": "chat",
"name": "chat",
"table": "chat",
"query": "default",
"otherBackground": "#F3F3F3",
"otherForeground": "#202424",
"myBackground": "#96CAD9",
"myForeground": "#202424",
"inputBackground": "#F3F3F3",
"sendBackground": "#2F96B4",
"sendForeground": "#FFFFFF",
"nameForeground": "#2F96B4",
"font": "",
"valueMap": {
"message": "text",
"timeStamp": "timestamp",
"counterpart": "counterpart",
"type": "type",
"actions": "actions",
"mediaType": "mediaType"
},
"chatType": "group",
"displayImage": true,
"messageMode": "markdown",
"uploadTypes": [
"image",
"pdf"
],
"uploadEvent": "uploadChatFile",
"uploadForm": "chatForm",
"submitActions": [
{
"type": "request",
"params": {
"url": "randomUrl",
"method": "POST",
"contentType": "json",
"post": {
"content": "{[message]}"
},
"onSuccess": "messageSent",
"onError": "messageError"
}
}
],
"namedMessageActions": {
"delete": {
"label": "$lang(chatActionDelete)$",
"image": "internal://remove",
"event": "deleteMessage"
},
"change": {
"label": "$lang(chatActionChange)$",
"image": "internal://settings",
"event": "changeMessage"
},
"copy": {
"label": "$lang(chatActionCopy)$",
"image": "internal://copy",
"event": "copyMessage"
}
},
"classes": [
"fontSizeM",
"fullSize"
]
}

The example shows a chat layer with typical known chat functions.

Result:

Screenshot of the app showing the results of the sample code from Example 1.
A chat layer has been created.