Search in sources :

Example 1 with ResultPinMessage

use of com.fanap.podchat.chat.pin.pin_message.model.ResultPinMessage in project pod-chat-android-sdk by FanapSoft.

the class PinMessage method handleOnMessagePinned.

public static ChatResponse<ResultPinMessage> handleOnMessagePinned(ChatMessage message) {
    ChatResponse<ResultPinMessage> response = new ChatResponse<>();
    ResultPinMessage result = App.getGson().fromJson(message.getContent(), ResultPinMessage.class);
    response.setResult(result);
    response.setSubjectId(message.getSubjectId());
    response.setUniqueId(message.getUniqueId());
    return response;
}
Also used : ResultPinMessage(com.fanap.podchat.chat.pin.pin_message.model.ResultPinMessage) ChatResponse(com.fanap.podchat.model.ChatResponse)

Example 2 with ResultPinMessage

use of com.fanap.podchat.chat.pin.pin_message.model.ResultPinMessage in project pod-chat-android-sdk by FanapSoft.

the class PinMessage method handleOnMessageUnPinned.

public static ChatResponse<ResultPinMessage> handleOnMessageUnPinned(ChatMessage message) {
    ChatResponse<ResultPinMessage> response = new ChatResponse<>();
    ResultPinMessage result = App.getGson().fromJson(message.getContent(), ResultPinMessage.class);
    response.setResult(result);
    response.setSubjectId(message.getSubjectId());
    response.setUniqueId(message.getUniqueId());
    return response;
}
Also used : ResultPinMessage(com.fanap.podchat.chat.pin.pin_message.model.ResultPinMessage) ChatResponse(com.fanap.podchat.model.ChatResponse)

Example 3 with ResultPinMessage

use of com.fanap.podchat.chat.pin.pin_message.model.ResultPinMessage 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)

Aggregations

ResultPinMessage (com.fanap.podchat.chat.pin.pin_message.model.ResultPinMessage)3 ChatResponse (com.fanap.podchat.model.ChatResponse)2 CacheParticipant (com.fanap.podchat.cachemodel.CacheParticipant)1 CacheThreadParticipant (com.fanap.podchat.cachemodel.CacheThreadParticipant)1 CacheCallParticipant (com.fanap.podchat.call.persist.CacheCallParticipant)1 Participant (com.fanap.podchat.mainmodel.Participant)1 PinMessageVO (com.fanap.podchat.mainmodel.PinMessageVO)1