there is no saving fields value in new source
razaghimahdi opened this issue · comments
rq_mehdi commented
so in register and login fragments(old source) it used to be save fields while destroying view:
(old source)
override fun onDestroyView() {
super.onDestroyView()
saveLoginFields()
}
private fun saveLoginFields(){
viewModel.setLoginFields(
LoginFields(
input_email.text.toString(),
input_password.text.toString()
)
)
}
well as u see after destroying fragment it doesnt work anymore(new source),then i saw this:
(new source)
viewModel.state.value?.let { state ->
setLoginFields(email = state.email, password = state.password)
Log.i(TAG, "onViewCreated: \nstate.email:${state.email} \n state.password:${ state.password}")
}
and i tried to get log from it which it never showed me any email or password, it seems useless,isn't?
maybe it need to define viewModel in BaseAuthFragment?
Mitch Tabian commented
This is the expected behavior now. I am not sharing a viewmodel between the auth fragments.
As for this code, you're right that was useless. Same with RegisterFragment. edc61d4
viewModel.state.value?.let { state ->
setLoginFields(email = state.email, password = state.password)
Log.i(TAG, "onViewCreated: \nstate.email:${state.email} \n state.password:${ state.password}")
}