Search in sources :

Example 11 with ResultImageFile

use of com.fanap.podchat.model.ResultImageFile in project pod-chat-android-sdk by FanapSoft.

the class PodUploader method generateImageUploadResultForSendMessage.

public static ChatResponse<ResultImageFile> generateImageUploadResultForSendMessage(UploadToPodSpaceResult response, String uniqueId, int actualWidth, int actualHeight, int width, int height, String url) {
    ResultImageFile result = generateImageUploadResult(response);
    ChatResponse<ResultImageFile> chatResponse = new ChatResponse<>();
    ResultImageFile resultImageFile = new ResultImageFile();
    chatResponse.setUniqueId(uniqueId);
    resultImageFile.setId(result.getId());
    resultImageFile.setHashCode(result.getHashCode());
    resultImageFile.setName(result.getName());
    resultImageFile.setHeight(height);
    resultImageFile.setWidth(width);
    resultImageFile.setActualHeight(actualHeight);
    resultImageFile.setActualWidth(actualWidth);
    resultImageFile.setUrl(url);
    chatResponse.setResult(resultImageFile);
    return chatResponse;
}
Also used : ResultImageFile(com.fanap.podchat.model.ResultImageFile) ChatResponse(com.fanap.podchat.model.ChatResponse)

Example 12 with ResultImageFile

use of com.fanap.podchat.model.ResultImageFile in project pod-chat-android-sdk by FanapSoft.

the class ChatTest method uploadProgressImage.

@Test
@MediumTest
public void uploadProgressImage() {
    sleep(3000);
    Uri uri = Uri.parse("content://media/external/images/media/781");
    presenter.uploadImageProgress(appContext, activity, uri, new ProgressHandler.onProgress() {

        @Override
        public void onProgressUpdate(int progress) {
            Mockito.anyInt();
        }

        @Override
        public void onFinish(String imageJson, ChatResponse<ResultImageFile> chatResponse) {
        }

        @Override
        public void onError(String jsonError, ErrorOutPut error) {
        }
    });
}
Also used : ResultImageFile(com.fanap.podchat.model.ResultImageFile) ProgressHandler(com.fanap.podchat.ProgressHandler) ErrorOutPut(com.fanap.podchat.model.ErrorOutPut) Uri(android.net.Uri) FlakyTest(android.support.test.filters.FlakyTest) MediumTest(android.support.test.filters.MediumTest) Test(org.junit.Test) LargeTest(android.support.test.filters.LargeTest) MediumTest(android.support.test.filters.MediumTest)

Example 13 with ResultImageFile

use of com.fanap.podchat.model.ResultImageFile in project pod-chat-android-sdk by FanapSoft.

the class ChatTestIntegration method uploadProgressImage.

@Test
@MediumTest
public void uploadProgressImage() {
    sleep(3000);
    Uri uri = Uri.parse("content://media/external/images/media/781");
    presenter.uploadImageProgress(appContext, activity, uri, new ProgressHandler.onProgress() {

        @Override
        public void onProgressUpdate(int progress) {
            Mockito.anyInt();
        }

        @Override
        public void onFinish(String imageJson, ChatResponse<ResultImageFile> chatResponse) {
        }

        @Override
        public void onError(String jsonError, ErrorOutPut error) {
        }
    });
}
Also used : ResultImageFile(com.fanap.podchat.model.ResultImageFile) ProgressHandler(com.fanap.podchat.ProgressHandler) ErrorOutPut(com.fanap.podchat.model.ErrorOutPut) Uri(android.net.Uri) FlakyTest(android.support.test.filters.FlakyTest) MediumTest(android.support.test.filters.MediumTest) Test(org.junit.Test) LargeTest(android.support.test.filters.LargeTest) MediumTest(android.support.test.filters.MediumTest)

Example 14 with ResultImageFile

use of com.fanap.podchat.model.ResultImageFile in project pod-chat-android-sdk by FanapSoft.

the class ChatTestSandbox method uploadProgressImage.

@Test
@MediumTest
public void uploadProgressImage() {
    sleep(3000);
    Uri uri = Uri.parse("content://media/external/images/media/781");
    presenter.uploadImageProgress(appContext, activity, uri, new ProgressHandler.onProgress() {

        @Override
        public void onProgressUpdate(int progress) {
            Mockito.anyInt();
        }

        @Override
        public void onFinish(String imageJson, ChatResponse<ResultImageFile> chatResponse) {
        }

        @Override
        public void onError(String jsonError, ErrorOutPut error) {
        }
    });
}
Also used : ResultImageFile(com.fanap.podchat.model.ResultImageFile) ProgressHandler(com.fanap.podchat.ProgressHandler) ErrorOutPut(com.fanap.podchat.model.ErrorOutPut) Uri(android.net.Uri) FlakyTest(android.support.test.filters.FlakyTest) MediumTest(android.support.test.filters.MediumTest) Test(org.junit.Test) LargeTest(android.support.test.filters.LargeTest) MediumTest(android.support.test.filters.MediumTest)

Example 15 with ResultImageFile

use of com.fanap.podchat.model.ResultImageFile in project pod-chat-android-sdk by FanapSoft.

the class ChatActivity method sendLocationMsg.

private void sendLocationMsg() {
    String center = "35.7003510,51.3376472";
    String meta = getMetaData();
    RequestLocationMessage requestLocationMessage = new RequestLocationMessage.Builder().systemMetadata(meta).center(center).message("Im here now    :   ) ").setUserGroupHash(TEST_THREAD_HASH).activity(ChatActivity.this).threadId(TEST_THREAD_ID).build();
    // presenter.sendLocationMessage(requestLocationMessage);
    presenter.sendLocationMessage(requestLocationMessage, new ProgressHandler.sendFileMessage() {

        @Override
        public void onProgressUpdate(String uniqueId, int progress, int totalBytesSent, int totalBytesToSend) {
            Log.d("MTAG", "Update progress: " + "Total Bytes sent: " + totalBytesSent + " Total Bytes left " + totalBytesToSend);
        }

        @Override
        public void onFinishImage(String json, ChatResponse<ResultImageFile> chatResponse) {
            Log.d("MTAG", "Finish upload");
        }

        @Override
        public void onError(String jsonError, ErrorOutPut error) {
            Log.d("MTAG", "Error upload");
        }
    });
}
Also used : ResultImageFile(com.fanap.podchat.model.ResultImageFile) ProgressHandler(com.fanap.podchat.ProgressHandler) ErrorOutPut(com.fanap.podchat.model.ErrorOutPut) RequestLocationMessage(com.fanap.podchat.requestobject.RequestLocationMessage)

Aggregations

ResultImageFile (com.fanap.podchat.model.ResultImageFile)16 ErrorOutPut (com.fanap.podchat.model.ErrorOutPut)13 ResultFile (com.fanap.podchat.model.ResultFile)10 RequestCreateThreadWithFile (com.fanap.podchat.requestobject.RequestCreateThreadWithFile)9 RequestUploadFile (com.fanap.podchat.requestobject.RequestUploadFile)9 ResultDownloadFile (com.fanap.podchat.chat.file_manager.download_file.model.ResultDownloadFile)8 ChatResponse (com.fanap.podchat.model.ChatResponse)8 MetaDataFile (com.fanap.podchat.model.MetaDataFile)8 RoomIntegrityException (com.fanap.podchat.persistance.RoomIntegrityException)8 RequestGetFile (com.fanap.podchat.requestobject.RequestGetFile)8 RequestGetPodSpaceFile (com.fanap.podchat.requestobject.RequestGetPodSpaceFile)8 PodChatException (com.fanap.podchat.util.PodChatException)8 JsonSyntaxException (com.google.gson.JsonSyntaxException)8 SentryException (io.sentry.core.protocol.SentryException)8 File (java.io.File)8 IOException (java.io.IOException)8 JSONException (org.json.JSONException)8 Subscription (rx.Subscription)8 ProgressHandler (com.fanap.podchat.ProgressHandler)7 UploadToPodSpaceResult (com.fanap.podchat.chat.file_manager.upload_file.UploadToPodSpaceResult)7