mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 00:59:49 +01:00
Fix crash when receiving SMS before finishing registration.
If someone has set Signal as the default SMS but has cleared data or otherwise reset the app's storage state, it can get into a weird situation. Notably, it'll crash because SmsReceiveJob.onRun() expects Recipient.self() to be available. However, it also makes it impossible to get the registration SMS, because the app won't post a notification for the code. This change will post notifications and SmsRetriever broadcasts for relevant SMS messages.
This commit is contained in:
@@ -77,7 +77,7 @@ public final class RegistrationNavigationActivity extends AppCompatActivity {
|
||||
|
||||
switch (status.getStatusCode()) {
|
||||
case CommonStatusCodes.SUCCESS:
|
||||
Optional<String> code = VerificationCodeParser.parse(context, (String) extras.get(SmsRetriever.EXTRA_SMS_MESSAGE));
|
||||
Optional<String> code = VerificationCodeParser.parse((String) extras.get(SmsRetriever.EXTRA_SMS_MESSAGE));
|
||||
if (code.isPresent()) {
|
||||
Log.i(TAG, "Received verification code.");
|
||||
handleVerificationCodeReceived(code.get());
|
||||
|
||||
@@ -258,7 +258,6 @@ public final class CodeVerificationRequest {
|
||||
identityKey.getPublicKey(), IdentityDatabase.VerifiedStatus.VERIFIED,
|
||||
true, System.currentTimeMillis(), true);
|
||||
|
||||
TextSecurePreferences.setVerifying(context, false);
|
||||
TextSecurePreferences.setPushRegistered(context, true);
|
||||
TextSecurePreferences.setPushServerPassword(context, credentials.getPassword());
|
||||
TextSecurePreferences.setSignedPreKeyRegistered(context, true);
|
||||
|
||||
@@ -77,8 +77,6 @@ public final class RegistrationCodeRequest {
|
||||
}
|
||||
|
||||
private static void markAsVerifying(Context context) {
|
||||
TextSecurePreferences.setVerifying(context, true);
|
||||
|
||||
TextSecurePreferences.setPushRegistered(context, false);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user