mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-18 05:57:44 +00:00
parent
43d7e99a50
commit
6b5da7f8cf
@ -7,6 +7,7 @@ import android.content.Context;
|
|||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
|
import android.os.Build;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
@ -43,7 +44,8 @@ public class RegistrationLockDialog {
|
|||||||
private static final String TAG = RegistrationLockDialog.class.getSimpleName();
|
private static final String TAG = RegistrationLockDialog.class.getSimpleName();
|
||||||
|
|
||||||
public static void showReminderIfNecessary(@NonNull Context context) {
|
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)
|
AlertDialog dialog = new AlertDialog.Builder(context, R.style.RationaleDialog)
|
||||||
.setView(R.layout.registration_lock_reminder_view)
|
.setView(R.layout.registration_lock_reminder_view)
|
||||||
|
@ -44,8 +44,13 @@ public class RegistrationLockReminders {
|
|||||||
long lastReminderInterval = TextSecurePreferences.getRegistrationLockNextReminderInterval(context);
|
long lastReminderInterval = TextSecurePreferences.getRegistrationLockNextReminderInterval(context);
|
||||||
long nextReminderInterval;
|
long nextReminderInterval;
|
||||||
|
|
||||||
if (success) nextReminderInterval = INTERVAL_PROGRESSION.get(lastReminderInterval);
|
if (success) {
|
||||||
else nextReminderInterval = INTERVAL_REGRESSION.get(lastReminderInterval);
|
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.setRegistrationLockLastReminderTime(context, System.currentTimeMillis());
|
||||||
TextSecurePreferences.setRegistrationLockNextReminderInterval(context, nextReminderInterval);
|
TextSecurePreferences.setRegistrationLockNextReminderInterval(context, nextReminderInterval);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user