Skip to content

Commit

Permalink
Added new method getNewFetchInstanceFromConfiguration
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyofrancis committed Jun 17, 2018
1 parent 3e737ba commit ad5ef48
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ Version 2.1.0-RC5
This option allows Fetch to notify the newly attached listener instantly of the download status
of all downloads managed by the namespace. Default is false.
- Added new Fetch and RxFetch method getDownloadsByRequestIdentifier(identifier: Long). Use request.identifier field.
- Added new convenience method on FetchConfiguration class called getNewFetchInstanceFromConfiguration which
returns a newly created instance of Fetch.
- Updated Kotlin plugin version to 1.2.50
- Updated other library dependencies.
- Bug Fixes

Version 2.1.0-RC4
- Added new method enableListenerNotifyOnAttached(enabled) to FetchConfiguration.Builder class.
Expand Down
13 changes: 12 additions & 1 deletion fetch2/src/main/java/com/tonyodev/fetch2/FetchConfiguration.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ class FetchConfiguration private constructor(val appContext: Context,
val fileServerDownloader: FileServerDownloader?,
val md5CheckingEnabled: Boolean) {

/* Creates a new Instance of Fetch with this object's configuration settings. Convenience method
* for Fetch.Impl.getInstance(fetchConfiguration)
* @return new Fetch instance
* */
fun getNewFetchInstanceFromConfiguration(): Fetch {
return Fetch.getInstance(this)
}

/** Used to create an instance of Fetch Configuration.*/
class Builder(context: Context) {

Expand Down Expand Up @@ -240,6 +248,7 @@ class FetchConfiguration private constructor(val appContext: Context,
if (autoStart != other.autoStart) return false
if (retryOnNetworkGain != other.retryOnNetworkGain) return false
if (fileServerDownloader != other.fileServerDownloader) return false
if (md5CheckingEnabled != other.md5CheckingEnabled) return false
return true
}

Expand All @@ -256,6 +265,7 @@ class FetchConfiguration private constructor(val appContext: Context,
result = 31 * result + autoStart.hashCode()
result = 31 * result + retryOnNetworkGain.hashCode()
result = 31 * result + (fileServerDownloader?.hashCode() ?: 0)
result = 31 * result + md5CheckingEnabled.hashCode()
return result
}

Expand All @@ -264,7 +274,8 @@ class FetchConfiguration private constructor(val appContext: Context,
"concurrentLimit=$concurrentLimit, progressReportingIntervalMillis=$progressReportingIntervalMillis," +
" downloadBufferSizeBytes=$downloadBufferSizeBytes, loggingEnabled=$loggingEnabled, " +
"httpDownloader=$httpDownloader, globalNetworkType=$globalNetworkType, logger=$logger, " +
"autoStart=$autoStart, retryOnNetworkGain=$retryOnNetworkGain, fileServerDownloader=$fileServerDownloader)"
"autoStart=$autoStart, retryOnNetworkGain=$retryOnNetworkGain, " +
"fileServerDownloader=$fileServerDownloader, md5CheckingEnabled=$md5CheckingEnabled)"
}

}

0 comments on commit ad5ef48

Please sign in to comment.