diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e7d0cd..4fc7d8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ ### Changes +# 1.0.1 + +### Fixes + +- [#10](https://github.com/AdamKobus/lifecycle-aware-viewmodel/issues/10) ViewParam now has equals method + # 1.0.0 ### Changes diff --git a/README.md b/README.md index ad39c3b..8581f68 100644 --- a/README.md +++ b/README.md @@ -17,10 +17,10 @@ repositories { dependencies { // LifecycleObserverKtx - implementation "com.adamkobus:lifecycle-observer-ktx:1.0.0" + implementation "com.adamkobus:lifecycle-observer-ktx:1.0.1" // LifecycleObserverKtx + LifecycleAwareViewModel + ViewParam - implementation "com.adamkobus:lifecycle-observer-viewmodel-ktx:1.0.0" + implementation "com.adamkobus:lifecycle-observer-viewmodel-ktx:1.0.1" } ``` @@ -39,10 +39,10 @@ repositories { dependencies { // LifecycleObserverKtx - implementation "com.adamkobus:lifecycle-observer-ktx:1.0.0-SNAPSHOT" + implementation "com.adamkobus:lifecycle-observer-ktx:1.0.1-SNAPSHOT" // LifecycleObserverKtx + LifecycleAwareViewModel + ViewParam - implementation "com.adamkobus:lifecycle-observer-viewmodel-ktx:1.0.0-SNAPSHOT" + implementation "com.adamkobus:lifecycle-observer-viewmodel-ktx:1.0.1-SNAPSHOT" } ``` diff --git a/gradle/publishing-root.gradle b/gradle/publishing-root.gradle index 15b2aea..28781e1 100644 --- a/gradle/publishing-root.gradle +++ b/gradle/publishing-root.gradle @@ -4,7 +4,7 @@ rootProject.ext["adamkobusSonatypeStagingProfileId"] = "" rootProject.ext["snapshot"] = System.getenv().getOrDefault("MAVEN_SNAPSHOT", "true") -def VERSION_BASE = "1.0.0" +def VERSION_BASE = "1.0.1" def VERSION_SUFFIX = "" if (rootProject.ext["snapshot"] == "true") { VERSION_SUFFIX = "-SNAPSHOT" diff --git a/lifecycle-observer-viewmodel-ktx/src/main/java/com/adamkobus/android/vm/ViewParam.kt b/lifecycle-observer-viewmodel-ktx/src/main/java/com/adamkobus/android/vm/ViewParam.kt index 52615a8..1e2700b 100644 --- a/lifecycle-observer-viewmodel-ktx/src/main/java/com/adamkobus/android/vm/ViewParam.kt +++ b/lifecycle-observer-viewmodel-ktx/src/main/java/com/adamkobus/android/vm/ViewParam.kt @@ -41,5 +41,13 @@ class ViewParam { sealed class ViewParamState(val getValue: () -> T) { class Missing : ViewParamState({ throw IllegalStateException("Tried to access the value when it's missing") }) - class Present(val value: T) : ViewParamState({ value }) + class Present(val value: T) : ViewParamState({ value }) { + override fun equals(other: Any?): Boolean { + return other is Present<*> && other.value == value + } + + override fun hashCode(): Int { + return value?.hashCode() ?: 0 + } + } }