Search in sources :

Example 1 with RequestCreateThreadWithFile

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");
        }
    });
}
Also used : RequestUploadImage(com.fanap.podchat.requestobject.RequestUploadImage) ProgressHandler(com.fanap.podchat.ProgressHandler) ArrayList(java.util.ArrayList) ResultFile(com.fanap.podchat.model.ResultFile) Invitee(com.fanap.podchat.mainmodel.Invitee) ResultImageFile(com.fanap.podchat.model.ResultImageFile) RequestUploadFile(com.fanap.podchat.requestobject.RequestUploadFile) ErrorOutPut(com.fanap.podchat.model.ErrorOutPut) RequestCreateThreadWithFile(com.fanap.podchat.requestobject.RequestCreateThreadWithFile)

Aggregations

ProgressHandler (com.fanap.podchat.ProgressHandler)1 Invitee (com.fanap.podchat.mainmodel.Invitee)1 ErrorOutPut (com.fanap.podchat.model.ErrorOutPut)1 ResultFile (com.fanap.podchat.model.ResultFile)1 ResultImageFile (com.fanap.podchat.model.ResultImageFile)1 RequestCreateThreadWithFile (com.fanap.podchat.requestobject.RequestCreateThreadWithFile)1 RequestUploadFile (com.fanap.podchat.requestobject.RequestUploadFile)1 RequestUploadImage (com.fanap.podchat.requestobject.RequestUploadImage)1 ArrayList (java.util.ArrayList)1