diff --git a/src/org/thoughtcrime/securesms/lock/RegistrationLockDialog.java b/src/org/thoughtcrime/securesms/lock/RegistrationLockDialog.java index 3cb3ccac6d..51100fa928 100644 --- a/src/org/thoughtcrime/securesms/lock/RegistrationLockDialog.java +++ b/src/org/thoughtcrime/securesms/lock/RegistrationLockDialog.java @@ -7,6 +7,7 @@ import android.content.Context; import android.content.DialogInterface; import android.graphics.Typeface; import android.os.AsyncTask; +import android.os.Build; import android.support.annotation.NonNull; import android.support.v7.app.AlertDialog; import android.text.Editable; @@ -43,7 +44,8 @@ public class RegistrationLockDialog { private static final String TAG = RegistrationLockDialog.class.getSimpleName(); public static void showReminderIfNecessary(@NonNull Context context) { - if (!RegistrationLockReminders.needsReminder(context)) return; + if (!RegistrationLockReminders.needsReminder(context)) return; + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) return; AlertDialog dialog = new AlertDialog.Builder(context, R.style.RationaleDialog) .setView(R.layout.registration_lock_reminder_view) diff --git a/src/org/thoughtcrime/securesms/lock/RegistrationLockReminders.java b/src/org/thoughtcrime/securesms/lock/RegistrationLockReminders.java index d5e265a29a..60a5bd0d96 100644 --- a/src/org/thoughtcrime/securesms/lock/RegistrationLockReminders.java +++ b/src/org/thoughtcrime/securesms/lock/RegistrationLockReminders.java @@ -44,8 +44,13 @@ public class RegistrationLockReminders { long lastReminderInterval = TextSecurePreferences.getRegistrationLockNextReminderInterval(context); long nextReminderInterval; - if (success) nextReminderInterval = INTERVAL_PROGRESSION.get(lastReminderInterval); - else nextReminderInterval = INTERVAL_REGRESSION.get(lastReminderInterval); + if (success) { + if (INTERVAL_PROGRESSION.containsKey(lastReminderInterval)) nextReminderInterval = INTERVAL_PROGRESSION.get(lastReminderInterval); + else nextReminderInterval = INTERVAL_PROGRESSION.get(TimeUnit.HOURS.toMillis(6)); + } else { + if (INTERVAL_REGRESSION.containsKey(lastReminderInterval)) nextReminderInterval = INTERVAL_REGRESSION.get(lastReminderInterval); + else nextReminderInterval = INTERVAL_REGRESSION.get(TimeUnit.HOURS.toMillis(12)); + } TextSecurePreferences.setRegistrationLockLastReminderTime(context, System.currentTimeMillis()); TextSecurePreferences.setRegistrationLockNextReminderInterval(context, nextReminderInterval);