diff --git a/vector/src/main/java/im/vector/app/features/login/LoginWebFragment.kt b/vector/src/main/java/im/vector/app/features/login/LoginWebFragment.kt index fc3392df09..e7c15445d0 100644 --- a/vector/src/main/java/im/vector/app/features/login/LoginWebFragment.kt +++ b/vector/src/main/java/im/vector/app/features/login/LoginWebFragment.kt @@ -51,8 +51,9 @@ class LoginWebFragment @Inject constructor( private val assetReader: AssetReader ) : AbstractLoginFragment() { - // TODO confirm the need of this viewModel - val softLogoutViewModel: SoftLogoutViewModel by activityViewModel() + // TODO I noticed in the Git history this variable was a local variable inside notifyViewModel method + // TODO was there any reason ? To be able to create this ViewModel we must be sure we will have a valid session + private val softLogoutViewModel: SoftLogoutViewModel by activityViewModel() override fun getBinding(inflater: LayoutInflater, container: ViewGroup?): FragmentLoginWebBinding { return FragmentLoginWebBinding.inflate(inflater, container, false) @@ -71,6 +72,7 @@ class LoginWebFragment @Inject constructor( override fun updateWithState(state: LoginViewState) { setupTitle(state) + // TODO check how it is possible to arrive in this case isForSessionRecovery = state.deviceId?.isNotBlank() == true if (!isWebViewLoaded) { diff --git a/vector/src/main/java/im/vector/app/features/login2/LoginWebFragment2.kt b/vector/src/main/java/im/vector/app/features/login2/LoginWebFragment2.kt index 6996cb552a..17a271177a 100644 --- a/vector/src/main/java/im/vector/app/features/login2/LoginWebFragment2.kt +++ b/vector/src/main/java/im/vector/app/features/login2/LoginWebFragment2.kt @@ -56,8 +56,9 @@ class LoginWebFragment2 @Inject constructor( return FragmentLoginWebBinding.inflate(inflater, container, false) } - // TODO confirm the need of this viewModel - val softLogoutViewModel: SoftLogoutViewModel by activityViewModel() + // TODO I noticed in the Git history this variable was a local variable inside notifyViewModel method + // TODO was there any reason ? To be able to create this ViewModel we must be sure we will have a valid session + private val softLogoutViewModel: SoftLogoutViewModel by activityViewModel() private var isWebViewLoaded = false private var isForSessionRecovery = false @@ -72,6 +73,7 @@ class LoginWebFragment2 @Inject constructor( override fun updateWithState(state: LoginViewState2) { setupTitle(state) + // TODO check how it is possible to arrive in this case isForSessionRecovery = state.deviceId?.isNotBlank() == true if (!isWebViewLoaded) {