Search in sources :

Example 1 with MessageRequest

use of drift.com.drift.model.MessageRequest in project drift-sdk-android by Driftt.

the class ConversationActivity method resendMessage.

void resendMessage(final Message message) {
    MessageRequest messageRequest = new MessageRequest(message.body, endUserId, null, this);
    sendMessageRequest(messageRequest, message);
}
Also used : MessageRequest(drift.com.drift.model.MessageRequest)

Example 2 with MessageRequest

use of drift.com.drift.model.MessageRequest in project drift-sdk-android by Driftt.

the class ConversationActivity method createConversation.

void createConversation() {
    final String textToSend = textEntryEditText.getText().toString();
    final MessageRequest messageRequest = new MessageRequest(textToSend, endUserId, null, this);
    final Message message = messageRequest.messageFromRequest(conversationId);
    progressBar.setVisibility(View.VISIBLE);
    MessageManager.getInstance().createConversation(textToSend, new APICallbackWrapper<Message>() {

        @Override
        public void onResponse(Message response) {
            progressBar.setVisibility(View.GONE);
            if (response != null) {
                conversationId = response.conversationId;
                conversationType = ConversationType.CONTINUE;
                message.sendStatus = Message.SendStatus.SENT;
                conversationAdapter.addMessage(recyclerView, message);
                updateForConversationType();
            } else {
                conversationAdapter.updateData(new ArrayList<Message>());
                textEntryEditText.setText(textToSend);
                Alert.showAlert(ConversationActivity.this, "Error", "Failed to create conversation", "Retry", new Runnable() {

                    @Override
                    public void run() {
                        didPressSendButton();
                    }
                });
            }
        }
    });
}
Also used : MessageRequest(drift.com.drift.model.MessageRequest) Message(drift.com.drift.model.Message) ArrayList(java.util.ArrayList)

Example 3 with MessageRequest

use of drift.com.drift.model.MessageRequest in project drift-sdk-android by Driftt.

the class ConversationActivity method sendMessage.

void sendMessage() {
    MessageRequest messageRequest = new MessageRequest(textEntryEditText.getText().toString(), endUserId, null, this);
    final Message message = messageRequest.messageFromRequest(conversationId);
    conversationAdapter.addMessage(recyclerView, message);
    sendMessageRequest(messageRequest, message);
}
Also used : MessageRequest(drift.com.drift.model.MessageRequest) Message(drift.com.drift.model.Message)

Aggregations

MessageRequest (drift.com.drift.model.MessageRequest)3 Message (drift.com.drift.model.Message)2 ArrayList (java.util.ArrayList)1