novoda / download-manager

A library that handles long-running downloads, handling the network interactions and retrying downloads automatically after failures
Apache License 2.0
483 stars 63 forks source link

DownloadBatchStatusCallback #489

Open Mecharyry opened 5 years ago

Mecharyry commented 5 years ago

Problem

As mentioned in #488 we have DownloadBatchStatusCallback that returns a copy of an underlying DownloadBatchStatus, we then need to grab the "real" instance from the Map in order to update the notificationSeen when dispatching notifications.

Ideally we should make the cloning that we perform more explicit. At the moment we do not clone in the File downloader but we do in the batch, this is done for a reason but it is not documented. FYI it's done because the file callback is owned by us but the callback from the DownloadBatch forwards to the client.

We are forced to use DownloadBatchStatus in places where we require InternalDownloadBatchStatus.

Solution