Interface Conversation
-
- All Superinterfaces:
ConversationDetails
public interface Conversation extends ConversationDetails
The Conversation provides an interface to interact with a user's conversation.To obtain the current conversation use
AvMessagingSdk.getConversation()
, orAvMessagingSdk.getConversationById(String, AvMessagingSdkCallback)
to obtain other conversations that are not active.AvMessagingSdk.init(Application, Settings, AvMessagingSdkCallback)
must have been called prior to retrieving any conversation object.To send a message, use
sendMessage(Message)
with aMessage
object. Example:AvMessagingSdk.getConversation().sendMessage(new Message("Hello World!"));
A conversation must be made active with
AvMessagingSdk.loadConversation(String, AvMessagingSdkCallback)
before executing any actions on it.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addMessage(Message message)
Adds a new message to the conversation without sending it.void
avMessagingSdkHidden()
Notifies the delegate when AvMessagingSdk Conversation is hiddenvoid
avMessagingSdkShown()
Notifies the delegate when AvMessagingSdk Conversation is shownboolean
isAvMessagingSdkShown()
Returnstrue
if the AvMessagingSdk UI is currently shownvoid
loadCardSummary()
Loads billing info (if exists) to display last4 in credit form.void
markAllAsRead()
Marks all unread messages as read.void
postback(MessageAction action, AvMessagingSdkCallback<java.lang.Void> callback)
Triggers MessageAction postback.void
processPayment(CreditCard creditCard, MessageAction action)
Processes a credit card payment.void
removeMessage(Message message)
Removes a failed or unsent message from the conversation.Message
retryMessage(Message message)
Retries a message that failed to send.void
sendMessage(Message message)
Adds a new message to the conversation.void
startTyping()
Notify the server that the user is typing.void
stopTyping()
Notify the server that the user has finished typing.void
triggerAction(MessageAction action)
Triggers message action resulting from a click.void
uploadFile(Message fileMessage, AvMessagingSdkCallback<Message> callback)
Uploads a user file to the conversation.void
uploadImage(Message imageMessage, AvMessagingSdkCallback<Message> callback)
Uploads a user image to the conversation.-
Methods inherited from interface com.avaya.core.ConversationDetails
getBusinessLastRead, getDescription, getDisplayName, getIconUrl, getId, getLastRead, getLastUpdatedAt, getMessages, getMetadata, getParticipants, getUnreadCount
-
-
-
-
Method Detail
-
markAllAsRead
void markAllAsRead()
Marks all unread messages as read.Marks all unread messages as read, and notifies that the unread count changed.
-
sendMessage
void sendMessage(Message message)
Adds a new message to the conversation.For each message added using sendMessage, a notification will be fired indicating the success or failure status of the upload.
A conversation will be started automatically if this is the very first message and a conversation hasn't been started yet.
- Parameters:
message
- The message to send
-
retryMessage
Message retryMessage(Message message)
Retries a message that failed to send.The failed message will be removed from the message list, and a new message will be constructed with the same text as the failed message. A notification will be fired indicating the success or failure status of the upload.
- Parameters:
message
- The failed message- Returns:
- The sent message, or null if the message could not be sent
-
addMessage
void addMessage(Message message)
Adds a new message to the conversation without sending it.- Parameters:
message
- The message to add
-
removeMessage
void removeMessage(Message message)
Removes a failed or unsent message from the conversation.- Parameters:
message
- The message to remove
-
uploadImage
void uploadImage(Message imageMessage, AvMessagingSdkCallback<Message> callback)
Uploads a user image to the conversation.For each image upload, provided
AvMessagingSdkCallback
will be called with status code, error and the resulting message- Parameters:
imageMessage
- The imageMessage to uploadcallback
- The callback, to be called withAvMessagingSdkCallback.Response
getData() of typeMessage
, null in case of error- See Also:
Message
,AvMessagingSdkCallback
-
uploadFile
void uploadFile(Message fileMessage, AvMessagingSdkCallback<Message> callback)
Uploads a user file to the conversation.For each file upload, provided
AvMessagingSdkCallback
will be called with status code, error and the resulting message- Parameters:
fileMessage
- The fileMessage to uploadcallback
- The callback, to be called withAvMessagingSdkCallback.Response
getData() of typeMessage
, null in case of error- See Also:
Message
,AvMessagingSdkCallback
-
startTyping
void startTyping()
Notify the server that the user is typing. This method is called automatically when using the default ConversationFragment. Only call this method if your application implements its own conversation view.Typing updates are automatically throttled, so you may call this method as often as necessary. The typing stop event will automatically fire 10 seconds after the most recent call to this method.
- See Also:
stopTyping()
-
stopTyping
void stopTyping()
Notify the server that the user has finished typing. This method is called automatically when using the default ConversationFragment. Only call this method if your application implements its own conversation view.If the user was not flagged as typing recently, this method will result in a no-op.
- See Also:
startTyping()
-
processPayment
void processPayment(CreditCard creditCard, MessageAction action)
Processes a credit card payment.- Parameters:
creditCard
- The credit card objectaction
- The message action- See Also:
CreditCard
,MessageAction
-
triggerAction
void triggerAction(MessageAction action)
Triggers message action resulting from a click.- Parameters:
action
- The message action- See Also:
MessageAction
-
loadCardSummary
void loadCardSummary()
Loads billing info (if exists) to display last4 in credit form.
-
postback
void postback(MessageAction action, AvMessagingSdkCallback<java.lang.Void> callback)
Triggers MessageAction postback.- See Also:
MessageAction
,AvMessagingSdkCallback
-
avMessagingSdkShown
void avMessagingSdkShown()
Notifies the delegate when AvMessagingSdk Conversation is shownUsed by the avMessagingSdk-ui package to notify the Conversation.Delegate when AvMessagingSdk is shown
-
avMessagingSdkHidden
void avMessagingSdkHidden()
Notifies the delegate when AvMessagingSdk Conversation is hiddenUsed by the avMessagingSdk-ui package to notify the Conversation.Delegate when AvMessagingSdk is hidden
-
isAvMessagingSdkShown
boolean isAvMessagingSdkShown()
Returnstrue
if the AvMessagingSdk UI is currently shown- Returns:
true
if the AvMessagingSdk UI is currently shown,false
otherwise
-
-