diff --git a/vector/src/main/java/im/vector/app/features/login2/AbstractLoginFragment2.kt b/vector/src/main/java/im/vector/app/features/login2/AbstractLoginFragment2.kt index 314867ef8b..266e69e5b1 100644 --- a/vector/src/main/java/im/vector/app/features/login2/AbstractLoginFragment2.kt +++ b/vector/src/main/java/im/vector/app/features/login2/AbstractLoginFragment2.kt @@ -147,19 +147,11 @@ abstract class AbstractLoginFragment2 : VectorBaseFragment } } - final override fun invalidate() { - withState(loginViewModel) { state -> - // True when email is sent with success to the homeserver - isResetPasswordStarted = state.resetPasswordEmail.isNullOrBlank().not() + final override fun invalidate() = withState(loginViewModel) { state -> + // True when email is sent with success to the homeserver + isResetPasswordStarted = state.resetPasswordEmail.isNullOrBlank().not() - updateWithState(state) - } - - invalidateMore() - } - - protected open fun invalidateMore() { - // No op by default + updateWithState(state) } open fun updateWithState(state: LoginViewState2) { diff --git a/vector/src/main/java/im/vector/app/features/login2/created/AccountCreatedFragment.kt b/vector/src/main/java/im/vector/app/features/login2/created/AccountCreatedFragment.kt index 4b7f43f9a1..a799703956 100644 --- a/vector/src/main/java/im/vector/app/features/login2/created/AccountCreatedFragment.kt +++ b/vector/src/main/java/im/vector/app/features/login2/created/AccountCreatedFragment.kt @@ -67,6 +67,8 @@ class AccountCreatedFragment @Inject constructor( setupClickListener() setupSubmitButton() observeViewEvents() + + viewModel.subscribe { invalidateState(it) } } private fun observeViewEvents() { @@ -121,7 +123,7 @@ class AccountCreatedFragment @Inject constructor( loginViewModel.handle(LoginAction2.Finish) } - override fun invalidateMore() = withState(viewModel) { state -> + private fun invalidateState(state: AccountCreatedViewState) { // Ugly hack... (activity as? LoginActivity2)?.setIsLoading(state.isLoading)