Search in sources :

Example 16 with Invitee

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

the class ChatActivity method blockAssistant.

public void blockAssistant() {
    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, false).build();
    presenter.blockAssistant(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 17 with Invitee

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

the class CallPresenter method requestP2PCallWithUserId.

@SuppressLint("MissingPermission")
@Override
public void requestP2PCallWithUserId(int userId, int callType) {
    List<Invitee> invitees = new ArrayList<>();
    Invitee invitee = new Invitee();
    invitee.setId(userId);
    invitee.setIdType(InviteType.Constants.TO_BE_USER_ID);
    invitees.add(invitee);
    // request with invitee list
    CallRequest callRequest = new CallRequest.Builder(invitees, callType).build();
    if (callRequest.getCallType() == CallType.Constants.VIDEO_CALL) {
        showVideoViews();
    } else {
        prepareAudioCallView();
    }
    String uniqueId = chat.requestCall(callRequest);
    callUniqueIds.add(uniqueId);
    callImpUniqueIds.add(uniqueId);
}
Also used : Invitee(com.fanap.podchat.mainmodel.Invitee) AcceptCallRequest(com.fanap.podchat.call.request_model.AcceptCallRequest) EndCallRequest(com.fanap.podchat.call.request_model.EndCallRequest) RejectCallRequest(com.fanap.podchat.call.request_model.RejectCallRequest) TerminateCallRequest(com.fanap.podchat.call.request_model.TerminateCallRequest) CallRequest(com.fanap.podchat.call.request_model.CallRequest) ArrayList(java.util.ArrayList) SuppressLint(android.annotation.SuppressLint)

Example 18 with Invitee

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

the class CallPresenter method requestP2PCallWithContactId.

@SuppressLint("MissingPermission")
@Override
public void requestP2PCallWithContactId(int contactId, int callType) {
    List<Invitee> invitees = new ArrayList<>();
    Invitee invitee = new Invitee();
    invitee.setId(contactId);
    invitee.setIdType(InviteType.Constants.TO_BE_USER_CONTACT_ID);
    invitees.add(invitee);
    // request with invitee list
    CallRequest callRequest = new CallRequest.Builder(invitees, callType).setTitle(GROUP_CALL_NAME_PREFIX + contactId).setDescription("Generated at " + new Date().toString()).build();
    if (callRequest.getCallType() == CallType.Constants.VIDEO_CALL) {
        showVideoViews();
    } else {
        prepareAudioCallView();
    }
    String uniqueId;
    uniqueId = requestCallByServerType(callRequest);
    callUniqueIds.add(uniqueId);
    callImpUniqueIds.add(uniqueId);
}
Also used : Invitee(com.fanap.podchat.mainmodel.Invitee) AcceptCallRequest(com.fanap.podchat.call.request_model.AcceptCallRequest) EndCallRequest(com.fanap.podchat.call.request_model.EndCallRequest) RejectCallRequest(com.fanap.podchat.call.request_model.RejectCallRequest) TerminateCallRequest(com.fanap.podchat.call.request_model.TerminateCallRequest) CallRequest(com.fanap.podchat.call.request_model.CallRequest) ArrayList(java.util.ArrayList) Date(java.util.Date) SuppressLint(android.annotation.SuppressLint)

Example 19 with Invitee

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

the class ThreadManager method prepareCreateThread.

public static String prepareCreateThread(int threadType, Invitee[] invitee, String threadTitle, String description, String image, String metadata, String uniqueId, String typecode, String token) {
    List<Invitee> invitees = new ArrayList<Invitee>(Arrays.asList(invitee));
    ChatThread chatThread = new ChatThread();
    chatThread.setType(threadType);
    chatThread.setInvitees(invitees);
    chatThread.setTitle(threadTitle);
    JsonObject chatThreadObject = (JsonObject) App.getGson().toJsonTree(chatThread);
    if (Util.isNullOrEmpty(description)) {
        chatThreadObject.remove("description");
    } else {
        chatThreadObject.remove("description");
        chatThreadObject.addProperty("description", description);
    }
    if (Util.isNullOrEmpty(image)) {
        chatThreadObject.remove("image");
    } else {
        chatThreadObject.remove("image");
        chatThreadObject.addProperty("image", image);
    }
    if (Util.isNullOrEmpty(metadata)) {
        chatThreadObject.remove("metadata");
    } else {
        chatThreadObject.remove("metadata");
        chatThreadObject.addProperty("metadata", metadata);
    }
    String contentThreadChat = chatThreadObject.toString();
    ChatMessage chatMessage = getChatMessage(contentThreadChat, uniqueId, typecode, token);
    JsonObject jsonObject = (JsonObject) App.getGson().toJsonTree(chatMessage);
    if (Util.isNullOrEmpty(typecode)) {
        jsonObject.remove("typeCode");
    } else {
        jsonObject.remove("typeCode");
        jsonObject.addProperty("typeCode", typecode);
    }
    String asyncContent = jsonObject.toString();
    return asyncContent;
}
Also used : Invitee(com.fanap.podchat.mainmodel.Invitee) ChatThread(com.fanap.podchat.mainmodel.ChatThread) ChatMessage(com.fanap.podchat.mainmodel.ChatMessage) ArrayList(java.util.ArrayList) JsonObject(com.google.gson.JsonObject)

Example 20 with Invitee

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

the class ParticipantsManager method prepareAddParticipantsRequest.

public static String prepareAddParticipantsRequest(RequestAddParticipants request, String uniqueId, String mTypeCode, String token) {
    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(token);
    chatMessage.setContent(participantsJsonArray.toString());
    chatMessage.setSubjectId(request.getThreadId());
    chatMessage.setUniqueId(uniqueId);
    chatMessage.setType(ChatMessageType.Constants.ADD_PARTICIPANT);
    chatMessage.setTypeCode(mTypeCode);
    JsonObject jsonObject = (JsonObject) App.getGson().toJsonTree(chatMessage);
    return jsonObject.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