use of com.fanap.podchat.chat.tag.result_model.TagListResult in project pod-chat-android-sdk by FanapSoft.
the class ChatCore method getTagList.
/**
* get user tags
*/
public String getTagList(GetTagListRequest request) {
String uniqueId = generateUniqueId();
if (cache) {
messageDatabaseHelper.getTagVos().subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).filter(tags -> tags != null && tags.size() > 0).subscribe(tags -> {
ChatResponse<TagListResult> response = new ChatResponse<>();
response.setResult(new TagListResult(tags));
response.setUniqueId(uniqueId);
response.setCache(true);
listenerManager.callOnTagList(null, response);
});
}
if (chatReady) {
String message = TagManager.createTagListRequest(request, uniqueId);
sendAsyncMessage(message, AsyncAckType.Constants.WITHOUT_ACK, "GET_TAG_LIST");
} else {
onChatNotReady(uniqueId);
}
return uniqueId;
}
use of com.fanap.podchat.chat.tag.result_model.TagListResult in project pod-chat-android-sdk by FanapSoft.
the class TagManager method prepareTagListResponse.
public static ChatResponse<TagListResult> prepareTagListResponse(ChatMessage chatMessage) {
TagListResult tagsResult = new TagListResult();
tagsResult.setTags(getTags(chatMessage));
ChatResponse<TagListResult> finalResponse = new ChatResponse<>();
finalResponse.setResult(tagsResult);
finalResponse.setUniqueId(chatMessage.getUniqueId());
finalResponse.setSubjectId(chatMessage.getSubjectId());
return finalResponse;
}
use of com.fanap.podchat.chat.tag.result_model.TagListResult in project pod-chat-android-sdk by FanapSoft.
the class TagCacheTest method populateCacheTags.
public void populateCacheTags() {
chatListeners = new ChatListener() {
@Override
public void OnTagList(String content, ChatResponse<TagListResult> response) {
if (response.isCache()) {
System.out.println("Received List: " + content);
cacheTags.addAll(response.getResult().getTags());
chat.removeListener(chatListeners);
}
resumeProcess();
}
};
chat.setListener(chatListeners);
GetTagListRequest request = new GetTagListRequest.Builder().build();
chat.getTagList(request);
pauseProcess();
System.out.println("Received List: " + cacheTags.size());
}
use of com.fanap.podchat.chat.tag.result_model.TagListResult in project pod-chat-android-sdk by FanapSoft.
the class TagCacheTest method populateServerTags.
public void populateServerTags() {
chatListeners = new ChatListener() {
@Override
public void OnTagList(String content, ChatResponse<TagListResult> response) {
if (!response.isCache()) {
System.out.println("Received List: " + content);
serverTags.addAll(response.getResult().getTags());
chat.removeListener(chatListeners);
}
resumeProcess();
}
};
chat.setListener(chatListeners);
GetTagListRequest request = new GetTagListRequest.Builder().withNoCache().build();
chat.getTagList(request);
pauseProcess();
System.out.println("Received List: " + serverTags.size());
}
Aggregations