Skip to content

Instantly share code, notes, and snippets.

@DDihanov
Created December 4, 2020 14:18
Show Gist options
  • Save DDihanov/8b7923ead203c742e145bf7a6db8d3bf to your computer and use it in GitHub Desktop.
Save DDihanov/8b7923ead203c742e145bf7a6db8d3bf to your computer and use it in GitHub Desktop.
class StartFragment : Fragment() {
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_start, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
// decide where to go on the first app launch, check auth tokens if login needed etc...
(0..1).random().let {
when (it) {
0 -> (requireActivity() as ToFlowNavigatable).navigateToFlow(NavigationFlow.HomeFlow)
1 -> (requireActivity() as ToFlowNavigatable).navigateToFlow(NavigationFlow.DashboardFlow)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment