diff --git a/mobile-sdk/build.gradle b/mobile-sdk/build.gradle index c3f5058..d84ed39 100644 --- a/mobile-sdk/build.gradle +++ b/mobile-sdk/build.gradle @@ -122,7 +122,7 @@ afterEvaluate { groupId = "com.webitel" artifactId = "mobile-sdk" - version = "0.15.1" + version = "0.15.2" } } } diff --git a/mobile-sdk/src/main/java/com/webitel/mobile_sdk/data/chats/WebitelChat.kt b/mobile-sdk/src/main/java/com/webitel/mobile_sdk/data/chats/WebitelChat.kt index e338491..4b2ebbd 100644 --- a/mobile-sdk/src/main/java/com/webitel/mobile_sdk/data/chats/WebitelChat.kt +++ b/mobile-sdk/src/main/java/com/webitel/mobile_sdk/data/chats/WebitelChat.kt @@ -216,11 +216,18 @@ internal class WebitelChat( while (transferRequest.stream.read(fiveKB).also { length = it } > 0) { if (!inProcess) break logger.debug("sendFile", "sending $length length of data") - request?.onNext( - Media.UploadRequest.newBuilder() - .setPart(ByteString.copyFrom(fiveKB, 0, length)) - .build() - ) + + try { + request?.onNext( + Media.UploadRequest.newBuilder() + .setPart(ByteString.copyFrom(fiveKB, 0, length)) + .build() + ) + } catch (e: Exception) { + inProcess = false + logger.error("upload chunk", e.message.toString()) + } + } logger.debug("sendFile", "all bytes sent to stream") if (inProcess) {