Skip to main content

Message Reference

Global IM UIKit supports the message reference feature, allowing users to reply to each other's messages in the chat UI. The messages will appear in the message list component of the conversation page. By default, the message reference feature sends a message containing the referenced message content object ReferenceMessage (type identifier: RC:ReferenceMsg).

alt(width=250) alt(width=250)

Limitations

The message reference feature currently has the following limitations:

  • It only supports referencing text messages, file messages, and image messages.
  • The reference depth is limited to one level, meaning only the original message can be referenced. If multiple references are made, only the content of the last referenced message will be displayed.

Usage

The message reference feature is enabled by default in the Global IM UIKit conversation page. Users can long-press a message in the conversation page and select Reference Message from the pop-up menu to reference that message. After adding content to the input area, the SDK will automatically combine the input content with the referenced message into a ReferenceMessage and send it to the conversation.

Customizing the UI for Referenced Messages

The message reference feature, by default, sends a message containing the referenced message content (RC:ReferenceMsg), which is displayed in the message list using the ReferenceMessageItemProvider template.

All message display templates inherit from BaseMessageItemProvider<CustomMessage>. You can inherit BaseMessageItemProvider<CustomMessage> and implement your own reference message display template class, then provide this custom template to the SDK.

For example: You can copy the rc_item_reference_message.xml resource file provided by Global IM UIKit, create a /res/layout/rc_item_reference_message.xml file in your project, and modify the style values defined within it. Do not delete the default controls provided by the SDK, and do not arbitrarily change the View IDs.