Skip to content

Commit

Permalink
Revert "Merge pull request #396 from sonudoo/download-interruption-an…
Browse files Browse the repository at this point in the history
…droid-bugfix"

This reverts commit 4305ef8, reversing
changes made to d35fb73.
  • Loading branch information
Traviskn committed Sep 27, 2019
1 parent 00c12e3 commit 0e2c40e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
16 changes: 3 additions & 13 deletions android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,6 @@ public long contentLength() {
return originalBody.contentLength();
}

public boolean isDownloadComplete() {
return bytesDownloaded == contentLength();
}

@Override
public BufferedSource source() {
ProgressReportingSource countable = new ProgressReportingSource();
Expand Down

1 comment on commit 0e2c40e

@maulikdhameliya
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you for reverting.

Please sign in to comment.