Zhuinden / simple-stack

[ACTIVE] Simple Stack, a backstack library / navigation framework for simpler navigation and state management (for fragments, views, or whatevers).
Apache License 2.0
1.36k stars 75 forks source link

DialogFragment and BottomDialogFragment as part of navigation stack, question #276

Open uberchilly opened 1 year ago

uberchilly commented 1 year ago

Hello, I've read all of the other issues about this topic like https://github.com/Zhuinden/simple-stack/issues/250 where you mentioned some solutions, btw is there a complete demo project with these solutions somewhere to be looked at? You also mentioned that you historically used for example BottomSheetDialogFragment with .show(fragmentManager) to simplify, but I am not sure how would you then bindServices to add dependencies for example for ViewModels that will be used for that BottomSheetDialogFragment or DialogFragment since they kind of live outside of the scoped services in that case, we could maybe connect that dialog to jetpack's ViewModel and inject global services from the application via factory but we then again have 2 different worlds of view models

Zhuinden commented 1 year ago

we could maybe connect that dialog to jetpack's ViewModel and inject global services from the application via factory but we then again have 2 different worlds of view models

In a real project, this is exactly what I did.

It was easier to reason about than making the DialogFragment dismiss update the backstack. Then again, I didn't actually try that approach.

Zhuinden commented 1 year ago

image

Even Jetpack Navigation has trouble making this work 🤔