showing loading spinner when returning to the email verification waiting screen
This commit is contained in:
parent
02b6916487
commit
4964c9f151
|
@ -21,6 +21,7 @@ import android.os.Parcelable
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
import androidx.core.view.isVisible
|
||||||
import com.airbnb.mvrx.args
|
import com.airbnb.mvrx.args
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
import im.vector.app.databinding.FragmentFtueWaitForEmailVerificationBinding
|
import im.vector.app.databinding.FragmentFtueWaitForEmailVerificationBinding
|
||||||
|
@ -41,6 +42,7 @@ data class FtueAuthWaitForEmailFragmentArgument(
|
||||||
class FtueAuthWaitForEmailFragment @Inject constructor() : AbstractFtueAuthFragment<FragmentFtueWaitForEmailVerificationBinding>() {
|
class FtueAuthWaitForEmailFragment @Inject constructor() : AbstractFtueAuthFragment<FragmentFtueWaitForEmailVerificationBinding>() {
|
||||||
|
|
||||||
private val params: FtueAuthWaitForEmailFragmentArgument by args()
|
private val params: FtueAuthWaitForEmailFragmentArgument by args()
|
||||||
|
private var inferHasLeftAndReturnedToScreen = false
|
||||||
|
|
||||||
override fun getBinding(inflater: LayoutInflater, container: ViewGroup?): FragmentFtueWaitForEmailVerificationBinding {
|
override fun getBinding(inflater: LayoutInflater, container: ViewGroup?): FragmentFtueWaitForEmailVerificationBinding {
|
||||||
return FragmentFtueWaitForEmailVerificationBinding.inflate(inflater, container, false)
|
return FragmentFtueWaitForEmailVerificationBinding.inflate(inflater, container, false)
|
||||||
|
@ -51,20 +53,30 @@ class FtueAuthWaitForEmailFragment @Inject constructor() : AbstractFtueAuthFragm
|
||||||
setupUi()
|
setupUi()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun setupUi() {
|
||||||
|
views.accountCreatedSubtitle.text = getString(R.string.ftue_auth_email_verification_subtitle, params.email)
|
||||||
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
|
showLoadingIfReturningToScreen()
|
||||||
viewModel.handle(OnboardingAction.PostRegisterAction(RegisterAction.CheckIfEmailHasBeenValidated(0)))
|
viewModel.handle(OnboardingAction.PostRegisterAction(RegisterAction.CheckIfEmailHasBeenValidated(0)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun showLoadingIfReturningToScreen() {
|
||||||
|
when (inferHasLeftAndReturnedToScreen){
|
||||||
|
true -> views.accountCreatedWaiting.isVisible = true
|
||||||
|
false -> {
|
||||||
|
inferHasLeftAndReturnedToScreen = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun onPause() {
|
override fun onPause() {
|
||||||
super.onPause()
|
super.onPause()
|
||||||
viewModel.handle(OnboardingAction.StopEmailValidationCheck)
|
viewModel.handle(OnboardingAction.StopEmailValidationCheck)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupUi() {
|
|
||||||
views.accountCreatedSubtitle.text = getString(R.string.ftue_auth_email_verification_subtitle, params.email)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun resetViewModel() {
|
override fun resetViewModel() {
|
||||||
viewModel.handle(OnboardingAction.ResetAuthenticationAttempt)
|
viewModel.handle(OnboardingAction.ResetAuthenticationAttempt)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue