mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-27 22:43:52 +00:00
Add sms provider failed specific messaging during registration.
This commit is contained in:
committed by
Greyson Parrelli
parent
0952afbba1
commit
1315724d52
@@ -166,6 +166,7 @@ class EnterCodeFragment : LoggingFragment(R.layout.fragment_registration_enter_c
|
||||
is VerificationCodeRequestResult.RateLimited -> presentRateLimitedDialog()
|
||||
is VerificationCodeRequestResult.AttemptsExhausted -> presentAccountLocked()
|
||||
is VerificationCodeRequestResult.RegistrationLocked -> presentRegistrationLocked(result.timeRemaining)
|
||||
is VerificationCodeRequestResult.ExternalServiceFailure -> presentSmsGenericError(result)
|
||||
else -> presentGenericError(result)
|
||||
}
|
||||
}
|
||||
@@ -231,16 +232,28 @@ class EnterCodeFragment : LoggingFragment(R.layout.fragment_registration_enter_c
|
||||
})
|
||||
}
|
||||
|
||||
private fun presentSmsGenericError(requestResult: RegistrationResult) {
|
||||
binding.keyboard.displayFailure().addListener(
|
||||
object : AssertedSuccessListener<Boolean>() {
|
||||
override fun onSuccess(result: Boolean?) {
|
||||
Log.w(TAG, "Encountered sms provider error!", requestResult.getCause())
|
||||
MaterialAlertDialogBuilder(requireContext()).apply {
|
||||
setMessage(R.string.RegistrationActivity_sms_provider_error)
|
||||
setPositiveButton(android.R.string.ok) { _, _ -> fragmentViewModel.showKeyboard() }
|
||||
show()
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
private fun presentGenericError(requestResult: RegistrationResult) {
|
||||
binding.keyboard.displayFailure().addListener(
|
||||
object : AssertedSuccessListener<Boolean>() {
|
||||
override fun onSuccess(result: Boolean?) {
|
||||
Log.w(TAG, "Encountered unexpected error!", requestResult.getCause())
|
||||
MaterialAlertDialogBuilder(requireContext()).apply {
|
||||
null?.let<String, MaterialAlertDialogBuilder> {
|
||||
setTitle(it)
|
||||
}
|
||||
setMessage(getString(R.string.RegistrationActivity_error_connecting_to_service))
|
||||
setMessage(R.string.RegistrationActivity_error_connecting_to_service)
|
||||
setPositiveButton(android.R.string.ok) { _, _ -> fragmentViewModel.showKeyboard() }
|
||||
show()
|
||||
}
|
||||
|
||||
@@ -347,7 +347,7 @@ class EnterPhoneNumberFragment : LoggingFragment(R.layout.fragment_registration_
|
||||
is VerificationCodeRequestResult.Success -> throw IllegalStateException("Session error handler called on successful response!")
|
||||
is VerificationCodeRequestResult.AttemptsExhausted -> presentRateLimitedDialog()
|
||||
is VerificationCodeRequestResult.ChallengeRequired -> handleChallenges(result.challenges)
|
||||
is VerificationCodeRequestResult.ExternalServiceFailure -> presentRemoteErrorDialog(getString(R.string.RegistrationActivity_unable_to_connect_to_service), skipToNextScreen)
|
||||
is VerificationCodeRequestResult.ExternalServiceFailure -> presentRemoteErrorDialog(getString(R.string.RegistrationActivity_sms_provider_error))
|
||||
is VerificationCodeRequestResult.ImpossibleNumber -> {
|
||||
MaterialAlertDialogBuilder(requireContext()).apply {
|
||||
setMessage(getString(R.string.RegistrationActivity_the_number_you_specified_s_is_invalid, fragmentViewModel.phoneNumber?.toE164()))
|
||||
|
||||
@@ -166,6 +166,7 @@ class EnterCodeFragment : LoggingFragment(R.layout.fragment_registration_enter_c
|
||||
is VerificationCodeRequestResult.RateLimited -> presentRateLimitedDialog()
|
||||
is VerificationCodeRequestResult.AttemptsExhausted -> presentAccountLocked()
|
||||
is VerificationCodeRequestResult.RegistrationLocked -> presentRegistrationLocked(result.timeRemaining)
|
||||
is VerificationCodeRequestResult.ExternalServiceFailure -> presentSmsGenericError(result)
|
||||
else -> presentGenericError(result)
|
||||
}
|
||||
}
|
||||
@@ -231,16 +232,28 @@ class EnterCodeFragment : LoggingFragment(R.layout.fragment_registration_enter_c
|
||||
})
|
||||
}
|
||||
|
||||
private fun presentSmsGenericError(requestResult: RegistrationResult) {
|
||||
binding.keyboard.displayFailure().addListener(
|
||||
object : AssertedSuccessListener<Boolean>() {
|
||||
override fun onSuccess(result: Boolean?) {
|
||||
Log.w(TAG, "Encountered sms provider error!", requestResult.getCause())
|
||||
MaterialAlertDialogBuilder(requireContext()).apply {
|
||||
setMessage(R.string.RegistrationActivity_sms_provider_error)
|
||||
setPositiveButton(android.R.string.ok) { _, _ -> fragmentViewModel.showKeyboard() }
|
||||
show()
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
private fun presentGenericError(requestResult: RegistrationResult) {
|
||||
binding.keyboard.displayFailure().addListener(
|
||||
object : AssertedSuccessListener<Boolean>() {
|
||||
override fun onSuccess(result: Boolean?) {
|
||||
Log.w(TAG, "Encountered unexpected error!", requestResult.getCause())
|
||||
MaterialAlertDialogBuilder(requireContext()).apply {
|
||||
null?.let<String, MaterialAlertDialogBuilder> {
|
||||
setTitle(it)
|
||||
}
|
||||
setMessage(getString(R.string.RegistrationActivity_error_connecting_to_service))
|
||||
setMessage(R.string.RegistrationActivity_error_connecting_to_service)
|
||||
setPositiveButton(android.R.string.ok) { _, _ -> fragmentViewModel.showKeyboard() }
|
||||
show()
|
||||
}
|
||||
|
||||
@@ -358,7 +358,7 @@ class EnterPhoneNumberFragment : LoggingFragment(R.layout.fragment_registration_
|
||||
is VerificationCodeRequestResult.Success -> throw IllegalStateException("Session error handler called on successful response!")
|
||||
is VerificationCodeRequestResult.AttemptsExhausted -> presentRateLimitedDialog()
|
||||
is VerificationCodeRequestResult.ChallengeRequired -> handleChallenges(result.challenges)
|
||||
is VerificationCodeRequestResult.ExternalServiceFailure -> presentRemoteErrorDialog(getString(R.string.RegistrationActivity_unable_to_connect_to_service), skipToNextScreen)
|
||||
is VerificationCodeRequestResult.ExternalServiceFailure -> presentRemoteErrorDialog(getString(R.string.RegistrationActivity_sms_provider_error))
|
||||
is VerificationCodeRequestResult.ImpossibleNumber -> {
|
||||
MaterialAlertDialogBuilder(requireContext()).apply {
|
||||
setMessage(getString(R.string.RegistrationActivity_the_number_you_specified_s_is_invalid, fragmentViewModel.phoneNumber?.toE164()))
|
||||
|
||||
Reference in New Issue
Block a user