mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-25 05:27:42 +00:00
Fix crashes during skip SMS flow.
This commit is contained in:
@@ -3,6 +3,7 @@ package org.thoughtcrime.securesms.registration
|
||||
import org.thoughtcrime.securesms.pin.KeyBackupSystemWrongPinException
|
||||
import org.thoughtcrime.securesms.pin.TokenData
|
||||
import org.whispersystems.signalservice.api.KeyBackupSystemNoDataException
|
||||
import org.whispersystems.signalservice.api.push.exceptions.IncorrectRegistrationRecoveryPasswordException
|
||||
import org.whispersystems.signalservice.api.push.exceptions.NoSuchSessionException
|
||||
import org.whispersystems.signalservice.api.push.exceptions.NonSuccessfulResponseCodeException
|
||||
import org.whispersystems.signalservice.internal.ServiceResponse
|
||||
@@ -45,6 +46,10 @@ sealed class VerifyResponseProcessor(response: ServiceResponse<VerifyResponse>)
|
||||
return error is NonSuccessfulResponseCodeException
|
||||
}
|
||||
|
||||
fun isIncorrectRegistrationRecoveryPassword(): Boolean {
|
||||
return error is IncorrectRegistrationRecoveryPasswordException
|
||||
}
|
||||
|
||||
abstract fun isKbsLocked(): Boolean
|
||||
}
|
||||
|
||||
|
||||
@@ -137,6 +137,9 @@ class ReRegisterWithPinFragment : LoggingFragment(R.layout.pin_restore_entry_fra
|
||||
} else if (processor.isKbsLocked()) {
|
||||
Log.w(TAG, "Unable to continue skip flow, KBS is locked")
|
||||
onAccountLocked()
|
||||
} else if (processor.isIncorrectRegistrationRecoveryPassword()) {
|
||||
Log.w(TAG, "Registration recovery password was incorrect. Moving to SMS verification.")
|
||||
onSkipPinEntry()
|
||||
} else if (processor.isServerSentError()) {
|
||||
Log.i(TAG, "Error from server, not likely recoverable", processor.error)
|
||||
Toast.makeText(requireContext(), R.string.RegistrationActivity_error_connecting_to_service, Toast.LENGTH_LONG).show()
|
||||
|
||||
@@ -225,7 +225,7 @@ public final class RegistrationViewModel extends BaseRegistrationViewModel {
|
||||
registrationRepository.getProfileKey(getNumber().getE164Number()),
|
||||
getFcmToken(),
|
||||
registrationRepository.getPniRegistrationId(),
|
||||
getRecoveryPassword());
|
||||
getSessionId() != null ? null : getRecoveryPassword());
|
||||
}
|
||||
|
||||
public @NonNull Single<VerifyResponseProcessor> verifyReRegisterWithPin(@NonNull String pin) {
|
||||
|
||||
Reference in New Issue
Block a user