Search in sources :

Example 11 with RequestMessage

use of com.fanap.podchat.requestobject.RequestMessage in project pod-chat-android-sdk by FanapSoft.

the class CallPresenter method rejectIncomingCallWithMessage.

@Override
public void rejectIncomingCallWithMessage(String msg) {
    RejectCallRequest request = new RejectCallRequest.Builder(callVO.getCallId()).build();
    String uniqueId = chat.rejectVoiceCall(request);
    callUniqueIds.add(uniqueId);
    RequestMessage requestRejectMessage = new RequestMessage.Builder("الان نمی‌تونم جواب بدم", callVO.getConversationVO().getId()).messageType(TextMessageType.Constants.TEXT).jsonMetaData(new GsonBuilder().create().toJson("{\"callRejectWithMessage\":true}")).build();
    callUniqueIds.add(chat.sendTextMessage(requestRejectMessage, null));
    getActiveCalls();
}
Also used : GsonBuilder(com.google.gson.GsonBuilder) RequestMessage(com.fanap.podchat.requestobject.RequestMessage) RejectCallRequest(com.fanap.podchat.call.request_model.RejectCallRequest)

Example 12 with RequestMessage

use of com.fanap.podchat.requestobject.RequestMessage in project pod-chat-android-sdk by FanapSoft.

the class CallPresenter method onDeviceGotFar.

@Override
public void onDeviceGotFar() {
    RequestMessage requestRejectMessage = new RequestMessage.Builder("گوشی رو از گوشم دور کردم", callVO.getConversationVO().getId()).messageType(TextMessageType.Constants.TEXT).jsonMetaData(new GsonBuilder().create().toJson("{\"callRejectWithMessage\":true}")).build();
    callUniqueIds.add(chat.sendTextMessage(requestRejectMessage, null));
}
Also used : GsonBuilder(com.google.gson.GsonBuilder) RequestMessage(com.fanap.podchat.requestobject.RequestMessage)

Example 13 with RequestMessage

use of com.fanap.podchat.requestobject.RequestMessage in project pod-chat-android-sdk by FanapSoft.

the class CallPresenter method onDeviceIsNear.

@Override
public void onDeviceIsNear() {
    RequestMessage requestRejectMessage = new RequestMessage.Builder("گوشی رو گرفتم نزدیک گوشم", callVO.getConversationVO().getId()).messageType(TextMessageType.Constants.TEXT).jsonMetaData(new GsonBuilder().create().toJson("{\"callRejectWithMessage\":true}")).build();
    callUniqueIds.add(chat.sendTextMessage(requestRejectMessage, null));
    if (isCameraOn) {
        turnOffCamera();
    }
}
Also used : GsonBuilder(com.google.gson.GsonBuilder) RequestMessage(com.fanap.podchat.requestobject.RequestMessage)

Example 14 with RequestMessage

use of com.fanap.podchat.requestobject.RequestMessage in project pod-chat-android-sdk by FanapSoft.

the class ChatTest method sendALotOfMessageToThread.

@Test
@LargeTest
public void sendALotOfMessageToThread() {
    populateThreadsListFromServerOnly();
    long threadID = threads.get(0).getId();
    for (Thread thread : new ArrayList<>(threads)) {
        if (!thread.isClosed() && thread.getParticipantCount() > 1) {
            threadID = thread.getId();
        }
    }
    if (threadID > 0) {
        int counter = 0;
        int count = 5;
        while (counter < count) {
            RequestMessage requestMessage = new RequestMessage.Builder("This is test " + new Date().getTime(), threadID).messageType(TextMessageType.Constants.TEXT).jsonMetaData("From android instrumental test at " + new Date().getTime()).build();
            presenter.sendTextMessage(requestMessage, null);
            counter++;
        }
        sleep(7000);
        Mockito.verify(view, Mockito.atLeastOnce()).onSentMessage();
    } else {
        Assert.fail("no suitable thread found");
    }
}
Also used : RequestMessage(com.fanap.podchat.requestobject.RequestMessage) ArrayList(java.util.ArrayList) Date(java.util.Date) Thread(com.fanap.podchat.mainmodel.Thread) RequestThread(com.fanap.podchat.requestobject.RequestThread) FlakyTest(android.support.test.filters.FlakyTest) MediumTest(android.support.test.filters.MediumTest) Test(org.junit.Test) LargeTest(android.support.test.filters.LargeTest) LargeTest(android.support.test.filters.LargeTest)

Example 15 with RequestMessage

use of com.fanap.podchat.requestobject.RequestMessage in project pod-chat-android-sdk by FanapSoft.

the class ChatTestSandbox method setHashTagTest.

@Test
@LargeTest
public void setHashTagTest() {
    ChatListener historyListeners = new ChatListener() {

        @Override
        public void onGetHistory(String content, ChatResponse<ResultHistory> history) {
            System.out.println("onGetHistory: ");
            Logger.json(history.getJson());
            Assert.assertTrue(true);
            resumeProcess();
        }

        @Override
        public void onSent(String content, ChatResponse<ResultMessage> response) {
            System.out.println("onSent: ");
            Logger.json(response.getJson());
            Assert.assertTrue(true);
            resumeProcess();
        }
    };
    chat.addListener(historyListeners);
    RequestMessage requestMessage = new RequestMessage.Builder("#android fragment", 8085).build();
    presenter.sendTextMessage(requestMessage, null);
    pauseProcess();
}
Also used : ChatResponse(com.fanap.podchat.model.ChatResponse) RequestMessage(com.fanap.podchat.requestobject.RequestMessage) ChatListener(com.fanap.podchat.chat.ChatListener) FlakyTest(android.support.test.filters.FlakyTest) MediumTest(android.support.test.filters.MediumTest) Test(org.junit.Test) LargeTest(android.support.test.filters.LargeTest) LargeTest(android.support.test.filters.LargeTest)

Aggregations

RequestMessage (com.fanap.podchat.requestobject.RequestMessage)32 ChatListener (com.fanap.podchat.chat.ChatListener)27 Thread (com.fanap.podchat.mainmodel.Thread)25 RequestThread (com.fanap.podchat.requestobject.RequestThread)25 Test (org.junit.Test)24 Date (java.util.Date)22 LargeTest (android.support.test.filters.LargeTest)15 ResultHistory (com.fanap.podchat.model.ResultHistory)14 SearchSystemMetadataRequest (com.fanap.podchat.chat.messge.SearchSystemMetadataRequest)10 NosqlSearchMetadataCriteria (com.fanap.podchat.mainmodel.NosqlSearchMetadataCriteria)10 ResultNewMessage (com.fanap.podchat.model.ResultNewMessage)10 ArrayList (java.util.ArrayList)8 ErrorOutPut (com.fanap.podchat.model.ErrorOutPut)5 MessageVO (com.fanap.podchat.mainmodel.MessageVO)4 ChatResponse (com.fanap.podchat.model.ChatResponse)4 RequestGetHistory (com.fanap.podchat.requestobject.RequestGetHistory)4 GsonBuilder (com.google.gson.GsonBuilder)4 Random (java.util.Random)4 FlakyTest (android.support.test.filters.FlakyTest)3 MediumTest (android.support.test.filters.MediumTest)3