Skip to content
This repository has been archived by the owner on Mar 16, 2019. It is now read-only.

Add ability to cancel android DownloadManager fetches #502

Merged
merged 1 commit into from
Aug 31, 2017

Conversation

wschurman
Copy link

Not completely sure whether this is considered a new feature or a bugfix, but since this behavior may be expected I figured it might be a bugfix. Happy to move PR to 0.11.0 if desired.

This just requires a bit of bookkeeping that keeps track of the task ID to the download manager ID, and then calling the relevant download manager method. Note that the behavior of the download manager remove method is to remove the download and the downloaded file, whether partial or complete (https://developer.android.com/reference/android/app/DownloadManager.html#remove(long...)).

Happy to answer any questions and always looking for review/comments on the approach.

This just requires a bit of bookkeeping that keeps track of the task ID to the download manager ID.
Note that the behavior of the download manager remove method is to remove the download and the downloaded file, whether partial or complete.
https://developer.android.com/reference/android/app/DownloadManager.html#remove(long...)
Copy link
Owner

@wkh237 wkh237 left a comment

Choose a reason for hiding this comment

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

cool, thanks for the great work 👍

@wkh237 wkh237 merged commit c6f8b5d into wkh237:0.10.9 Aug 31, 2017
danielsuo added a commit to danielsuo/react-native-fetch-blob that referenced this pull request Feb 13, 2018
* upstream/0.10.9:
  Fixed problem with type casting (wkh237#513)
  My proposed 0.10.9 changes (wkh237#489)
  wkh237#268 Cancelled task should not trigger `then` promise function
  Add ability to cancel android DownloadManager fetches (wkh237#502)
  Fix iOS initialization race condition (wkh237#499)
  prevent UIApplication methods from being called on background thread (wkh237#486)
  Implemenet fs.hash() -- wkh237#439 "Feature: Calculate file hash" (wkh237#476)
  I forgot one error string for the Android readFile() method (wkh237#475)
  Fix for wkh237#467 (wkh237#472)
  Fix for issue wkh237#468, wkh237#461, wkh237#460 and minor cleanup (wkh237#469)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants