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:
Greyson Parrelli
2020-09-21 10:26:22 -04:00
parent b471a72856
commit 97b7b4a501
8 changed files with 77 additions and 29 deletions

View File

@@ -64,7 +64,7 @@ public class VerificationCodeParserTest extends BaseUnitTest {
@Test
public void testChallenges() {
for (String[] challenge : challenges()) {
Optional<String> result = VerificationCodeParser.parse(context, challenge[0]);
Optional<String> result = VerificationCodeParser.parse(challenge[0]);
assertTrue(result.isPresent());
assertEquals(challenge[1], result.get());
}