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