Closed JohnBuhanan closed 2 years ago
Hi @JohnBuhanan
Do you know why it is not working without reflection of ScreenRegistry?
@ynsok I think there is type-erasure happening with the way I do Routing :(
Maybe there is a better way to do routing from ViewModel.
Generally, I think it should be enough, and solve our problem. What do you think? @adrielcafe @DevSrSouza @JohnBuhanan
fun get(provider: ScreenProvider): Screen {
val factory =
factories[provider::class] ?: error("ScreenProvider not registered: ${provider::class.qualifiedName}")
return factory(provider)
}
@ynsok
You are saying we should add that function to ScreenRegistry
?
I think you're right. That would make it so I don't have to do reflection.
I wonder how @adrielcafe feels about navigating from the ViewModel though?
I think it is highly desirable, but others might see it as an anti-pattern.
I've implemented the @ynsok suggestion in 1.0.0-beta16, please reopen the issue if that was not enough.
About navigating from ViewModel/ScreenModel or any other class, I like the idea, some times that kind of logic is too complex and should not be in the UI layer. Feel free to open another issue about that, I'll start to think about an implementation.
Hi @adrielcafe, I wanted to show you my sample app I made with Voyager: https://github.com/JohnBuhanan/MVI-Public
I studied a dozen github repos and felt like yours was closest to what I wanted.
Three things I thought you might find interesting:
api
gradle module and animpl
gradle module. Theimpl
s can be commented out fromsettings.gradle
andapp.gradle
to unload them from Android Studio indexing and gradle builds. This allows scaling for massively multi-module apps.Biggest thing I am thinking about now is best way to "navigate for result".