Previously view models of the login details compose screens were initialized using LaunchedEffect, which had
LoginDetails screens loose user made changes on screen rotation/re-compose. This is because the LaunchedEffect was called on every re-composition, even when called with a constant like LaunchedEffect(true).
Injecting the view models with hilt allows to initialize the model directly when created by the hilt factory, thus circumventing the problem.
Short description
Add hilt assisted factories to the view models
Inject view models in composables using hilt with factories passing the initialLoginInfo along.
Purpose
Previously view models of the login details compose screens were initialized using
LaunchedEffect
, which had LoginDetails screens loose user made changes on screen rotation/re-compose. This is because theLaunchedEffect
was called on every re-composition, even when called with a constant likeLaunchedEffect(true)
.Injecting the view models with hilt allows to initialize the model directly when created by the hilt factory, thus circumventing the problem.
Short description
initialLoginInfo
along.See also: https://developer.android.com/develop/ui/compose/libraries#hilt https://developer.android.com/develop/ui/compose/libraries#viewmodel
Checklist