smanikandan14 / ThinDownloadManager

To download files and to avoid using DOWNLOAD_WITHOUT_NOTIFICATION permission if you are using Android's DownloadManager in your apps.
Apache License 2.0
783 stars 185 forks source link

DownloadManager.release() logic bug #69

Closed ghost closed 7 years ago

ghost commented 8 years ago

I want to give a PR, but build by error: Error:(3, 0) Cause: org/gradle/api/publication/maven/internal/DefaultMavenFactory

The code logic seens error by that: When I call downloadManager.release(), I mean to release the resources. But the DownloadDispatcher delete the files which has always been downloaded. Correct it by judge the download state:

if (mQuit) {                                                                                             
    if(mRequest != null) {                                                                               
        mRequest.finish();                                                                               

        // don't remove files that have been downloaded sucessfully.                                                                                                
        if(mRequest.getDownloadState() != DownloadManager.STATUS_SUCCESSFUL) {                         
            updateDownloadFailed(DownloadManager.ERROR_DOWNLOAD_CANCELLED, "Download cancelled");        
        }                                                                                                
        mTimer.cancel();                                                                                 
    }                                                                                                    
    return;                                                                                              
}                                                                                                        
continue;                                                                                                
}                                                                                                       
smanikandan14 commented 8 years ago

Valid. Will add this check. Thanks.

smanikandan14 commented 7 years ago

Fixed. Part of 1.2.7 version. Thanks.