Add more detail to 502 errors during registration.

This commit is contained in:
Nicholas Tinsley
2023-04-03 14:43:26 -04:00
parent 5046f58c6f
commit 77bb3702a9
3 changed files with 10 additions and 2 deletions

View File

@@ -28,6 +28,7 @@ import org.thoughtcrime.securesms.components.registration.VerificationCodeView;
import org.thoughtcrime.securesms.components.registration.VerificationPinKeyboard;
import org.thoughtcrime.securesms.registration.ReceivedSmsEvent;
import org.thoughtcrime.securesms.registration.VerifyAccountRepository;
import org.thoughtcrime.securesms.registration.VerifyResponseProcessor;
import org.thoughtcrime.securesms.registration.viewmodel.BaseRegistrationViewModel;
import org.thoughtcrime.securesms.util.LifecycleDisposable;
import org.thoughtcrime.securesms.util.ViewUtil;
@@ -163,7 +164,7 @@ public abstract class BaseEnterSmsCodeFragment<ViewModel extends BaseRegistratio
Disposable verify = viewModel.verifyCodeWithoutRegistrationLock(code)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(processor -> {
.subscribe((VerifyResponseProcessor processor) -> {
if (!processor.hasResult()) {
Log.w(TAG, "post verify: ", processor.getError());
}

View File

@@ -39,6 +39,7 @@ import org.signal.core.util.logging.Log;
import org.thoughtcrime.securesms.LoggingFragment;
import org.thoughtcrime.securesms.R;
import org.thoughtcrime.securesms.keyvalue.SignalStore;
import org.thoughtcrime.securesms.registration.RegistrationSessionProcessor;
import org.thoughtcrime.securesms.registration.VerifyAccountRepository.Mode;
import org.thoughtcrime.securesms.registration.util.RegistrationNumberInputController;
import org.thoughtcrime.securesms.registration.viewmodel.NumberViewState;
@@ -279,7 +280,7 @@ public final class EnterPhoneNumberFragment extends LoggingFragment implements R
Disposable request = viewModel.requestVerificationCode(mode, mccMncProducer.getMcc(), mccMncProducer.getMnc())
.doOnSubscribe(unused -> SignalStore.account().setRegistered(false))
.observeOn(AndroidSchedulers.mainThread())
.subscribe(processor -> {
.subscribe((RegistrationSessionProcessor processor) -> {
if (processor.verificationCodeRequestSuccess()) {
disposables.add(updateFcmTokenValue());
SafeNavigation.safeNavigate(navController, EnterPhoneNumberFragmentDirections.actionEnterVerificationCode());
@@ -302,6 +303,10 @@ public final class EnterPhoneNumberFragment extends LoggingFragment implements R
} else if (processor.isTokenRejected()) {
Log.i(TAG, "The server did not accept the information.", processor.getError());
showErrorDialog(register.getContext(), getString(R.string.RegistrationActivity_we_need_to_verify_that_youre_human));
} else if (processor instanceof RegistrationSessionProcessor.RegistrationSessionProcessorForVerification
&& ((RegistrationSessionProcessor.RegistrationSessionProcessorForVerification) processor).externalServiceFailure()) {
Log.w(TAG, "The server reported a failure with an external service.", processor.getError());
showErrorDialog(register.getContext(), getString(R.string.RegistrationActivity_external_service_error));
} else {
Log.i(TAG, "Unknown error during verification code request", processor.getError());
showErrorDialog(register.getContext(), getString(R.string.RegistrationActivity_unable_to_connect_to_service));

View File

@@ -1805,6 +1805,8 @@
<item quantity="other">You are now %d steps away from submitting a debug log.</item>
</plurals>
<string name="RegistrationActivity_we_need_to_verify_that_youre_human">We need to verify that you\'re human.</string>
<!-- An error shown when the request was valid, but due to an issue with a partner vendor, the server is unable to send an SMS code -->
<string name="RegistrationActivity_external_service_error">Signal was unable to send an SMS code due to an external failure.</string>
<string name="RegistrationActivity_next">Next</string>
<string name="RegistrationActivity_continue">Continue</string>
<string name="RegistrationActivity_take_privacy_with_you_be_yourself_in_every_message">Take privacy with you.\nBe yourself in every message.</string>