use of com.fanap.podchat.requestobject.RequestCreateThreadWithFile in project pod-chat-android-sdk by FanapSoft.
the class ChatActivity method createThreadWithFile.
private void createThreadWithFile() {
if (getUri() == null) {
Toast.makeText(this, "Pick a file", Toast.LENGTH_SHORT).show();
return;
}
RequestUploadImage requestUploadThreadImageImage = new RequestUploadImage.Builder(this, getUri()).setwC(140).sethC(140).build();
RequestUploadImage requestUploadImage = new RequestUploadImage.Builder(this, getUri()).setwC(120).sethC(120).setxC(1).setyC(1).build();
RequestUploadFile requestUploadFile = new RequestUploadFile.Builder(this, getUri()).build();
List<Invitee> invite = new ArrayList<>();
// f.kh sandbox
// invite.add(new Invitee("4893", InviteType.Constants.TO_BE_USER_CONTACT_ID));
// POURIA main
invite.add(new Invitee(1151568, InviteType.Constants.TO_BE_USER_CONTACT_ID));
// MASOUD
// invite.add(new Invitee(1511971, InviteType.Constants.TO_BE_USER_CONTACT_ID));
// ARVIN
invite.add(new Invitee(1512305, InviteType.Constants.TO_BE_USER_CONTACT_ID));
// MAHYAR
// invite.add(new Invitee(1196793, InviteType.Constants.TO_BE_USER_CONTACT_ID));
// RequestThreadInnerMessage innerMessage = new RequestThreadInnerMessage
// .Builder(TextMessageType.Constants.PICTURE)
// // .message("Create thread for File Message Test " + new Date().toString())
// // .forwardedMessageIds(listForwardIds)
// .build();
RequestCreateThreadWithFile request = new RequestCreateThreadWithFile.Builder(ThreadType.Constants.OWNER_GROUP, invite, requestUploadFile, TextMessageType.Constants.POD_SPACE_FILE).title("Test File PodSpace").setUploadThreadImageRequest(requestUploadThreadImageImage).build();
presenter.createThreadWithFile(request, new ProgressHandler.sendFileMessage() {
@Override
public void onProgressUpdate(String uniqueId, int progress, int totalBytesSent, int totalBytesToSend) {
Log.e("CTF", "Upload Progress: " + progress);
}
@Override
public void onFinishImage(String json, ChatResponse<ResultImageFile> chatResponse) {
Log.e("CTF", "Upload Finish (IMAGE): ");
}
@Override
public void onFinishFile(String json, ChatResponse<ResultFile> chatResponse) {
Log.e("CTF", "Upload Finish (FILE): ");
}
@Override
public void onError(String jsonError, ErrorOutPut error) {
Log.e("CTF", "Upload Error");
}
});
}
Aggregations