use of com.fanap.podchat.requestobject.RequestEditMessage in project pod-chat-android-sdk by FanapSoft.
the class ChatPresenter method editMessage.
@Override
public void editMessage(int messageId, String messageNewContent, String metaData, ChatHandler handler) {
RequestEditMessage requestEditMessage = new RequestEditMessage.Builder(messageNewContent, messageId).metaData(metaData).build();
chat.editMessage(requestEditMessage, handler);
}
use of com.fanap.podchat.requestobject.RequestEditMessage in project pod-chat-android-sdk by FanapSoft.
the class ThreadCacheTest method sendMessageAndEdit.
public void sendMessageAndEdit() {
populateThreadsFromServer();
Collections.shuffle(threadsInServer);
Thread thread = threadsInServer.get(0);
Assert.assertNotNull(thread);
final long[] messageId = { 0 };
// send new message
chatListeners = new ChatListener() {
@Override
public void onNewMessage(String content, ChatResponse<ResultNewMessage> response) {
messageId[0] = response.getResult().getMessageVO().getId();
resumeProcess();
System.out.println("new message sent -> msg : " + content);
chat.removeListener(chatListeners);
}
@Override
public void onError(String content, ErrorOutPut error) {
resumeProcess();
System.out.println("Error: " + content);
Assert.assertEquals(0, 1);
chat.removeListener(chatListeners);
}
};
chat.addListener(chatListeners);
RequestMessage request = new RequestMessage.Builder("Message for test edit :" + thread.getId(), thread.getId()).messageType(TextMessageType.Constants.TEXT).build();
chat.sendTextMessage(request, null);
pauseProcess();
// delete last message
chatListeners = new ChatListener() {
@Override
public void onEditedMessage(String content, ChatResponse<ResultNewMessage> response) {
resumeProcess();
System.out.println("Edited: " + content);
chat.removeListener(chatListeners);
}
@Override
public void onError(String content, ErrorOutPut error) {
resumeProcess();
System.out.println("Error: " + content);
Assert.assertEquals(0, 1);
chat.removeListener(chatListeners);
}
};
chat.addListener(chatListeners);
RequestEditMessage requestEditMessage = new RequestEditMessage.Builder("last message edited " + messageId[0], messageId[0]).build();
chat.editMessage(requestEditMessage, null);
pauseProcess();
}
Aggregations