use of com.fanap.podchat.cachemodel.CacheAssistantHistoryVo in project pod-chat-android-sdk by FanapSoft.
the class MessageDatabaseHelper method updateCashAssistantHistory.
public void updateCashAssistantHistory(OnWorkDone listener, List<AssistantHistoryVo> response) {
worker(() -> {
List<CacheAssistantHistoryVo> cashAssitantHistory = new ArrayList<>();
for (AssistantHistoryVo assistantVo : response) {
CacheAssistantHistoryVo cashAsisstantHistory = new CacheAssistantHistoryVo();
if (assistantVo.getParticipantVO() != null) {
Participant participant = assistantVo.getParticipantVO();
String participantJson = App.getGson().toJson(participant);
CacheParticipant cacheParticipant = App.getGson().fromJson(participantJson, CacheParticipant.class);
messageDao.insertParticipant(cacheParticipant);
cashAsisstantHistory.setParticipantVOId(assistantVo.getParticipantVO().getId());
}
cashAsisstantHistory.setActionTime(assistantVo.getActionTime());
cashAsisstantHistory.setActionType(assistantVo.getActionType());
cashAsisstantHistory.setActionName(assistantVo.getActionName());
cashAssitantHistory.add(cashAsisstantHistory);
}
messageDao.insertCacheAssistantHistoryVo(cashAssitantHistory);
listener.onWorkDone(true);
});
}
use of com.fanap.podchat.cachemodel.CacheAssistantHistoryVo in project pod-chat-android-sdk by FanapSoft.
the class MessageDatabaseHelper method getCacheAssistantHistoryVos.
public void getCacheAssistantHistoryVos(GetAssistantHistoryRequest request, FunctionalListener callback) throws RoomIntegrityException {
if (!canUseDatabase())
throw new RoomIntegrityException();
worker(() -> {
List<CacheAssistantHistoryVo> list = messageDao.getCacheAssistantHistory(request.getCount() > 0 ? request.getCount() : 25, request.getOffset());
List<AssistantHistoryVo> cacheResponseList = new ArrayList<>();
for (CacheAssistantHistoryVo item : list) {
AssistantHistoryVo assistantHistoryVo = new AssistantHistoryVo();
assistantHistoryVo.setActionName(item.getActionName());
assistantHistoryVo.setActionTime(item.getActionTime());
assistantHistoryVo.setActionType(item.getActionType());
Participant participant = cacheToParticipantMapper(messageDao.getParticipant(item.getParticipantVOId()), false, null);
assistantHistoryVo.setParticipantVO(participant);
cacheResponseList.add(assistantHistoryVo);
}
callback.onWorkDone(list.size(), cacheResponseList);
});
}
Aggregations