diff --git a/android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java b/android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java index b73907950..505f6e0e0 100644 --- a/android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java +++ b/android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java @@ -530,26 +530,16 @@ private void done(Response resp) { } break; case FileStorage: - ResponseBody responseBody = resp.body(); - try { // In order to write response data to `destPath` we have to invoke this method. // It uses customized response body which is able to report download progress // and write response data to destination path. - responseBody.bytes(); + resp.body().bytes(); } catch (Exception ignored) { // ignored.printStackTrace(); } - - RNFetchBlobFileResp rnFetchBlobFileResp = (RNFetchBlobFileResp) responseBody; - - if(rnFetchBlobFileResp != null && rnFetchBlobFileResp.isDownloadComplete() == false){ - callback.invoke("RNFetchBlob failed. Download interrupted.", null); - } - else { - this.destPath = this.destPath.replace("?append=true", ""); - callback.invoke(null, RNFetchBlobConst.RNFB_RESPONSE_PATH, this.destPath); - } + this.destPath = this.destPath.replace("?append=true", ""); + callback.invoke(null, RNFetchBlobConst.RNFB_RESPONSE_PATH, this.destPath); break; default: try { diff --git a/android/src/main/java/com/RNFetchBlob/Response/RNFetchBlobFileResp.java b/android/src/main/java/com/RNFetchBlob/Response/RNFetchBlobFileResp.java index 8a7447ee0..7a6acf8e5 100644 --- a/android/src/main/java/com/RNFetchBlob/Response/RNFetchBlobFileResp.java +++ b/android/src/main/java/com/RNFetchBlob/Response/RNFetchBlobFileResp.java @@ -68,10 +68,6 @@ public long contentLength() { return originalBody.contentLength(); } - public boolean isDownloadComplete() { - return bytesDownloaded == contentLength(); - } - @Override public BufferedSource source() { ProgressReportingSource countable = new ProgressReportingSource();