Search in sources :

Example 16 with Participant

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);
    }
}
Also used : ResultAddParticipant(com.fanap.podchat.model.ResultAddParticipant) ResultParticipant(com.fanap.podchat.model.ResultParticipant) Participant(com.fanap.podchat.mainmodel.Participant) CacheParticipant(com.fanap.podchat.cachemodel.CacheParticipant) RequestThreadParticipant(com.fanap.podchat.requestobject.RequestThreadParticipant) OutPutParticipant(com.fanap.podchat.model.OutPutParticipant) ResultParticipant(com.fanap.podchat.model.ResultParticipant) TypeToken(com.google.gson.reflect.TypeToken) ChatResponse(com.fanap.podchat.model.ChatResponse) JSONException(org.json.JSONException) SentryException(io.sentry.core.protocol.SentryException) IOException(java.io.IOException) JsonSyntaxException(com.google.gson.JsonSyntaxException) PodChatException(com.fanap.podchat.util.PodChatException) RoomIntegrityException(com.fanap.podchat.persistance.RoomIntegrityException)

Example 17 with Participant

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());
}
Also used : Participant(com.fanap.podchat.mainmodel.Participant) CacheCallParticipant(com.fanap.podchat.call.persist.CacheCallParticipant) CacheCallParticipant(com.fanap.podchat.call.persist.CacheCallParticipant) Test(org.junit.Test)

Example 18 with Participant

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;
}
Also used : Participant(com.fanap.podchat.mainmodel.Participant) PodChatException(com.fanap.podchat.util.PodChatException) JsonSyntaxException(com.google.gson.JsonSyntaxException)

Example 19 with Participant

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);
    });
}
Also used : CacheThreadParticipant(com.fanap.podchat.cachemodel.CacheThreadParticipant) CacheParticipant(com.fanap.podchat.cachemodel.CacheParticipant) Participant(com.fanap.podchat.mainmodel.Participant) CacheCallParticipant(com.fanap.podchat.call.persist.CacheCallParticipant) ResultPinMessage(com.fanap.podchat.chat.pin.pin_message.model.ResultPinMessage) PinMessageVO(com.fanap.podchat.mainmodel.PinMessageVO) CacheParticipant(com.fanap.podchat.cachemodel.CacheParticipant)

Example 20 with Participant

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);
        }
    }
}
Also used : ScreenShareResult(com.fanap.podchat.call.request_model.screen_share.ScreenShareResult) Participant(com.fanap.podchat.mainmodel.Participant) ClientDTO(com.fanap.podchat.call.model.ClientDTO) PodCallBuilder(com.fanap.podcall.PodCallBuilder) CallPartner(com.fanap.podcall.model.CallPartner) CallPartnerView(com.fanap.podcall.view.CallPartnerView)

Aggregations

Participant (com.fanap.podchat.mainmodel.Participant)29 CacheParticipant (com.fanap.podchat.cachemodel.CacheParticipant)22 CacheCallParticipant (com.fanap.podchat.call.persist.CacheCallParticipant)18 CacheThreadParticipant (com.fanap.podchat.cachemodel.CacheThreadParticipant)17 ArrayList (java.util.ArrayList)15 PinMessageVO (com.fanap.podchat.mainmodel.PinMessageVO)8 ChatResponse (com.fanap.podchat.model.ChatResponse)7 ResultParticipant (com.fanap.podchat.model.ResultParticipant)7 ThreadVo (com.fanap.podchat.cachemodel.ThreadVo)6 ChatProfileVO (com.fanap.podchat.chat.user.profile.ChatProfileVO)6 Thread (com.fanap.podchat.mainmodel.Thread)6 ResultAddParticipant (com.fanap.podchat.model.ResultAddParticipant)6 CacheMessageVO (com.fanap.podchat.cachemodel.CacheMessageVO)5 CacheReplyInfoVO (com.fanap.podchat.cachemodel.CacheReplyInfoVO)5 GapMessageVO (com.fanap.podchat.cachemodel.GapMessageVO)5 MessageVO (com.fanap.podchat.mainmodel.MessageVO)5 OutPutParticipant (com.fanap.podchat.model.OutPutParticipant)5 ReplyInfoVO (com.fanap.podchat.model.ReplyInfoVO)5 IOException (java.io.IOException)5 RoomIntegrityException (com.fanap.podchat.persistance.RoomIntegrityException)4