Skip to content

Commit 21b1d14

Browse files
committed
update change log
1 parent b6fa382 commit 21b1d14

File tree

4 files changed

+24
-14
lines changed

4 files changed

+24
-14
lines changed

CHANGELOG

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
Version 2.2.0-RC16
2+
- Enqueue Action bug fixes
3+
14
Version 2.2.0-RC15
25
- Network state check improvements.
36
- Fetch.getHasActiveDownloads() should now report accurately.

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
[![Build Status](https://travis-ci.org/tonyofrancis/Fetch.svg?branch=v2)](https://travis-ci.org/tonyofrancis/Fetch)
3-
[ ![Download](https://api.bintray.com/packages/tonyofrancis/maven/fetch2/images/download.svg?version=2.2.0-RC15) ](https://bintray.com/tonyofrancis/maven/fetch2/2.2.0-RC15/link)
3+
[ ![Download](https://api.bintray.com/packages/tonyofrancis/maven/fetch2/images/download.svg?version=2.2.0-RC16) ](https://bintray.com/tonyofrancis/maven/fetch2/2.2.0-RC16/link)
44
[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Android%20Networking-blue.svg?style=flat)](https://android-arsenal.com/details/1/5196)
55
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/tonyofrancis/Fetch/blob/master/LICENSE)
66

@@ -48,7 +48,7 @@ How to use Fetch
4848
Using Fetch is easy! Just add the Gradle dependency to your application's build.gradle file.
4949

5050
```java
51-
implementation "com.tonyodev.fetch2:fetch2:2.2.0-RC15"
51+
implementation "com.tonyodev.fetch2:fetch2:2.2.0-RC16"
5252
```
5353

5454
Next, get an instance of Fetch and request a download.
@@ -214,7 +214,7 @@ to use the OkHttp Downloader instead. You can create your own custom downloaders
214214
if necessary. See the Java docs for details.
215215

216216
```java
217-
implementation "com.tonyodev.fetch2okhttp:fetch2okhttp:2.2.0-RC15"
217+
implementation "com.tonyodev.fetch2okhttp:fetch2okhttp:2.2.0-RC16"
218218
```
219219
Set the OkHttp Downloader for Fetch to use.
220220
```java
@@ -235,7 +235,7 @@ If you would like to take advantage of RxJava2 features when using Fetch,
235235
add the following gradle dependency to your application's build.gradle file.
236236

237237
```java
238-
implementation "com.tonyodev.fetch2rx:fetch2rx:2.2.0-RC15"
238+
implementation "com.tonyodev.fetch2rx:fetch2rx:2.2.0-RC16"
239239
```
240240

241241
RxFetch makes it super easy to enqueue download requests and query downloads using rxJava2 functional methods.
@@ -271,7 +271,7 @@ added in the coming days.
271271

272272
Start using FetchFileServer by adding the gradle dependency to your application's build.gradle file.
273273
```java
274-
implementation "com.tonyodev.fetch2fileserver:fetch2fileserver:2.2.0-RC15"
274+
implementation "com.tonyodev.fetch2fileserver:fetch2fileserver:2.2.0-RC16"
275275
```
276276

277277
Start a FetchFileServer instance and add resource files that it can server to connected clients.
@@ -380,7 +380,7 @@ Fetch1 Migration
380380

381381
Migrate downloads from Fetch1 to Fetch2 using the migration assistant. Add the following gradle dependency to your application's build.gradle file.
382382
```java
383-
implementation "com.tonyodev.fetchmigrator:fetchmigrator:2.2.0-RC15"
383+
implementation "com.tonyodev.fetchmigrator:fetchmigrator:2.2.0-RC16"
384384
```
385385

386386
Then run the Migrator.

fetch2/src/main/java/com/tonyodev/fetch2/fetch/FetchHandlerImpl.kt

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,19 @@ class FetchHandlerImpl(private val namespace: String,
7878

7979
private fun prepareDownloadInfoForEnqueue(downloadInfo: DownloadInfo): Boolean {
8080
cancelDownloadsIfDownloading(listOf(downloadInfo.id))
81-
val existingDownload = databaseManager.getByFile(downloadInfo.file)
81+
var existingDownload = databaseManager.getByFile(downloadInfo.file)
8282
if (existingDownload == null) {
8383
createFileIfPossible(File(downloadInfo.file))
84-
} else if (existingDownload.status == Status.DOWNLOADING) {
85-
existingDownload.status = Status.QUEUED
86-
try {
87-
databaseManager.update(existingDownload)
88-
} catch (e: Exception) {
84+
} else {
85+
cancelDownloadsIfDownloading(listOf(existingDownload.id))
86+
existingDownload = databaseManager.getByFile(downloadInfo.file)
87+
if (existingDownload != null && existingDownload.status == Status.DOWNLOADING) {
88+
existingDownload.status = Status.QUEUED
89+
try {
90+
databaseManager.update(existingDownload)
91+
} catch (e: Exception) {
8992

93+
}
9094
}
9195
}
9296
return when (downloadInfo.enqueueAction) {
@@ -106,6 +110,9 @@ class FetchHandlerImpl(private val namespace: String,
106110
throw FetchException(REQUEST_WITH_FILE_PATH_ALREADY_EXIST)
107111
}
108112
EnqueueAction.REPLACE_EXISTING -> {
113+
if (existingDownload != null) {
114+
deleteDownloads(listOf(existingDownload.id))
115+
}
109116
deleteDownloads(listOf(downloadInfo.id))
110117
return false
111118
}

versions.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ ext {
1616
rxAndroid2_version = "2.1.0"
1717
timber_version = "4.7.1"
1818
novoda_bintray_version = "0.8.1"
19-
library_version = "2.2.0-RC15"
20-
library_version_code = 53
19+
library_version = "2.2.0-RC16"
20+
library_version_code = 54
2121
}

0 commit comments

Comments
 (0)