Search in sources :

Example 1 with Invitee

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

the class CallPresenter method requestP2PCallWithContactId.

private void requestP2PCallWithContactId(int contactId, int callType, String contactName) {
    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 + contactName).setDescription("Generated at " + new Date().toString()).build();
    if (callRequest.getCallType() == CallType.Constants.VIDEO_CALL) {
        showVideoViews();
    } else {
        prepareAudioCallView();
    }
    String 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)

Example 2 with Invitee

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

the class ExampleUnitTest method inviteeToJson.

@Test
public void inviteeToJson() {
    Gson gson = new GsonBuilder().create();
    List<String> invitees = new ArrayList<>();
    invitees.add("fkheirkhah");
    invitees.add("f.khojasteh");
    invitees.add("m.zhiani");
    JsonArray participantsJsonArray = new JsonArray();
    try {
        for (String username : invitees) {
            Invitee invitee = new Invitee();
            invitee.setId(username);
            invitee.setIdType(InviteType.Constants.TO_BE_USER_USERNAME);
            JsonElement jsonElement = gson.toJsonTree(invitee);
            participantsJsonArray.add(jsonElement);
        }
    } catch (Exception e) {
        e.printStackTrace();
        Assert.fail();
    }
    Assert.assertTrue(true);
}
Also used : JsonArray(com.google.gson.JsonArray) Invitee(com.fanap.podchat.mainmodel.Invitee) GsonBuilder(com.google.gson.GsonBuilder) JsonElement(com.google.gson.JsonElement) ArrayList(java.util.ArrayList) Gson(com.google.gson.Gson) RoomIntegrityException(com.fanap.podchat.persistance.RoomIntegrityException) ExecutionException(java.util.concurrent.ExecutionException) Test(org.junit.Test)

Example 3 with Invitee

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

the class CallPresenter method requestGroupAudioCallByContactId.

@SuppressLint("MissingPermission")
@Override
public void requestGroupAudioCallByContactId(String callName, ArrayList<Long> selectContactIds) {
    view.hideContactsFragment();
    view.showFabContact();
    List<Invitee> invitees = new ArrayList<>();
    for (Long cId : selectContactIds) {
        invitees.add(new Invitee(cId, InviteType.Constants.TO_BE_USER_CONTACT_ID));
    }
    CallRequest request = new CallRequest.Builder().setTitle(callName).setCallType(CallType.Constants.VIDEO_CALL).setInvitees(invitees).build();
    prepareAudioCallView();
    callImpUniqueIds.add(chat.requestGroupCall(request));
}
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) GsonBuilder(com.google.gson.GsonBuilder) ArrayList(java.util.ArrayList) SuppressLint(android.annotation.SuppressLint)

Example 4 with Invitee

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

the class CallPresenter method requestGroupVideoCallByContactId.

@SuppressLint("MissingPermission")
@Override
public void requestGroupVideoCallByContactId(String callName, ArrayList<Long> selectContactIds) {
    view.hideContactsFragment();
    view.showFabContact();
    List<Invitee> invitees = new ArrayList<>();
    for (Long cId : selectContactIds) {
        invitees.add(new Invitee(cId, InviteType.Constants.TO_BE_USER_CONTACT_ID));
    }
    CallRequest request = new CallRequest.Builder().setTitle(callName).setCallType(CallType.Constants.VIDEO_CALL).setInvitees(invitees).build();
    showVideoViews();
    callImpUniqueIds.add(chat.requestGroupCall(request));
}
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) GsonBuilder(com.google.gson.GsonBuilder) ArrayList(java.util.ArrayList) SuppressLint(android.annotation.SuppressLint)

Example 5 with Invitee

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

the class CallPresenter method requestMainOrSandboxCall.

@SuppressLint("MissingPermission")
@Override
public void requestMainOrSandboxCall(String query, boolean isGroupCall) {
    try {
        if (Util.isNotNullOrEmpty(query)) {
            showVideoViews();
            String uniqueId = "";
            if (query.contains("-")) {
                String[] ids = query.split("-");
                List<Invitee> invitees = new ArrayList<>();
                if (ids.length == 1) {
                    // P2P Call
                    Invitee invitee = new Invitee();
                    invitee.setId(ids[0]);
                    invitee.setIdType(InviteType.Constants.TO_BE_USER_ID);
                    invitees.add(invitee);
                    // request with invitee list
                    CallRequest callRequest = new CallRequest.Builder(invitees, BASE_CALL_TYPE).build();
                    uniqueId = chat.requestCall(callRequest);
                    view.updateStatus("Request p2p call with: " + ids[0]);
                } else if (ids.length <= 5) {
                    for (String id : ids) {
                        Invitee invitee = new Invitee();
                        invitee.setId(id);
                        invitee.setIdType(InviteType.Constants.TO_BE_USER_CONTACT_ID);
                        invitees.add(invitee);
                    }
                    CallRequest callRequest = new CallRequest.Builder(invitees, BASE_CALL_TYPE).setTitle(GROUP_CALL_NAME_PREFIX + ids).setDescription("Generated at " + new Date().toString()).build();
                    uniqueId = chat.requestGroupCall(callRequest);
                    view.updateStatus("Request group call invitees: " + Arrays.toString(ids));
                } else {
                    view.updateStatus("حداکثر اعضای تماس گروهی 5 نفر می باشد");
                }
            } else {
                // Group Call with subject id
                CallRequest callRequest = new CallRequest.Builder(Long.parseLong(query), BASE_CALL_TYPE).setTitle(GROUP_CALL_NAME_PREFIX + query).setDescription("Generated at " + new Date().toString()).build();
                if (isGroupCall) {
                    uniqueId = chat.requestGroupCall(callRequest);
                } else {
                    uniqueId = chat.requestCall(callRequest);
                }
            }
            if (Util.isNotNullOrEmpty(uniqueId)) {
                callUniqueIds.add(uniqueId);
                callImpUniqueIds.add(uniqueId);
            }
        }
    } catch (NumberFormatException e) {
        view.updateStatus("Wrong format");
    }
}
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) GsonBuilder(com.google.gson.GsonBuilder) ArrayList(java.util.ArrayList) Date(java.util.Date) SuppressLint(android.annotation.SuppressLint)

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