badoo / MVICore

MVI framework with events, time-travel, and more
https://badoo.github.io/MVICore/
Other
1.27k stars 90 forks source link

Fixed Bootstrapper variance #150

Closed MaximPestryakov closed 3 years ago

MaximPestryakov commented 3 years ago

Now, when I want to do something like this:

private class BootstrapperImpl(
    private val dataSource: DataSource,
) : Bootstrapper<Action> {
    override fun invoke(): Observable<Action> =
        dataSource
            .observe()
            .map { Action.NameChanged(it.name) }
            .distinctUntilChanged()
}

I need to explicitly specify .map generic type:

.map<Action> { Action.NameChanged(it.name) }
.distinctUntilChanged()

So, generic Action in Bootstrapper should be covariant (like Actor) to be more flexible in such cases

MaximPestryakov commented 3 years ago

@CherryPerry Could you take a look, please?

CherryPerry commented 3 years ago

Looks good, thanks for your contribution. I can't say when I can finish with https://github.com/badoo/MVICore/pull/147 to release new version, but you can always use JitPack build based on commit revision.