Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect way to handle completed. #5

Open
cbnewham opened this issue Aug 9, 2018 · 1 comment
Open

Incorrect way to handle completed. #5

cbnewham opened this issue Aug 9, 2018 · 1 comment

Comments

@cbnewham
Copy link

cbnewham commented Aug 9, 2018

Unfortunately you are handling the removal of the latch incorrectly by placing this line:

if (bytesCurrent == bytesTotal)

in onProgressChanged. This won't work correctly because sometimes the initial call by the Transfer manager gives the total as 0 out of 0 bytes which in turn means you are removing the latch and returning a file of 0 bytes in size, even though the download has not completed, which in turn causes Picasso to either retry the download or fail, depending on how fast the retry is.

You need to handle the latch countdown in onStateChanged(). This method reports when the download has completed or has been cancelled.

@agap
Copy link
Owner

agap commented Dec 13, 2018

Hello! Unfortunately I don't have time to work on that project currently, but PRs are always welcome - if you've fixed this issue already, please send me a PR and I'll review it as soon as I can.
Thanks for the help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants