Search in sources :

Example 21 with AssistantVo

use of com.fanap.podchat.chat.assistant.model.AssistantVo in project pod-chat-android-sdk by FanapSoft.

the class ChatTestIntegration method deActiveAssistantTest.

@Test
@LargeTest
public void deActiveAssistantTest() {
    long startTime = System.currentTimeMillis();
    ChatListener historyListeners = new ChatListener() {

        @Override
        public void onDeActiveAssistant(ChatResponse<List<AssistantVo>> response) {
            System.out.println("onDeActiveAssistant: " + response);
            Assert.assertTrue(true);
            resumeProcess();
        }
    };
    chat.addListener(historyListeners);
    deActiveAssistant();
}
Also used : AssistantVo(com.fanap.podchat.chat.assistant.model.AssistantVo) ChatResponse(com.fanap.podchat.model.ChatResponse) 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)

Example 22 with AssistantVo

use of com.fanap.podchat.chat.assistant.model.AssistantVo in project pod-chat-android-sdk by FanapSoft.

the class ChatTestIntegration method registerAssistant.

private void registerAssistant() {
    // 63253 kheirkhah
    // 63254 sajadi
    // //63255 anvari
    // 63256 amjadi
    // 63257 zhiani
    // invite list
    // 52987   khodam
    // 103187  nemati
    Invitee invite = new Invitee("63253", InviteType.Constants.TO_BE_USER_CONTACT_ID);
    // roles
    ArrayList<String> typeRoles = new ArrayList<>();
    typeRoles.add(RoleType.Constants.READ_THREAD);
    typeRoles.add(RoleType.Constants.EDIT_THREAD);
    typeRoles.add(RoleType.Constants.ADD_ROLE_TO_USER);
    List<AssistantVo> assistantVos = new ArrayList<>();
    AssistantVo assistantVo = new AssistantVo();
    assistantVo.setInvitees(invite);
    assistantVo.setContactType("default");
    assistantVo.setRoles(typeRoles);
    assistantVos.add(assistantVo);
    RegisterAssistantRequest request = new RegisterAssistantRequest.Builder(assistantVos).build();
    presenter.registerAssistant(request);
    pauseProcess();
}
Also used : Invitee(com.fanap.podchat.mainmodel.Invitee) AssistantVo(com.fanap.podchat.chat.assistant.model.AssistantVo) ArrayList(java.util.ArrayList) RegisterAssistantRequest(com.fanap.podchat.chat.assistant.request_model.RegisterAssistantRequest)

Example 23 with AssistantVo

use of com.fanap.podchat.chat.assistant.model.AssistantVo in project pod-chat-android-sdk by FanapSoft.

the class ChatActivity method registerAssistant.

private void registerAssistant() {
    // 63263 kheirkhah
    // //63264 anvari
    // 63254 sajadi
    // 63256 amjadi
    // 63257 zhiani
    // invite list
    // 103187 nemati sandbox
    // 52987 sajadi 9063 sandbox
    Invitee invite = new Invitee("63256", InviteType.Constants.TO_BE_USER_CONTACT_ID);
    // roles
    ArrayList<String> typeRoles = new ArrayList<>();
    typeRoles.add(RoleType.Constants.REMOVE_ROLE_FROM_USER);
    List<AssistantVo> assistantVos = new ArrayList<>();
    AssistantVo assistantVo = new AssistantVo();
    assistantVo.setInvitees(invite);
    assistantVo.setContactType("default");
    assistantVo.setRoles(typeRoles);
    assistantVos.add(assistantVo);
    RegisterAssistantRequest request = new RegisterAssistantRequest.Builder(assistantVos).build();
    presenter.registerAssistant(request);
}
Also used : Invitee(com.fanap.podchat.mainmodel.Invitee) AssistantVo(com.fanap.podchat.chat.assistant.model.AssistantVo) ArrayList(java.util.ArrayList) RegisterAssistantRequest(com.fanap.podchat.chat.assistant.request_model.RegisterAssistantRequest)

Example 24 with AssistantVo

use of com.fanap.podchat.chat.assistant.model.AssistantVo in project pod-chat-android-sdk by FanapSoft.

the class MessageDatabaseHelper method getCacheAssistantVos.

public void getCacheAssistantVos(GetAssistantRequest request, FunctionalListener callback) throws RoomIntegrityException {
    if (!canUseDatabase())
        throw new RoomIntegrityException();
    worker(() -> {
        List<CacheAssistantVo> list = messageDao.getCacheAssistantVos(request.getCount() > 0 ? request.getCount() : 25, request.getOffset());
        List<AssistantVo> cachResponseList = new ArrayList<>();
        for (CacheAssistantVo item : list) {
            AssistantVo assistantVo = new AssistantVo();
            assistantVo.setRoles((ArrayList<String>) item.getRoles());
            assistantVo.setBlock(item.isBlock());
            assistantVo.setContactType(item.getContactType());
            Participant participant = cacheToParticipantMapper(messageDao.getParticipant(item.getParticipantVOId()), false, null);
            ChatProfileVO profileVO = messageDao.getChatProfileVOById(participant.getId());
            participant.setChatProfileVO(profileVO);
            assistantVo.setParticipantVO(participant);
            cachResponseList.add(assistantVo);
        }
        callback.onWorkDone(list.size(), cachResponseList);
    });
}
Also used : ChatProfileVO(com.fanap.podchat.chat.user.profile.ChatProfileVO) CacheThreadParticipant(com.fanap.podchat.cachemodel.CacheThreadParticipant) CacheParticipant(com.fanap.podchat.cachemodel.CacheParticipant) Participant(com.fanap.podchat.mainmodel.Participant) CacheCallParticipant(com.fanap.podchat.call.persist.CacheCallParticipant) AssistantVo(com.fanap.podchat.chat.assistant.model.AssistantVo) CacheAssistantVo(com.fanap.podchat.cachemodel.CacheAssistantVo) ArrayList(java.util.ArrayList) CacheAssistantVo(com.fanap.podchat.cachemodel.CacheAssistantVo)

Example 25 with AssistantVo

use of com.fanap.podchat.chat.assistant.model.AssistantVo in project pod-chat-android-sdk by FanapSoft.

the class MessageDatabaseHelper method getCacheBlockedAssistantVos.

public void getCacheBlockedAssistantVos(GetBlockedAssistantsRequest request, FunctionalListener callback) throws RoomIntegrityException {
    if (!canUseDatabase())
        throw new RoomIntegrityException();
    worker(() -> {
        List<CacheAssistantVo> list = messageDao.getCacheBlockedAssistantVos(request.getCount() > 0 ? request.getCount() : 25, request.getOffset());
        List<AssistantVo> cacheResponseList = new ArrayList<>();
        for (CacheAssistantVo item : list) {
            AssistantVo assistantVo = new AssistantVo();
            assistantVo.setRoles((ArrayList<String>) item.getRoles());
            assistantVo.setBlock(item.isBlock());
            assistantVo.setContactType(item.getContactType());
            Participant participant = cacheToParticipantMapper(messageDao.getParticipant(item.getParticipantVOId()), false, null);
            ChatProfileVO profileVO = messageDao.getChatProfileVOById(participant.getId());
            participant.setChatProfileVO(profileVO);
            assistantVo.setParticipantVO(participant);
            cacheResponseList.add(assistantVo);
        }
        callback.onWorkDone(list.size(), cacheResponseList);
    });
}
Also used : ChatProfileVO(com.fanap.podchat.chat.user.profile.ChatProfileVO) CacheThreadParticipant(com.fanap.podchat.cachemodel.CacheThreadParticipant) CacheParticipant(com.fanap.podchat.cachemodel.CacheParticipant) Participant(com.fanap.podchat.mainmodel.Participant) CacheCallParticipant(com.fanap.podchat.call.persist.CacheCallParticipant) AssistantVo(com.fanap.podchat.chat.assistant.model.AssistantVo) CacheAssistantVo(com.fanap.podchat.cachemodel.CacheAssistantVo) ArrayList(java.util.ArrayList) CacheAssistantVo(com.fanap.podchat.cachemodel.CacheAssistantVo)

Aggregations

AssistantVo (com.fanap.podchat.chat.assistant.model.AssistantVo)25 ArrayList (java.util.ArrayList)19 LargeTest (android.support.test.filters.LargeTest)15 ChatListener (com.fanap.podchat.chat.ChatListener)15 Test (org.junit.Test)15 Invitee (com.fanap.podchat.mainmodel.Invitee)13 ChatResponse (com.fanap.podchat.model.ChatResponse)10 List (java.util.List)9 RegisterAssistantRequest (com.fanap.podchat.chat.assistant.request_model.RegisterAssistantRequest)8 GetAssistantRequest (com.fanap.podchat.chat.assistant.request_model.GetAssistantRequest)7 FlakyTest (android.support.test.filters.FlakyTest)6 MediumTest (android.support.test.filters.MediumTest)6 BlockUnblockAssistantRequest (com.fanap.podchat.chat.assistant.request_model.BlockUnblockAssistantRequest)5 GetAssistantHistoryRequest (com.fanap.podchat.chat.assistant.request_model.GetAssistantHistoryRequest)5 Contact (com.fanap.podchat.mainmodel.Contact)5 Participant (com.fanap.podchat.mainmodel.Participant)5 ResultContact (com.fanap.podchat.model.ResultContact)5 AssistantHistoryVo (com.fanap.podchat.chat.assistant.model.AssistantHistoryVo)4 GetBlockedAssistantsRequest (com.fanap.podchat.chat.assistant.request_model.GetBlockedAssistantsRequest)4 RequestGetContact (com.fanap.podchat.requestobject.RequestGetContact)4