use of com.fanap.podchat.mainmodel.Participant in project pod-chat-android-sdk by FanapSoft.
the class ChatCore method handleOutPutDeliveredMessageList.
private void handleOutPutDeliveredMessageList(ChatMessage chatMessage, Callback callback) {
try {
ChatResponse<ResultParticipant> chatResponse = new ChatResponse<>();
chatResponse.setUniqueId(chatMessage.getUniqueId());
ResultParticipant resultParticipant = new ResultParticipant();
List<Participant> participants = gson.fromJson(chatMessage.getContent(), new TypeToken<ArrayList<Participant>>() {
}.getType());
resultParticipant.setParticipants(participants);
resultParticipant.setContentCount(chatMessage.getContentCount());
resultParticipant.setNextOffset(callback.getOffset() + participants.size());
resultParticipant.setContentCount(chatMessage.getContentCount());
resultParticipant.setHasNext(participants.size() + callback.getOffset() < chatMessage.getContentCount());
chatResponse.setResult(resultParticipant);
String content = gson.toJson(chatResponse);
if (sentryResponseLog) {
showLog("RECEIVE_DELIVERED_MESSAGE_LIST", content);
} else {
showLog("RECEIVE_DELIVERED_MESSAGE_LIST");
}
listenerManager.callOnDeliveredMessageList(content, chatResponse);
} catch (Exception e) {
showErrorLog(e.getMessage());
onUnknownException(chatMessage.getUniqueId(), e);
}
}
use of com.fanap.podchat.mainmodel.Participant in project pod-chat-android-sdk by FanapSoft.
the class ExampleUnitTest method testCallParticipant.
@Test
public void testCallParticipant() {
Participant participant = new Participant();
participant.setName("John");
participant.setLastName("Doe");
participant.setImage("mmm");
CacheCallParticipant callParticipant = new CacheCallParticipant().fromParticipant(participant, 1000);
assertEquals(participant.getFirstName(), callParticipant.getFirstName());
}
use of com.fanap.podchat.mainmodel.Participant in project pod-chat-android-sdk by FanapSoft.
the class CallAsyncRequestsManager method handleCallIsRecordingCallResponse.
public static ChatResponse<Participant> handleCallIsRecordingCallResponse(ChatResponse<StartedCallModel> info) {
ChatResponse<Participant> response = null;
try {
response = new ChatResponse<>();
response.setUniqueId(info.getUniqueId());
response.setSubjectId(info.getSubjectId());
Participant participant = new Participant();
participant.setId(Long.parseLong(info.getResult().getChatDataDTO().getRecordingUser()));
response.setResult(participant);
} catch (Exception e) {
Log.wtf(TAG, e);
}
return response;
}
use of com.fanap.podchat.mainmodel.Participant in project pod-chat-android-sdk by FanapSoft.
the class MessageDatabaseHelper method savePinMessage.
public void savePinMessage(ChatResponse<ResultPinMessage> response, long subjectId) {
worker(() -> {
ResultPinMessage result = response.getResult();
PinMessageVO pinMessageVO = new PinMessageVO();
pinMessageVO.setThreadId(subjectId);
pinMessageVO.setMessageId(result.getMessageId());
pinMessageVO.setNotifyAll(result.isNotifyAll());
pinMessageVO.setText(result.getText());
pinMessageVO.setTime(result.getTime());
if (result.getParticipant() != null) {
Participant participant = result.getParticipant();
String participantJson = App.getGson().toJson(participant);
CacheParticipant cacheParticipant = App.getGson().fromJson(participantJson, CacheParticipant.class);
messageDao.insertParticipant(cacheParticipant);
pinMessageVO.setParticipantId(cacheParticipant.getId());
}
messageDao.insertPinnedMessage(pinMessageVO);
});
}
use of com.fanap.podchat.mainmodel.Participant in project pod-chat-android-sdk by FanapSoft.
the class Chat method prepareRemotePartnersByClientDTOList.
private void prepareRemotePartnersByClientDTOList(ChatResponse<StartedCallModel> info) {
boolean hasScreenSharer = CallAsyncRequestsManager.checkIsAnyScreenSharing(info);
boolean isCallRecording = CallAsyncRequestsManager.checkIsCallIsRecording(info);
for (ClientDTO client : info.getResult().getOtherClientDtoList()) {
if (client.getUserId() == 0)
continue;
if (!client.getUserId().equals(CoreConfig.userId)) {
CallPartner.Builder rPartnerBuilder = new CallPartner.Builder();
rPartnerBuilder.setId(client.getUserId());
rPartnerBuilder.setPartnerType(PartnerType.REMOTE).setName("" + client.getUserId());
rPartnerBuilder.setVideoTopic(client.getTopicSendVideo());
rPartnerBuilder.setHasVideo(Util.isNotNullOrEmpty(client.getTopicSendVideo()));
rPartnerBuilder.setVideoOn(client.getVideo());
if (client.getVideo() && hasRemotePartnerView()) {
CallPartnerView view = assignCallPartnerView(client.getUserId());
if (view != null) {
visibleView(view);
rPartnerBuilder.setVideoView(view);
} else {
rPartnerBuilder.setVideoOn(false);
}
}
rPartnerBuilder.setAudioTopic(client.getTopicSendAudio());
rPartnerBuilder.setHasAudio(Util.isNotNullOrEmpty(client.getTopicSendAudio()));
rPartnerBuilder.setAudioOn(!client.getMute());
CallPartner rPartner = rPartnerBuilder.build();
podVideoCall.addPartner(rPartner);
}
}
if (hasScreenSharer) {
ChatResponse<ScreenShareResult> sc = CallAsyncRequestsManager.handleOnScreenIsSharing(info);
addScreenSharer(sc);
}
if (isCallRecording) {
ChatResponse<Participant> response = CallAsyncRequestsManager.handleCallIsRecordingCallResponse(info);
if (CoreConfig.userId.equals(response.getResult().getId())) {
removeCallback(info.getUniqueId());
listenerManager.callOnCallRecordStarted(response);
} else {
listenerManager.callOnCallParticipantStartRecording(response);
}
}
}
Aggregations