forma icon indicating copy to clipboard operation
forma copied to clipboard

New navigation system

Open michaem opened this issue 3 years ago • 2 comments

Our sample uses Jetpack Navigation. It brought some strong dependencies through whole project, such as

HomeFragment.kt
...
val navController = viewBinding.bottomNavigation.setupWithNavController(
            navGraphIds = navGraphIds,
            fragmentManager = childFragmentManager,
            containerId = R.id.nav_host_container,
            intent = requireActivity().intent
        )

or codegen into

CharactersListFragment.kt
...
is CharactersListViewEvent.OpenCharacterDetail ->
                findNavController().navigate(
                    CharactersListFragmentDirections
                        .actionCharactersListFragmentToCharacterDetailFragment(viewEvent.id))

It's not good decision without scalable points for projects "under Forma". And we think that will be good have some abstraction navigation layer, which will protect project structure, architecture from navigation tools dependencies, especially codegen from Navigation component.

That's why need to create own navigation system, which will be use by app presentation layer. May be after, we will think about additional navigation targets for Forma. See here, some mind ideas how it may be look navigation

michaem avatar Dec 02 '20 13:12 michaem

It's better to BackTo have field Class<Destination> instead of Destination. In that case you have no need to create such Destination with it's explicit params when you just want to go back.

b1n0m13 avatar Jan 06 '21 13:01 b1n0m13

Maybe we can use cicerone? In our project we use cicerone and one more navigation abstraction for controlling screens flow

ikarenkov avatar Feb 17 '21 21:02 ikarenkov