use of com.fanap.podchat.model.ResultNotSeenDuration in project pod-chat-android-sdk by FanapSoft.
the class ChatCore method handleGetNotSeenDuration.
private void handleGetNotSeenDuration(Callback callback, ChatMessage chatMessage, String messageUniqueId) {
messageCallbacks.remove(messageUniqueId);
if (callback != null && callback.isResult()) {
ChatResponse<ResultNotSeenDuration> result = reformatNotSeenDuration(chatMessage, callback);
if (result == null) {
messageCallbacks.remove(messageUniqueId);
return;
}
OutPutNotSeenDurations output = new OutPutNotSeenDurations();
output.setResultNotSeenDuration(result.getResult());
if (sentryResponseLog) {
showLog("RECEIVE_NOT_SEEN_DURATION", chatMessage.getContent());
} else {
showLog("RECEIVE_NOT_SEEN_DURATION");
}
listenerManager.callOnGetNotSeenDuration(output);
}
}
use of com.fanap.podchat.model.ResultNotSeenDuration in project pod-chat-android-sdk by FanapSoft.
the class ChatCore method reformatNotSeenDuration.
private ChatResponse<ResultNotSeenDuration> reformatNotSeenDuration(ChatMessage chatMessage, Callback callback) {
ChatResponse<ResultNotSeenDuration> response = new ChatResponse<>();
Map<String, Long> idNotSeenPairs = new HashMap<>();
JsonParser parser = new JsonParser();
JsonObject jsonObject;
try {
jsonObject = parser.parse(chatMessage.getContent()).getAsJsonObject();
} catch (Exception e) {
captureError(e.getMessage(), ChatConstant.ERROR_CODE_UNKNOWN_EXCEPTION, chatMessage.getUniqueId(), e);
return null;
}
for (String key : jsonObject.keySet()) {
idNotSeenPairs.put(key, jsonObject.get(key).getAsLong());
}
ResultNotSeenDuration resultNotSeenDuration = new ResultNotSeenDuration();
resultNotSeenDuration.setIdNotSeenPair(idNotSeenPairs);
response.setResult(resultNotSeenDuration);
return response;
}
use of com.fanap.podchat.model.ResultNotSeenDuration in project pod-chat-android-sdk by FanapSoft.
the class ContactManager method prepareUpdateLastSeenResponse.
public static ChatResponse<ResultNotSeenDuration> prepareUpdateLastSeenResponse(ChatMessage message, JsonParser parser) {
ChatResponse<ResultNotSeenDuration> response = new ChatResponse<>();
JsonObject jsonObject = Util.objectToJson(message.getContent(), parser);
Map<String, Long> idLastSeen = new HashMap<>();
for (String key : jsonObject.keySet()) {
idLastSeen.put(key, jsonObject.get(key).getAsLong());
}
ResultNotSeenDuration resultNotSeenDuration = new ResultNotSeenDuration();
resultNotSeenDuration.setIdNotSeenPair(idLastSeen);
response.setResult(resultNotSeenDuration);
return response;
}
Aggregations