Closed tseglevskiy closed 6 years ago
Small update. I thought about this a little. Possible requirement of schedulers in layer with presenters and controllers is not an issue: any code can manage their multithreading. And that mechanics often is OS-dependent. So I create thread manager and provide it to upper layers.
Anyway, I'd like to listen your comments.
Also I see another issue. The Mosby MVI library brings to layer with presenters lots of Android-specific libraries. I'd like to have Mosby in two parts: first one will contain interfaces for presenters and views, and I can use it in layer with presenters, second one will contain implementation of framework, and it will be safe in Android-specific layer.
What do you think?
Oh, you already did it. I reread tree of dependencies and found the mvi-common
module. It is exactly what I ask. So now my layer with presenters is clean. Thank you. :)
So this can be closed, right?
If not, feel free to reopen it
I'm trying to split the app to layer according Clean architecture principles. As I understand these principles, layer with presenters should know nothing about what kind of UI we use. So I created module for that layer as Java library (not Android library). After that I realized that I can not set observation of view state in main thread, because presented has no access to android-specific libraries (yet), but method in view don't manage its thread (too late to do it there).
https://github.com/sockeqwe/mosby/blob/master/sample-mvi/src/main/java/com/hannesdorfmann/mosby3/sample/mvi/view/home/HomePresenter.java#L88
So my question - possible the good place to manage the thread is in the MVI framework, nor in the presenter?