use of com.fanap.podchat.requestobject.RequestDeleteMessage in project pod-chat-android-sdk by FanapSoft.
the class ChatPresenter method deleteMessage.
@Override
public void deleteMessage(ArrayList<Long> messageIds, long threadId, Boolean deleteForAll, ChatHandler handler) {
RequestDeleteMessage requestDeleteMessage = new RequestDeleteMessage.Builder().messageIds(messageIds).deleteForAll(deleteForAll).build();
String un = chat.deleteMessage(requestDeleteMessage, handler);
}
use of com.fanap.podchat.requestobject.RequestDeleteMessage in project pod-chat-android-sdk by FanapSoft.
the class ThreadCacheTest method sendMessageAndDelete.
public void sendMessageAndDelete() {
populateThreadsFromServer();
Collections.shuffle(threadsInServer);
Thread thread = threadsInServer.get(0);
Assert.assertNotNull(thread);
ArrayList<Long> msgIds = new ArrayList<>();
// send new message
chatListeners = new ChatListener() {
@Override
public void onNewMessage(String content, ChatResponse<ResultNewMessage> response) {
resumeProcess();
msgIds.add(response.getResult().getMessageVO().getId());
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 delete :" + thread.getId(), thread.getId()).messageType(TextMessageType.Constants.TEXT).build();
chat.sendTextMessage(request, null);
pauseProcess();
// delete last message
chatListeners = new ChatListener() {
@Override
public void onDeleteMessage(String content, ChatResponse<ResultDeleteMessage> response) {
resumeProcess();
System.out.println("Deleted: " + 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);
RequestDeleteMessage requestDeleteMessage = new RequestDeleteMessage.Builder().messageIds(msgIds).deleteForAll(true).build();
presenter.deleteMessage(requestDeleteMessage, null);
pauseProcess();
}
use of com.fanap.podchat.requestobject.RequestDeleteMessage in project pod-chat-android-sdk by FanapSoft.
the class ChatActivity method deleteMessage.
public void deleteMessage() {
ArrayList<Long> msgIds = new ArrayList<>();
msgIds.add((long) TEST_THREAD_ID);
// msgIds.add(47566L);
// msgIds.add(47564L);
RequestDeleteMessage requestDeleteMessage = new RequestDeleteMessage.Builder().messageIds(msgIds).deleteForAll(true).build();
presenter.deleteMessage(requestDeleteMessage, null);
// presenter.deleteMessage(16804, true, new ChatHandler() {
// @Override
// public void onDeleteMessage(String uniqueId) {
// super.onDeleteMessage(uniqueId);
// }
// });
}
Aggregations