use of com.fanap.podchat.chat.thread.public_thread.RequestCreatePublicThread in project pod-chat-android-sdk by FanapSoft.
the class ThreadManager method prepareCreateThread.
public static String prepareCreateThread(RequestCreateThread request, String uniqueId, String typecode, String token) {
JsonObject chatMessageContent = (JsonObject) App.getGson().toJsonTree(request);
if (request instanceof RequestCreatePublicThread) {
String uniqueName = ((RequestCreatePublicThread) request).getUniqueName();
chatMessageContent.addProperty("uniqueName", uniqueName);
}
AsyncMessage chatMessage = new AsyncMessage();
chatMessage.setContent(chatMessageContent.toString());
chatMessage.setType(ChatMessageType.Constants.INVITATION);
chatMessage.setToken(token);
chatMessage.setUniqueId(uniqueId);
chatMessage.setTokenIssuer("1");
chatMessage.setTypeCode(Util.isNullOrEmpty(request.getTypeCode()) ? typecode : request.getTypeCode());
String asyncContent = App.getGson().toJson(chatMessage);
return asyncContent;
}
use of com.fanap.podchat.chat.thread.public_thread.RequestCreatePublicThread in project pod-chat-android-sdk by FanapSoft.
the class ExampleUnitTest method instanceOfTest.
@Test
public void instanceOfTest() {
RequestCreatePublicThread request = new RequestCreatePublicThread.Builder(0, new ArrayList<>(), "unique").build();
getUniqueName(request);
}
use of com.fanap.podchat.chat.thread.public_thread.RequestCreatePublicThread in project pod-chat-android-sdk by FanapSoft.
the class ExampleUnitTest method getUniqueName.
public void getUniqueName(RequestCreateThread request) {
if (request instanceof RequestCreatePublicThread) {
RequestCreatePublicThread pt = (RequestCreatePublicThread) request;
Assert.assertEquals("unique", pt.getUniqueName());
} else {
Assert.fail("Name is Lost");
}
}
use of com.fanap.podchat.chat.thread.public_thread.RequestCreatePublicThread in project pod-chat-android-sdk by FanapSoft.
the class ChatActivity method createPublicThread.
private void createPublicThread() {
Invitee[] invite = new Invitee[] { new Invitee("5739", InviteType.Constants.TO_BE_USER_CONTACT_ID), new Invitee("5740", InviteType.Constants.TO_BE_USER_CONTACT_ID) };
String metac = getMetaData();
RequestCreatePublicThread request = new RequestCreatePublicThread.Builder(ThreadType.Constants.PUBLIC_GROUP, Arrays.asList(invite), THREAD_UNIQUE_NAME).withDescription("desc at " + new Date()).title("My Public Group 22").withImage("http://google.com").withMetadata(metac).build();
presenter.createPublicThread(request);
}
Aggregations