-
Notifications
You must be signed in to change notification settings - Fork 841
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Discussion]: Introducing MviBaseIOPresenter #247
Comments
I find it very strange if observables (like the above) are created on Activity/Fragment/View. Observable<InputEvents> inputs = Observable.merge(loadingEvent, pullToRefreshEvent); I can't think how you can write tests if you have observables with operators like One of the most interesting part of the talk is the part with the Actions, transformers etc which can be useful for LCE. Τhis can lead Mosby for a new Redux module. |
I thought it back yesterday. If you rename Input and Output to Source and Sink respectively, it reminds to me cycle.js, don't you think so? @sockeqwe |
Yes ... I thought naming it input / output is slightly easier to wrap your head around, but I'm definitely open for better naming suggestions. This is by no means a fixed API proposal. However, I didn't wanted to make it to cyclish 😄 nor I want to introduce the concept of Drivers as cycle does. I'm not saying, that concepts of cycle like Drivers are not a good idea, I just don't want to go into the direction of a framework. I would rather just provide a simple "entry point" (kind of) and then its up to you how you want to implement your stuff, i.e. cyclish with drivers ... |
👍 on the new presenter, and input / output seems straight forward to me. |
recently I came across Andre Staltz's presentation talking about |
I think there is one good reason to implement this idea: We could leave the lot of boring PublishSubjects from the view (and interface of view) which are presents for every actions. Oh and one more. As I wrote in an another issue, I believe it's can be necessary to unsubscribe from a few heavy resources when we navigate to another screen and rescubscribe on resume. With own lifecyclehandling it seems more easy to do this. @sockeqwe With your example it seems more like MVVM, not MVP. Or not? Only the view knows the presenter, presenter doesn't need to have reference to the view. "Basically, Mosby will just be used to keep presenter through screen orientation changes." |
Thanks for your feedback!
Not sure if I have understood that correctly but right now you can do the same: interface MyView extends MvpView {
Observable<Intent> intents()
void render(MyState state)
} Then you would have just one Observable where you pipe all your view Intent's through. Nobody said you have to define an "intent-method" for each intent.
Not sure if that will solve that problem because
Yes, that is correct. Overall, yes, I will start to work on that soon. |
Maybe we should add another Presenter for MVI that comes closer to the idea what Jake Wharton presented here:
http://jakewharton.com/the-state-of-managing-state-with-rxjava/
The idea is to have an
Input / Output Presenter
something like:Usage:
This issue is just for brain storming and idea sharing.
Basically, Mosby will just be used to keep presenter through screen orientation changes. Since
presenter.output
is a BehaviorRelay latest "ViewState" will be automatically resubmitted after screen orientation change.Lifecycle Management of Disposables must be done manually.
We could provide such a Presenter, although I personally like more the current approach of
MviBasePresenter
but you know ... Jake Wharton is a smart guy ... Maybe he (or someone else using Mosby) sees some advantages with this implementation ... it's definitely a little less "black magic" compared toMviBasePresenter
.Any feedback is very welcome!
The text was updated successfully, but these errors were encountered: