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);
}
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);
}
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));
}
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));
}
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");
}
}
Aggregations