Fetch: Simplify Start/Resume/Retry, Cancel/Pause!

Created on 26 Nov 2018  路  5Comments  路  Source: tonyofrancis/Fetch

Some times Resume/Retry are confusing, if wrongly called, downloads won't work.
The library looks simple & neat, so the calls should be.

For example,
Just one call to initiate a download : Start() - It resumes/retries if already exists, or start a new download.
One call to stop a download: Stop()
Same with REMOVED/DELETED.
You do all internal wirings! So we don't have to check if it is cancelled or paused, blah blahs!

We can check the status of a download, also we can find if a download exist, so no problem with that. You can take a look at this library : https://github.com/lingochamp/okdownload

enhancement question

All 5 comments

@jpvs0101 A start method can work with Resume/Retry and renaming the enqueue method to start can work.
The issue I see is with the stop method. A stop method that pauses makes sense. But a stop method for delete or remove does not.

  1. Remove and delete methods currently have a clear meaning of what their actions will do as destructive methods. Remove only removes the request entry from the database. Delete removes the entry from the database but also deletes the associated downloaded file. The library cannot make a decision on those because they have different side effects so to speak.

Open to suggestions and debate.

I just give you a overview & pointed a library for reference,

The thing is, simplified calls makes life easier, code will be more
readable & error free.

I agree with remove/ delete, but you should have named like remove(),
removeWithFile(). Now read it. More clear right? Even you can simplified
further like two overloaded functions.
remove() - Just remove entry
remove(boolean) - Pass true to delete file also.
Now it is one call.So we can remember easily, now life is easy ;)

Don't make different calls for slight variations.

start(URL, pathUri) - New download
start(int id) - Resume/ retry

stop(int id) - Pause (for resumable downloads) / stop

remove (id) - just remove entry
remove(id, true) - with file

So basically you just need to remember only 3 names, no mess! Plan the same
for any other stuff!

Now life is simplified!馃槑

Looking into this for version 2.4.0 as it is an enhancement feature not bug fixes. Closing this ticket.

After careful review. This enhancement will not be added to 2.4.0.
Reason: No large support or indication from users of the library that enqueue, resume, pause, delete and remove methods are unclear for their uses.

May be in future... lol... :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DeevD picture DeevD  路  3Comments

VitorAndrioli picture VitorAndrioli  路  4Comments

DeevD picture DeevD  路  3Comments

emerging-coders picture emerging-coders  路  3Comments

Xenolion picture Xenolion  路  4Comments