Disable registration lock reminders for <=KK devices

Fixes #7500
fork-5.53.8
Moxie Marlinspike 2018-03-11 17:30:31 -07:00
rodzic 43d7e99a50
commit 6b5da7f8cf
2 zmienionych plików z 10 dodań i 3 usunięć

Wyświetl plik

@ -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)

Wyświetl plik

@ -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);