use of zlc.season.rxdownload2.entity.SingleMission in project RxDownload by ssseasonnn.
the class DownloadService method deleteDownload.
/**
* Delete download.
* <p>
* Delete a url or all tasks belonging to missionId.
*
* @param url url or missionId
* @param deleteFile whether delete file
*/
public void deleteDownload(String url, boolean deleteFile) {
DownloadMission mission = missionMap.get(url);
if (mission != null && mission instanceof SingleMission) {
mission.delete(dataBaseHelper, deleteFile);
missionMap.remove(url);
} else {
createProcessor(url, processorMap).onNext(normal(null));
if (deleteFile) {
DownloadRecord record = dataBaseHelper.readSingleRecord(url);
if (record != null) {
deleteFiles(getFiles(record.getSaveName(), record.getSavePath()));
}
}
dataBaseHelper.deleteRecord(url);
}
}
Aggregations