Change number captcha submission improvement.
This commit is contained in:
parent
015548613a
commit
4b446877af
3 changed files with 15 additions and 4 deletions
|
@ -88,11 +88,11 @@ class ChangeNumberV2Repository(
|
|||
}
|
||||
}
|
||||
|
||||
it.invokeOnCancellation {
|
||||
it.invokeOnCancellation { cancellationCause ->
|
||||
AppDependencies
|
||||
.incomingMessageObserver
|
||||
.removeDecryptionDrainedListener(drainedListener)
|
||||
Log.d(TAG, "Decryptions draining canceled.")
|
||||
Log.d(TAG, "Decryptions draining canceled.", cancellationCause)
|
||||
}
|
||||
|
||||
AppDependencies
|
||||
|
|
|
@ -267,6 +267,13 @@ class ChangeNumberV2ViewModel : ViewModel() {
|
|||
Log.v(TAG, "submitCaptchaToken()")
|
||||
val e164 = number.e164Number
|
||||
val captchaToken = store.value.captchaToken ?: throw IllegalStateException("Can't submit captcha token if no captcha token is set!")
|
||||
store.update {
|
||||
it.copy(
|
||||
captchaToken = null,
|
||||
inProgress = true,
|
||||
changeNumberOutcome = null
|
||||
)
|
||||
}
|
||||
|
||||
viewModelScope.launch {
|
||||
Log.d(TAG, "Getting session in order to submit captcha token…")
|
||||
|
@ -275,7 +282,6 @@ class ChangeNumberV2ViewModel : ViewModel() {
|
|||
Log.d(TAG, "Captcha submission no longer necessary, bailing.")
|
||||
store.update {
|
||||
it.copy(
|
||||
captchaToken = null,
|
||||
inProgress = false,
|
||||
changeNumberOutcome = null
|
||||
)
|
||||
|
@ -286,7 +292,7 @@ class ChangeNumberV2ViewModel : ViewModel() {
|
|||
val captchaSubmissionResult = RegistrationRepository.submitCaptchaToken(context, e164, password, session.body.id, captchaToken)
|
||||
Log.d(TAG, "Captcha token submitted.")
|
||||
store.update {
|
||||
it.copy(captchaToken = null, inProgress = false, changeNumberOutcome = ChangeNumberOutcome.ChangeNumberRequestOutcome(captchaSubmissionResult))
|
||||
it.copy(inProgress = false, changeNumberOutcome = ChangeNumberOutcome.ChangeNumberRequestOutcome(captchaSubmissionResult))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -98,6 +98,11 @@ class ChangeNumberVerifyV2Fragment : LoggingFragment(R.layout.fragment_change_ph
|
|||
showErrorDialog(R.string.RegistrationActivity_rate_limited_to_service)
|
||||
}
|
||||
|
||||
is VerificationCodeRequestResult.TokenNotAccepted -> {
|
||||
Log.i(TAG, "Token was not accepted.")
|
||||
showErrorDialog(R.string.RegistrationActivity_additional_verification_required)
|
||||
}
|
||||
|
||||
else -> {
|
||||
Log.w(TAG, "Unable to request sms code", castResult.getCause())
|
||||
showErrorDialog(R.string.RegistrationActivity_unable_to_request_verification_code)
|
||||
|
|
Loading…
Add table
Reference in a new issue