mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-23 19:26:17 +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()))
|
||||
|
||||
@@ -2484,6 +2484,8 @@
|
||||
<!-- During registration, if the user attempts (and fails) to register, we display this error message with a number of minutes timer they are allowed to try again.-->
|
||||
<string name="RegistrationActivity_rate_limited_to_try_again">You\'ve made too many attempts to register this number. Please try again in %s.</string>
|
||||
<string name="RegistrationActivity_unable_to_connect_to_service">Unable to connect to service. Please check network connection and try again.</string>
|
||||
<!-- Dialog error message shown when attempting to register and the SMS provider fails to send an SMS -->
|
||||
<string name="RegistrationActivity_sms_provider_error">Signal couldn\'t send an SMS code because of issues with the SMS provider. Try again in several hours.</string>
|
||||
<!-- A description text for an alert dialog when the entered phone number is not eligible for a verification SMS. -->
|
||||
<string name="RegistrationActivity_we_couldnt_send_you_a_verification_code">We couldn\'t send you a verification code via SMS. Try receiving your code via voice call instead.</string>
|
||||
<!-- Generic error when the app is unable to request an SMS code for an unknown reason. -->
|
||||
|
||||
Reference in New Issue
Block a user