Skip to content

Commit

Permalink
Add more detail to 502 errors during registration.
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholas-signal committed Apr 3, 2023
1 parent 5046f58 commit 77bb370
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
Expand Up @@ -28,6 +28,7 @@
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;
Expand Down Expand Up @@ -163,7 +164,7 @@ private void setOnCodeFullyEnteredListener(VerificationCodeView verificationCode

Disposable verify = viewModel.verifyCodeWithoutRegistrationLock(code)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(processor -> {
.subscribe((VerifyResponseProcessor processor) -> {
if (!processor.hasResult()) {
Log.w(TAG, "post verify: ", processor.getError());
}
Expand Down
Expand Up @@ -39,6 +39,7 @@
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;
Expand Down Expand Up @@ -279,7 +280,7 @@ private void requestVerificationCode(@NonNull Mode mode) {
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());
Expand All @@ -302,6 +303,10 @@ private void requestVerificationCode(@NonNull Mode mode) {
} 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));
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Expand Up @@ -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>
Expand Down

0 comments on commit 77bb370

Please sign in to comment.