Search in sources :

Example 6 with Invitee

use of com.fanap.podchat.mainmodel.Invitee in project pod-chat-android-sdk by FanapSoft.

the class ChatActivity method deactiveAssistant.

private void deactiveAssistant() {
    // invite
    // Invitee invite = new Invitee("52987", InviteType.Constants.TO_BE_USER_CONTACT_ID);
    Invitee invite = new Invitee("63256", InviteType.Constants.TO_BE_USER_CONTACT_ID);
    List<AssistantVo> assistantVos = new ArrayList<>();
    AssistantVo assistantVo = new AssistantVo();
    assistantVo.setInvitees(invite);
    assistantVos.add(assistantVo);
    DeActiveAssistantRequest request = new DeActiveAssistantRequest.Builder(assistantVos).build();
    presenter.deActiveAssistant(request);
}
Also used : Invitee(com.fanap.podchat.mainmodel.Invitee) AssistantVo(com.fanap.podchat.chat.assistant.model.AssistantVo) ArrayList(java.util.ArrayList) DeActiveAssistantRequest(com.fanap.podchat.chat.assistant.request_model.DeActiveAssistantRequest)

Example 7 with Invitee

use of com.fanap.podchat.mainmodel.Invitee in project pod-chat-android-sdk by FanapSoft.

the class ChatActivity method createThreadWithFile.

private void createThreadWithFile() {
    if (getUri() == null) {
        Toast.makeText(this, "Pick a file", Toast.LENGTH_SHORT).show();
        return;
    }
    RequestUploadImage requestUploadThreadImageImage = new RequestUploadImage.Builder(this, getUri()).setwC(140).sethC(140).build();
    RequestUploadImage requestUploadImage = new RequestUploadImage.Builder(this, getUri()).setwC(120).sethC(120).setxC(1).setyC(1).build();
    RequestUploadFile requestUploadFile = new RequestUploadFile.Builder(this, getUri()).build();
    List<Invitee> invite = new ArrayList<>();
    // f.kh sandbox
    // invite.add(new Invitee("4893", InviteType.Constants.TO_BE_USER_CONTACT_ID));
    // POURIA main
    invite.add(new Invitee(1151568, InviteType.Constants.TO_BE_USER_CONTACT_ID));
    // MASOUD
    // invite.add(new Invitee(1511971, InviteType.Constants.TO_BE_USER_CONTACT_ID));
    // ARVIN
    invite.add(new Invitee(1512305, InviteType.Constants.TO_BE_USER_CONTACT_ID));
    // MAHYAR
    // invite.add(new Invitee(1196793, InviteType.Constants.TO_BE_USER_CONTACT_ID));
    // RequestThreadInnerMessage innerMessage = new RequestThreadInnerMessage
    // .Builder(TextMessageType.Constants.PICTURE)
    // //       .message("Create thread for File Message Test " + new Date().toString())
    // //     .forwardedMessageIds(listForwardIds)
    // .build();
    RequestCreateThreadWithFile request = new RequestCreateThreadWithFile.Builder(ThreadType.Constants.OWNER_GROUP, invite, requestUploadFile, TextMessageType.Constants.POD_SPACE_FILE).title("Test File PodSpace").setUploadThreadImageRequest(requestUploadThreadImageImage).build();
    presenter.createThreadWithFile(request, new ProgressHandler.sendFileMessage() {

        @Override
        public void onProgressUpdate(String uniqueId, int progress, int totalBytesSent, int totalBytesToSend) {
            Log.e("CTF", "Upload Progress: " + progress);
        }

        @Override
        public void onFinishImage(String json, ChatResponse<ResultImageFile> chatResponse) {
            Log.e("CTF", "Upload Finish (IMAGE): ");
        }

        @Override
        public void onFinishFile(String json, ChatResponse<ResultFile> chatResponse) {
            Log.e("CTF", "Upload Finish (FILE): ");
        }

        @Override
        public void onError(String jsonError, ErrorOutPut error) {
            Log.e("CTF", "Upload Error");
        }
    });
}
Also used : RequestUploadImage(com.fanap.podchat.requestobject.RequestUploadImage) ProgressHandler(com.fanap.podchat.ProgressHandler) ArrayList(java.util.ArrayList) ResultFile(com.fanap.podchat.model.ResultFile) Invitee(com.fanap.podchat.mainmodel.Invitee) ResultImageFile(com.fanap.podchat.model.ResultImageFile) RequestUploadFile(com.fanap.podchat.requestobject.RequestUploadFile) ErrorOutPut(com.fanap.podchat.model.ErrorOutPut) RequestCreateThreadWithFile(com.fanap.podchat.requestobject.RequestCreateThreadWithFile)

Example 8 with Invitee

use of com.fanap.podchat.mainmodel.Invitee in project pod-chat-android-sdk by FanapSoft.

the class ChatActivity method removeParticipants.

private void removeParticipants() {
    List<Invitee> inviteeList = new ArrayList<>();
    List<Long> participantIds = new ArrayList<>();
    participantIds.add(18476L);
    // participantIds.add(5581L);
    // participantIds.add(1261L);
    // SET INVITEE LIST
    Invitee invite = new Invitee("30150", InviteType.Constants.TO_BE_CORE_USER_ID);
    Invitee invite2 = new Invitee("43593", InviteType.Constants.TO_BE_CORE_USER_ID);
    // Invitee invite2 = new Invitee("5736", InviteType.Constants.TO_BE_CORE_USER_ID);
    inviteeList.add(invite);
    // inviteeList.add(invite2);
    long threadId = TEST_THREAD_ID;
    RemoveParticipantRequest request = new RemoveParticipantRequest.Builder(threadId, null).setInvitees(inviteeList).build();
    presenter.removeParticipants(request, null);
}
Also used : Invitee(com.fanap.podchat.mainmodel.Invitee) RemoveParticipantRequest(com.fanap.podchat.requestobject.RemoveParticipantRequest) GsonBuilder(com.google.gson.GsonBuilder) ArrayList(java.util.ArrayList)

Example 9 with Invitee

use of com.fanap.podchat.mainmodel.Invitee in project pod-chat-android-sdk by FanapSoft.

the class ChatActivity method unBlockAssistant.

public void unBlockAssistant() {
    Invitee invite = new Invitee("63256", InviteType.Constants.TO_BE_USER_CONTACT_ID);
    List<AssistantVo> assistantVos = new ArrayList<>();
    AssistantVo assistantVo = new AssistantVo();
    assistantVo.setInvitees(invite);
    assistantVos.add(assistantVo);
    BlockUnblockAssistantRequest request = new BlockUnblockAssistantRequest.Builder(assistantVos, true).build();
    presenter.unBlockAssistant(request);
}
Also used : Invitee(com.fanap.podchat.mainmodel.Invitee) AssistantVo(com.fanap.podchat.chat.assistant.model.AssistantVo) ArrayList(java.util.ArrayList) BlockUnblockAssistantRequest(com.fanap.podchat.chat.assistant.request_model.BlockUnblockAssistantRequest)

Example 10 with Invitee

use of com.fanap.podchat.mainmodel.Invitee in project pod-chat-android-sdk by FanapSoft.

the class CallAsyncRequestsManager method createAddCallParticipantMessage.

public static String createAddCallParticipantMessage(RequestAddParticipants request, String uniqueId) {
    JsonArray participantsJsonArray = new JsonArray();
    if (request.getContactIds() != null) {
        for (Long p : request.getContactIds()) {
            participantsJsonArray.add(p);
        }
    } else if (request.getUserNames() != null) {
        for (String username : request.getUserNames()) {
            Invitee invitee = new Invitee();
            invitee.setId(username);
            invitee.setIdType(InviteType.Constants.TO_BE_USER_USERNAME);
            JsonElement jsonElement = App.getGson().toJsonTree(invitee);
            participantsJsonArray.add(jsonElement);
        }
    } else {
        for (Long coreUserId : request.getCoreUserIds()) {
            Invitee invitee = new Invitee();
            invitee.setId(coreUserId);
            invitee.setIdType(InviteType.Constants.TO_BE_USER_ID);
            JsonElement jsonElement = App.getGson().toJsonTree(invitee);
            participantsJsonArray.add(jsonElement);
        }
    }
    AsyncMessage chatMessage = new AsyncMessage();
    chatMessage.setTokenIssuer("1");
    chatMessage.setToken(CoreConfig.token);
    chatMessage.setContent(participantsJsonArray.toString());
    chatMessage.setSubjectId(request.getThreadId());
    chatMessage.setUniqueId(uniqueId);
    chatMessage.setType(ChatMessageType.Constants.ADD_CALL_PARTICIPANT);
    chatMessage.setTypeCode(Util.isNullOrEmpty(request.getTypeCode()) ? CoreConfig.typeCode : request.getTypeCode());
    JsonObject messageObj = (JsonObject) App.getGson().toJsonTree(chatMessage);
    return messageObj.toString();
}
Also used : JsonArray(com.google.gson.JsonArray) Invitee(com.fanap.podchat.mainmodel.Invitee) JsonElement(com.google.gson.JsonElement) AsyncMessage(com.fanap.podchat.mainmodel.AsyncMessage) JsonObject(com.google.gson.JsonObject)

Aggregations

Invitee (com.fanap.podchat.mainmodel.Invitee)32 ArrayList (java.util.ArrayList)25 AssistantVo (com.fanap.podchat.chat.assistant.model.AssistantVo)13 Test (org.junit.Test)9 LargeTest (android.support.test.filters.LargeTest)8 RegisterAssistantRequest (com.fanap.podchat.chat.assistant.request_model.RegisterAssistantRequest)8 Contact (com.fanap.podchat.mainmodel.Contact)8 AcceptCallRequest (com.fanap.podchat.call.request_model.AcceptCallRequest)6 CallRequest (com.fanap.podchat.call.request_model.CallRequest)6 EndCallRequest (com.fanap.podchat.call.request_model.EndCallRequest)6 RejectCallRequest (com.fanap.podchat.call.request_model.RejectCallRequest)6 TerminateCallRequest (com.fanap.podchat.call.request_model.TerminateCallRequest)6 Date (java.util.Date)6 SuppressLint (android.annotation.SuppressLint)5 ChatListener (com.fanap.podchat.chat.ChatListener)5 BlockUnblockAssistantRequest (com.fanap.podchat.chat.assistant.request_model.BlockUnblockAssistantRequest)5 GsonBuilder (com.google.gson.GsonBuilder)5 ResultContact (com.fanap.podchat.model.ResultContact)4 RequestGetContact (com.fanap.podchat.requestobject.RequestGetContact)4 List (java.util.List)4