SimonSimCity / Xamarin-CrossDownloadManager

A cross platform download manager for Xamarin
MIT License
149 stars 68 forks source link

DownloadStatus.Failed is set and removed from queue before StatusDetail is set #98

Open large opened 5 years ago

large commented 5 years ago

Steps to reproduce

Download a file that generate status DownloadStatus.Failed Try downloading a file that is bigger than the space you have available.

Expected behavior

When download have status DownloadStatus.Failed the StatusDetails needs to be set before item is removed from queue.

In file: Xamarin-CrossDownloadManager/DownloadManager/Plugin.DownloadManager.Android/DownloadManagerImplementation.cs Move the two lines: 175 downloadFile.Status = DownloadFileStatus.FAILED; 176 RemoveFile (downloadFile);

To line 214, that ensure that StatusDetail is set before Status making more sense (equal to DownloadStatus.Successful)

Actual behavior

DownloadStatus.StatusDetail is set after the item is removed from queue, making it unavailable to read.

Extra info regarding INSUFFICIENT_SPACE_ERROR

The ACTION_DOWNLOAD_COMPLETE broadcast is not called after a INSUFFICIENT_SPACE_ERROR , but this issue is not related to CrossDownloadmanager. I've added a bug with Google, since it should be handled by notify the user that a download was finished: https://issuetracker.google.com/issues/118860049

Configuration

Platform:

Device:

SimonSimCity commented 5 years ago

Thanks for the change-request. I've invited you to join the team of contributors so you can do the changes on your own, because I don't have much time which I could dedicate to this project anymore.

It would be good to document the changes, done for a specific platform behavior (like the missing broadcast-call of ACTION_DOWNLOAD_COMPLETE), in a pull-request and not just put a commit on master. This will help us to have all these things documented to get back to the initial reason for implementation in case we need to.

Please let me know if you also have the environment to create a new build for all supported platforms (iOS, Android and UWP) and I'll also give you access to nuget. Please provide me your username there as well.