use of com.fanap.podchat.mainmodel.ChatThread in project pod-chat-android-sdk by FanapSoft.
the class ThreadManager method prepareCreateThread.
public static String prepareCreateThread(int threadType, Invitee[] invitee, String threadTitle, String description, String image, String metadata, String uniqueId, String typecode, String token) {
List<Invitee> invitees = new ArrayList<Invitee>(Arrays.asList(invitee));
ChatThread chatThread = new ChatThread();
chatThread.setType(threadType);
chatThread.setInvitees(invitees);
chatThread.setTitle(threadTitle);
JsonObject chatThreadObject = (JsonObject) App.getGson().toJsonTree(chatThread);
if (Util.isNullOrEmpty(description)) {
chatThreadObject.remove("description");
} else {
chatThreadObject.remove("description");
chatThreadObject.addProperty("description", description);
}
if (Util.isNullOrEmpty(image)) {
chatThreadObject.remove("image");
} else {
chatThreadObject.remove("image");
chatThreadObject.addProperty("image", image);
}
if (Util.isNullOrEmpty(metadata)) {
chatThreadObject.remove("metadata");
} else {
chatThreadObject.remove("metadata");
chatThreadObject.addProperty("metadata", metadata);
}
String contentThreadChat = chatThreadObject.toString();
ChatMessage chatMessage = getChatMessage(contentThreadChat, uniqueId, typecode, token);
JsonObject jsonObject = (JsonObject) App.getGson().toJsonTree(chatMessage);
if (Util.isNullOrEmpty(typecode)) {
jsonObject.remove("typeCode");
} else {
jsonObject.remove("typeCode");
jsonObject.addProperty("typeCode", typecode);
}
String asyncContent = jsonObject.toString();
return asyncContent;
}
Aggregations