Fix showing login/logout button on initial screens
This commit is contained in:
@@ -27,7 +27,8 @@ class RecipesFragment : Fragment(R.layout.fragment_recipes) {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
authViewModel.authenticationState.observe(this, ::onAuthStateChange)
|
||||
Timber.v("onCreate() called with: savedInstanceState = $savedInstanceState")
|
||||
authViewModel.authenticationStateLive.observe(this, ::onAuthStateChange)
|
||||
}
|
||||
|
||||
private fun onAuthStateChange(authenticationState: AuthenticationState) {
|
||||
@@ -40,6 +41,7 @@ class RecipesFragment : Fragment(R.layout.fragment_recipes) {
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
Timber.v("onViewCreated() called with: view = $view, savedInstanceState = $savedInstanceState")
|
||||
authViewModel.showLoginButton = true
|
||||
setupRecipeAdapter()
|
||||
(requireActivity() as? AppCompatActivity)?.supportActionBar?.title = null
|
||||
}
|
||||
@@ -78,5 +80,6 @@ class RecipesFragment : Fragment(R.layout.fragment_recipes) {
|
||||
Timber.v("onDestroyView() called")
|
||||
// Prevent RV leaking through mObservers list in adapter
|
||||
binding.recipes.adapter = null
|
||||
authViewModel.showLoginButton = false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user