diff --git a/README.md b/README.md index afb07c9..191cd16 100644 --- a/README.md +++ b/README.md @@ -21,9 +21,9 @@ And then to the module level `build.gradle.kts`: ``` dependencies { - implementation 'com.revolut.rxdata:dod:1.5.13' - implementation 'com.revolut.rxdata:core:1.5.13' - implementation 'com.revolut.rxdata:scheduler:1.5.13' + implementation 'com.revolut.rxdata:dod:1.5.14' + implementation 'com.revolut.rxdata:core:1.5.14' + implementation 'com.revolut.rxdata:scheduler:1.5.14' } ``` diff --git a/dfd/gradle.properties b/dfd/gradle.properties index ad320a0..ccba211 100644 --- a/dfd/gradle.properties +++ b/dfd/gradle.properties @@ -1,5 +1,5 @@ POM_ARTIFACT_ID=dfd -VERSION_NAME=1.5.13 +VERSION_NAME=1.5.14 POM_NAME=dfd POM_PACKAGING=jar GROUP=com.revolut.flowdata diff --git a/dod-wrapper/gradle.properties b/dod-wrapper/gradle.properties index 816a47d..7da1024 100644 --- a/dod-wrapper/gradle.properties +++ b/dod-wrapper/gradle.properties @@ -1,5 +1,5 @@ POM_ARTIFACT_ID=dod-wrapper -VERSION_NAME=1.5.13 +VERSION_NAME=1.5.14 POM_NAME=dod-wrapper POM_PACKAGING=jar GROUP=com.revolut.rxdata diff --git a/dod/gradle.properties b/dod/gradle.properties index c111629..53df000 100644 --- a/dod/gradle.properties +++ b/dod/gradle.properties @@ -1,5 +1,5 @@ POM_ARTIFACT_ID=dod -VERSION_NAME=1.5.13 +VERSION_NAME=1.5.14 POM_NAME=dod POM_PACKAGING=jar GROUP=com.revolut.rxdata diff --git a/dod/src/main/java/com/revolut/rxdata/dod/DataObservableDelegate.kt b/dod/src/main/java/com/revolut/rxdata/dod/DataObservableDelegate.kt index 510ff17..f9aa24d 100644 --- a/dod/src/main/java/com/revolut/rxdata/dod/DataObservableDelegate.kt +++ b/dod/src/main/java/com/revolut/rxdata/dod/DataObservableDelegate.kt @@ -120,11 +120,17 @@ class DataObservableDelegate constructor( } else { sharedStorageRequest.getOrLoad(params) .flatMapObservable { cached -> + val needToFetchFromNetwork = loadingStrategy.refreshStorage || cached.content == null + val cachedObservable = if (needToFetchFromNetwork) { + just(cached) + } else { + just(cached.copy(loading = false)) + } concat( - just(cached), + cachedObservable, subject ).doAfterSubscribe { - if (loadingStrategy.refreshStorage || cached.content == null) { + if (needToFetchFromNetwork) { fetchFromNetwork(cached.content, params) } } diff --git a/dod/src/test/java/com/revolut/rxdata/dod/DataObservableDelegateTest.kt b/dod/src/test/java/com/revolut/rxdata/dod/DataObservableDelegateTest.kt index 0cdff23..4b2e0a9 100644 --- a/dod/src/test/java/com/revolut/rxdata/dod/DataObservableDelegateTest.kt +++ b/dod/src/test/java/com/revolut/rxdata/dod/DataObservableDelegateTest.kt @@ -864,7 +864,7 @@ class DataObservableDelegateTest : BaseDataObservableDelegateTest() { ioScheduler.triggerActions() testObserver.assertValueCount(2) - testObserver.assertValueAt(1, Data(content = cachedDomain, error = null, loading = true)) + testObserver.assertValueAt(1, Data(content = cachedDomain, error = null, loading = false)) ioScheduler.triggerActions() diff --git a/flow-extensions/gradle.properties b/flow-extensions/gradle.properties index a81ed18..a91f5dd 100644 --- a/flow-extensions/gradle.properties +++ b/flow-extensions/gradle.properties @@ -1,5 +1,5 @@ POM_ARTIFACT_ID=extensions -VERSION_NAME=1.5.13 +VERSION_NAME=1.5.14 POM_NAME=flow-core POM_PACKAGING=jar GROUP=com.revolut.flowdata diff --git a/model/gradle.properties b/model/gradle.properties index 73a348d..1e63c7c 100644 --- a/model/gradle.properties +++ b/model/gradle.properties @@ -1,5 +1,5 @@ POM_ARTIFACT_ID=model -VERSION_NAME=1.5.13 +VERSION_NAME=1.5.14 POM_NAME=data POM_PACKAGING=jar GROUP=com.revolut.data diff --git a/rx-extensions/gradle.properties b/rx-extensions/gradle.properties index a78437a..5a64e35 100644 --- a/rx-extensions/gradle.properties +++ b/rx-extensions/gradle.properties @@ -1,5 +1,5 @@ POM_ARTIFACT_ID=extensions -VERSION_NAME=1.5.13 +VERSION_NAME=1.5.14 POM_NAME=core POM_PACKAGING=jar GROUP=com.revolut.rxdata diff --git a/scheduler/gradle.properties b/scheduler/gradle.properties index 9950add..70134b8 100644 --- a/scheduler/gradle.properties +++ b/scheduler/gradle.properties @@ -1,5 +1,5 @@ POM_ARTIFACT_ID=scheduler -VERSION_NAME=1.5.13 +VERSION_NAME=1.5.14 POM_NAME=scheduler POM_PACKAGING=aar GROUP=com.revolut.rxdata