I finally got around to test the alpha versions, w...
# mvikotlin
z
I finally got around to test the alpha versions, with an eye on the debug/android artifact publications. I can gladly report that this is now working well, also for Decompose and Essenty. For clarity, the dependency analysis plugin suggested using debug and android artifacts, that had no value. A link to the plugin: https://github.com/autonomousapps/dependency-analysis-gradle-plugin I have a question about the MVIKotlin-Decompose interaction in the thread:
I copied the asValue extension function from one of these channels a while ago. Some of the Value functions were removed due to memory leaks, so I had to change the implementation. It seems to work. Is this a correct implementation though? Is there a better one?
Copy code
package com.babestudios.companyinfouk.shared.ext

import com.arkivanov.decompose.Cancellation
import com.arkivanov.decompose.value.Value
import com.arkivanov.mvikotlin.core.store.Store
import com.arkivanov.mvikotlin.core.rx.Disposable
import com.arkivanov.mvikotlin.core.rx.observer

typealias ValueObserver<T> = (T) -> Unit

fun <T : Any> Store<*, T, *>.asValue(): Value<T> =
	object : Value<T>() {

		private var disposables = emptyMap<ValueObserver<T>, Disposable>()

		override val value: T get() = state

		override fun subscribe(observer: ValueObserver<T>): Cancellation {
			val disposable = states(observer(onNext = observer))
			this.disposables += observer to disposable
			return Cancellation { disposable.dispose() }
		}

	}
Also, here is a link to my project, just in case someone wants to check it out: https://bitbucket.org/babestudios/companies-house
a
Thanks for letting me know! Re: asvalue I think you don't need the
disposables
map. See the impl here.
z
Indeed, thanks
👍 1