Releases: tonyofrancis/Fetch
3.0.5
Version 3.0.5
This release only adds a new Feature that allows Fetch to auto retry failed downloads for any reason. Set the number of times Fetch will auto retry a download when it fails.
This feature if off by default.
- New fields added on Download: autoRetryMaxAttempts and autoRetryAttempts. See Java docs.
- New field added on RequestInfo: autoRetryMaxAttempts. See Java docs.
- New method added on Fetch: fun resetAutoRetryAttempts(downloadId: Int, retryDownload: Boolean = true, func: Func2<Download?>? = null, func2: Func? = null): Fetch
- New method added on RXFetch: fun resetAutoRetryAttempts(downloadId: Int, retryDownload: Boolean = true): Convertible<Download?>
- New method added on FetchConfiguration: fun setAutoRetryMaxAttempts(autoRetryMaxAttempts: Int): Builder. See Java Docs
final FetchConfiguration fetchConfiguration = new FetchConfiguration.Builder(this)
.enableRetryOnNetworkGain(true)
.setDownloadConcurrentLimit(2)
.setAutoRetryMaxAttempts(10) // set global auto retry max attempts for all downloads.
.build();
final Fetch fetch = Fetch.Impl.getInstance(fetchConfiguration);
//OR
final String url = "dummy url";
final String file = "dummy file";
final Request request = new Request(url, file);
request.setAutoRetryMaxAttempts(5); // set auto retry on individual downloads.
fetch.getDownload(request.getId(), download -> {
if (download != null) {
download.getAutoRetryAttempts(); //get the number of auto retry attempts.
download.getAutoRetryMaxAttempts(); //get the number of max attempts.
}
});
//reset the auto retry attempts for a download
fetch.resetAutoRetryAttempts(request.getId(), true, null, null);
3.0.4
Version 3.0.4
- updated documentation
- remove has activeDownloads(): Boolean method. Use fun hasActiveDownloads(includeAddedDownloads: Boolean, func: Func): Fetch or fun addActiveDownloadsObserver(includeAddedDownloads: Boolean = false, fetchObserver: FetchObserver): Fetch instead.
- Added new methods on Fetch addActiveDownloadsObserver(includeAddedDownloads: Boolean = false, fetchObserver: FetchObserver): Fetch and removeActiveDownloadsObserver(fetchObserver: FetchObserver): Fetch
- Added new method on FetchConfiguration fun setHasActiveDownloadsCheckInterval(intervalInMillis: Long): Builder
- Added new REPORTING option on Reason enum
- Added new method on FetchConfiguration fun createDownloadFileOnEnqueue(create: Boolean): Builder
- Fix for starting download immediately whiles enqueuing
3.0.3
Version 3.0.3
- Bug fixes for hasActiveDownloads method.
- Download url redirection fixes and improvements
- Added internet check method to FetchConfiguration called setInternetAccessUrlCheck(url: String?): Builder
See documentation on usage. - Added new fields redirected and redirectedUrl on Downloader.ServerRequest class.
3.0.2
Version 3.0.2
- Added Wrapper class around FetchDatabase to provide safer access
- Added Priority Sort to change the way Fetch queues downloads based on time created.
Note: Fetch 3.1.0 Will be the next big release. The library will be migrating to AndroidX packages.
Point releases will be created for the none AndroidX version of the library.
3.0.1
Version 3.0.1
- Added new method hasActiveDownloads(includeAddedDownloads: Boolean, func: Func)
3.0.0
Version 3.0.0
Version 3 comes with a lot of enhancements and fixes
Fetch:
-
FetchGroupListener. FetchGroupListener extends from FetchListener and allows you to listener for
updates on a group. The methods on FetchGroupListener will return a FetchGroup object that contains
all the downloads in a group and will inform you which download triggered a change on the group. Also see AbstractFetchGroupListener. -
Added new method to rename a completed download's file. see Fetch.renameCompletedDownloadFile method.
Observers:
-
Introducing FetchObserver. Fetch now allows you to subscribe from updates for a single Download or a Group of Downloads.
Using the FetchObserver and FetchGroupObserver interface respectively. See Fetch.attachFetchObserversForDownload(id, observers...) documentation
for more information. Also check the sample app for usage. -
Introducing FetchGroup. FetchGroup is an object that contains all information about a group Fetch manages. The group is
automatically updated any time a download from the group updates. You can subscribe to FetchGroup's using the FetchGroupObserver.
FetchGroupObservers attached to a FetchGroup will be notified when downloads on a group changes. You will be notified of
the Reason for the change as well. See Fetch.getFetchGroup(id, callback) documentation for more information.Database:
-
Fetch now allows you to provide your own database manager to manage downloads. See the FetchDatabaseManager documentation and
FetchConfiguration.Builder class to get started. Note: Fetch depends on your FetchDatabaseManager methods to be synchronized to work correctly.Download:
-
Added new fields on the Download objects. Fields: etaInMilliSeconds, downloadedBytesPerSecond. See documentation.
Fixes & Small Improvements:
-
You can now set the Handler Fetch will use to perform all operations on. See FetchConfiguration.Builder.setHandler method.
-
Fixed a bug that prevented notification buttons (pause, cancel, resume, etc) from firing the intent.
2.3.6
Version 2.3.6
- Out of Memory Error. Fixed issued in the downloader where an out of memory error would occur.
2.3.5
Version 2.3.5
- Fetch methods removeAllInGroupWithStatus, deleteAllInGroupWithStatus, getDownloadsInGroupWithStatus
have been updated to allow more than one Status to be queried or actioned upon. See Java doc for details
. Special thanks to Marcin Adamczewski for submitting PR. - Fetch logging is now disabled by default and can be enabled with the FetchConfiguration method.
.enableLogging(true)
- The Error enum object now has a new field attach
httpResponse
. This response object contains the HttpCode and other
http related information. This field is only provided when an error occurs and it is related to the Http response. - Fixed EnqueueAction.UPDATE_ACCORDINGLY that caused the onComplete listener method to be called if the newly enqueued request
was previously downloaded and completed but the file on the storage system was delete.
2.3.4
Version 2.3.4
- Added default cookie manager for the okhttp and httpurlconnection client Downloaders.
- Fixed an EnqueueAction.INCREMENT_FILE_NAME bug where files were not properly created.
- Download, Request, DownloadBlock and other data classes now extend Serializable.
- Okhttp and HttpUrlConnection clients now add a default Referer header to each request if
one is not provided. Default Referer is the host of the url passed in the request. - Behavior change and Updates for ActiveDownloads method on Fetch. The ActiveDownload method
can now only be called on threads other than the Main(UI) Thread. The ActiveDownload method
now correctly return true if there are active downloads. Downloads with a queued or Downloading status.
Note: Calling this method on a UI thread will throw a FetchException. - Added new awaitFinish methods on Fetch. The awaitFinish method blocks the current non UI thread
until Fetch has completed all enqueued downloads. The awaitFinishTimeout method takes in a time in milliseconds
to release the hold if Fetch has not completed all downloads in the allocated timeframe.
Passing 0 to the awaitFinishTimeout method will hold the thread indefinitely(Never releasing).
Recommend to use the awaitFinishTimeout method inside Android Workers and release the task when a certain amount of time has passed. See Java docs for details.
Note: Calling this method on a UI thread will throw a FetchException.
2.3.3
Version 2.3.3
- Fixed return type of Downloader interface method onPreClientExecute. Now returns Void correctly.