Skip to content

Commit 0e2c40e

Browse files
committed
Revert "Merge pull request #396 from sonudoo/download-interruption-android-bugfix"
This reverts commit 4305ef8, reversing changes made to d35fb73.
1 parent 00c12e3 commit 0e2c40e

File tree

2 files changed

+3
-17
lines changed

2 files changed

+3
-17
lines changed

android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -530,26 +530,16 @@ private void done(Response resp) {
530530
}
531531
break;
532532
case FileStorage:
533-
ResponseBody responseBody = resp.body();
534-
535533
try {
536534
// In order to write response data to `destPath` we have to invoke this method.
537535
// It uses customized response body which is able to report download progress
538536
// and write response data to destination path.
539-
responseBody.bytes();
537+
resp.body().bytes();
540538
} catch (Exception ignored) {
541539
// ignored.printStackTrace();
542540
}
543-
544-
RNFetchBlobFileResp rnFetchBlobFileResp = (RNFetchBlobFileResp) responseBody;
545-
546-
if(rnFetchBlobFileResp != null && rnFetchBlobFileResp.isDownloadComplete() == false){
547-
callback.invoke("RNFetchBlob failed. Download interrupted.", null);
548-
}
549-
else {
550-
this.destPath = this.destPath.replace("?append=true", "");
551-
callback.invoke(null, RNFetchBlobConst.RNFB_RESPONSE_PATH, this.destPath);
552-
}
541+
this.destPath = this.destPath.replace("?append=true", "");
542+
callback.invoke(null, RNFetchBlobConst.RNFB_RESPONSE_PATH, this.destPath);
553543
break;
554544
default:
555545
try {

android/src/main/java/com/RNFetchBlob/Response/RNFetchBlobFileResp.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,6 @@ public long contentLength() {
6868
return originalBody.contentLength();
6969
}
7070

71-
public boolean isDownloadComplete() {
72-
return bytesDownloaded == contentLength();
73-
}
74-
7571
@Override
7672
public BufferedSource source() {
7773
ProgressReportingSource countable = new ProgressReportingSource();

0 commit comments

Comments
 (0)