From 4207104cf782713ac8f06247cfccca231d399710 Mon Sep 17 00:00:00 2001 From: Aleksey Mikhailov Date: Wed, 30 Oct 2019 13:53:27 +0700 Subject: [PATCH 1/2] allow call ViewModel.onCleared from outside (for ios kotlin) --- .../kotlin/dev/icerock/moko/mvvm/viewmodel/ViewModel.kt | 2 +- .../kotlin/dev/icerock/moko/mvvm/viewmodel/ViewModel.kt | 2 +- .../iosMain/kotlin/dev/icerock/moko/mvvm/viewmodel/ViewModel.kt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mvvm/src/androidMain/kotlin/dev/icerock/moko/mvvm/viewmodel/ViewModel.kt b/mvvm/src/androidMain/kotlin/dev/icerock/moko/mvvm/viewmodel/ViewModel.kt index 382d8edf..6eedd4af 100644 --- a/mvvm/src/androidMain/kotlin/dev/icerock/moko/mvvm/viewmodel/ViewModel.kt +++ b/mvvm/src/androidMain/kotlin/dev/icerock/moko/mvvm/viewmodel/ViewModel.kt @@ -13,7 +13,7 @@ actual open class ViewModel actual constructor() : ViewModel() { // for now dispatcher fixed on Main. after implementing multithread coroutines on native - we can change it protected actual val viewModelScope: CoroutineScope = CoroutineScope(Dispatchers.Main) - actual override fun onCleared() { + public actual override fun onCleared() { super.onCleared() viewModelScope.cancel() diff --git a/mvvm/src/commonMain/kotlin/dev/icerock/moko/mvvm/viewmodel/ViewModel.kt b/mvvm/src/commonMain/kotlin/dev/icerock/moko/mvvm/viewmodel/ViewModel.kt index 9eeac9f9..3165dbce 100644 --- a/mvvm/src/commonMain/kotlin/dev/icerock/moko/mvvm/viewmodel/ViewModel.kt +++ b/mvvm/src/commonMain/kotlin/dev/icerock/moko/mvvm/viewmodel/ViewModel.kt @@ -9,5 +9,5 @@ import kotlinx.coroutines.CoroutineScope expect open class ViewModel() { protected val viewModelScope: CoroutineScope - protected open fun onCleared() + open fun onCleared() } diff --git a/mvvm/src/iosMain/kotlin/dev/icerock/moko/mvvm/viewmodel/ViewModel.kt b/mvvm/src/iosMain/kotlin/dev/icerock/moko/mvvm/viewmodel/ViewModel.kt index 19168a2c..d98744bf 100644 --- a/mvvm/src/iosMain/kotlin/dev/icerock/moko/mvvm/viewmodel/ViewModel.kt +++ b/mvvm/src/iosMain/kotlin/dev/icerock/moko/mvvm/viewmodel/ViewModel.kt @@ -11,7 +11,7 @@ actual open class ViewModel actual constructor() { // for now dispatcher fixed on Main. after implementing multithread coroutines on native - we can change it protected actual val viewModelScope: CoroutineScope = CoroutineScope(UIDispatcher()) - protected actual open fun onCleared() { + actual open fun onCleared() { viewModelScope.cancel() } } From 3e00d9247ce95162fd990986c32b9bf8a5fc0ed5 Mon Sep 17 00:00:00 2001 From: Aleksey Mikhailov Date: Wed, 30 Oct 2019 13:53:37 +0700 Subject: [PATCH 2/2] version up --- README.md | 5 +++-- buildSrc/src/main/kotlin/Versions.kt | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a956bf08..4322ee2e 100755 --- a/README.md +++ b/README.md @@ -31,6 +31,7 @@ This is a Kotlin Multiplatform library that provides architecture components of - 0.1.0 - 0.2.0 - 0.3.0 + - 0.3.1 ## Installation root build.gradle @@ -45,7 +46,7 @@ allprojects { project build.gradle ```groovy dependencies { - commonMainApi("dev.icerock.moko:mvvm:0.3.0") + commonMainApi("dev.icerock.moko:mvvm:0.3.1") } ``` @@ -56,7 +57,7 @@ enableFeaturePreview("GRADLE_METADATA") On iOS, in addition to the Kotlin library add in Podfile ```ruby -pod 'MultiPlatformLibraryMvvm', :git => 'https://github.com/icerockdev/moko-mvvm.git', :tag => 'release/0.3.0' +pod 'MultiPlatformLibraryMvvm', :git => 'https://github.com/icerockdev/moko-mvvm.git', :tag => 'release/0.3.1' ``` **`MultiPlatformLibraryMvvm` CocoaPod requires that the framework compiled from Kotlin be named `MultiPlatformLibrary` and be connected as a CocoaPod `MultiPlatformLibrary`. diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index d2271e84..b35e8cdf 100755 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -22,7 +22,7 @@ object Versions { const val coroutines = "1.3.0" const val mokoCore: String = "0.1.0" const val mokoResources: String = "0.3.0" - const val mokoMvvm: String = "0.3.0" + const val mokoMvvm: String = "0.3.1" } } } \ No newline at end of file