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

@@ -75,7 +75,6 @@ public class TextSecurePreferences {
private static final String LOCAL_NUMBER_PREF = "pref_local_number";
private static final String LOCAL_UUID_PREF = "pref_local_uuid";
private static final String LOCAL_USERNAME_PREF = "pref_local_username";
private static final String VERIFYING_STATE_PREF = "pref_verifying";
public static final String REGISTERED_GCM_PREF = "pref_gcm_registered";
private static final String GCM_PASSWORD_PREF = "pref_gcm_password";
private static final String SEEN_WELCOME_SCREEN_PREF = "pref_seen_welcome_screen";
@@ -840,14 +839,6 @@ public class TextSecurePreferences {
return getStringPreference(context, THEME_PREF, DynamicTheme.systemThemeAvailable() ? DynamicTheme.SYSTEM : DynamicTheme.LIGHT);
}
public static boolean isVerifying(Context context) {
return getBooleanPreference(context, VERIFYING_STATE_PREF, false);
}
public static void setVerifying(Context context, boolean verifying) {
setBooleanPreference(context, VERIFYING_STATE_PREF, verifying);
}
public static boolean isPushRegistered(Context context) {
return getBooleanPreference(context, REGISTERED_GCM_PREF, false);
}