Package io.smooch.core
Interface MessageModifierDelegate
-
public interface MessageModifierDelegate
Delegate for events related to sending and displaying of specific messages.Creating a delegate is optional, and can be used to implement callbacks when messages are sent or received. Setting this delegate can have large consequences on the way messages are displayed to the user. When setting
MessageModifierDelegate
, all delegate methods must be implemented as per their documentation.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Message
beforeDisplay(ConversationDetails conversationDetails, Message message)
Allows a delegate to modify the contents of a message before it's displayed in the conversation view.Message
beforeNotification(java.lang.String conversationId, Message message)
Allows a delegate to modify the contents of a message before it's displayed in a notification.Message
beforeSend(ConversationDetails conversationDetails, Message message)
Allows a delegate to modify the contents of a message before sending to Smooch servers.
-
-
-
Method Detail
-
beforeSend
Message beforeSend(ConversationDetails conversationDetails, Message message)
Allows a delegate to modify the contents of a message before sending to Smooch servers.You should always return a message here. Returning null will result in a
NullPointerException
.When the message type is
file
orimage
, only the messagemetadata
may be updated. Other message properties such astype
ortext
won't be considered.- Parameters:
conversationDetails
- details of the conversation containing the message being sent.message
- the message being sent.- Returns:
- the message, modified as required.
- See Also:
Message
-
beforeDisplay
Message beforeDisplay(ConversationDetails conversationDetails, Message message)
Allows a delegate to modify the contents of a message before it's displayed in the conversation view.- Parameters:
conversationDetails
- details of the conversation containing the message being displayed.message
- the message being displayed.- Returns:
- the message, modified as required or
null
to hide the message. - See Also:
Message
-
beforeNotification
Message beforeNotification(java.lang.String conversationId, Message message)
Allows a delegate to modify the contents of a message before it's displayed in a notification.- Parameters:
conversationId
- the ID of the conversation the notification belongs to.message
- the message being displayed in the notification.- Returns:
- the message, modified as required or
null
prevent the notification. - See Also:
Message
-
-