use of com.fanap.podchat.cachemodel.CacheTagVo in project pod-chat-android-sdk by FanapSoft.
the class MessageDatabaseHelper method prepareTagList.
private List<TagVo> prepareTagList() {
List<CacheTagVo> tags = messageDao.getCacheTagVos();
List<TagVo> tagVos = new ArrayList<>();
for (CacheTagVo item : tags) {
TagVo tag = CacheTagVoToTagVoMapper(item);
long allUnreadCount = 0;
List<CacheTagParticipantVO> cacheTagParticipants = messageDao.getCacheTagParticipantVosByTagId(item.getTagId());
List<TagParticipantVO> tagParticipants = new ArrayList<>();
for (CacheTagParticipantVO cacheTagParticipantVO : cacheTagParticipants) {
TagParticipantVO cache = cacheTagParticipantVOToTagParticipantVOMapper(cacheTagParticipantVO);
if (messageDao.getThreadById(cacheTagParticipantVO.getThreadId()) != null) {
Thread thread = threadVoToThreadMapper(messageDao.getThreadById(cacheTagParticipantVO.getThreadId()), null);
cache.setConversationVO(thread);
// TODO it should be save in db. can save it when save tags on db
if (thread.getUnreadCount() > 0)
allUnreadCount = allUnreadCount + thread.getUnreadCount();
}
tagParticipants.add(cache);
}
tag.setTagParticipants(tagParticipants);
tag.setAllUnreadCount(allUnreadCount);
tagVos.add(tag);
}
return tagVos;
}
use of com.fanap.podchat.cachemodel.CacheTagVo in project pod-chat-android-sdk by FanapSoft.
the class MessageDatabaseHelper method updateCacheTagVo.
public void updateCacheTagVo(TagVo tag) {
CacheTagVo cacheFile = new CacheTagVo();
cacheFile.setTagId(tag.getTagId());
cacheFile.setActive(tag.isActive());
cacheFile.setName(tag.getTagName());
if (tag.getTagParticipants() != null && tag.getTagParticipants().size() > 0)
updateCacheTagParticipantVos(tag.getTagParticipants(), tag.getTagId());
messageDao.insertCacheTagVo(cacheFile);
}
Aggregations