mirror of
https://github.com/deltachat/deltachat-android.git
synced 2025-10-03 09:49:21 +02:00
move pref-string 'DOZE_ASKED_DIRECTLY' to the other pref-strings
This commit is contained in:
parent
954ca9b2d1
commit
94cda3f81f
2 changed files with 6 additions and 6 deletions
|
@ -24,8 +24,6 @@ import org.thoughtcrime.securesms.util.Prefs;
|
|||
|
||||
@SuppressLint("BatteryLife")
|
||||
public class DozeReminder {
|
||||
private static final String ALREADY_ASKED_DIRECTLY = "DOZE_ALREADY_ASKED_DIRECTLY";
|
||||
|
||||
public static boolean isEligible(Context context) {
|
||||
if(context==null) {
|
||||
return false;
|
||||
|
@ -40,7 +38,7 @@ public class DozeReminder {
|
|||
}
|
||||
|
||||
// If we did never ask directly, we do not want to add a device message yet. First we want to try to ask directly.
|
||||
if (!Prefs.getBooleanPreference(context, DozeReminder.ALREADY_ASKED_DIRECTLY, false)) {
|
||||
if (!Prefs.getBooleanPreference(context, Prefs.DOZE_ASKED_DIRECTLY, false)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -108,7 +106,7 @@ public class DozeReminder {
|
|||
|
||||
public static void maybeAskDirectly(Context context) {
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M
|
||||
&& !Prefs.getBooleanPreference(context, DozeReminder.ALREADY_ASKED_DIRECTLY, false)
|
||||
&& !Prefs.getBooleanPreference(context, Prefs.DOZE_ASKED_DIRECTLY, false)
|
||||
&& ContextCompat.checkSelfPermission(context, Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS)==PackageManager.PERMISSION_GRANTED
|
||||
&& !((PowerManager)context.getSystemService(Context.POWER_SERVICE)).isIgnoringBatteryOptimizations(context.getPackageName())) {
|
||||
|
||||
|
@ -116,8 +114,9 @@ public class DozeReminder {
|
|||
Uri.parse("package:" + context.getPackageName()));
|
||||
context.startActivity(intent);
|
||||
}
|
||||
Prefs.setBooleanPreference(context, DozeReminder.ALREADY_ASKED_DIRECTLY, true);
|
||||
// ALREADY_ASKED_DIRECTLY is also used above in isEligible(). As long as ALREADY_ASKED_DIRECTLY is false, isEligible() will return false
|
||||
Prefs.setBooleanPreference(context, Prefs.DOZE_ASKED_DIRECTLY, true);
|
||||
// Prefs.DOZE_ASKED_DIRECTLY is also used above in isEligible().
|
||||
// As long as Prefs.DOZE_ASKED_DIRECTLY is false, isEligible() will return false
|
||||
// and no device message will be added.
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,6 +49,7 @@ public class Prefs {
|
|||
public static final String SCREEN_SECURITY_PREF = "pref_screen_security";
|
||||
private static final String ENTER_SENDS_PREF = "pref_enter_sends";
|
||||
private static final String PROMPTED_DOZE_MSG_ID_PREF = "pref_prompted_doze_msg_id";
|
||||
public static final String DOZE_ASKED_DIRECTLY = "pref_doze_asked_directly";
|
||||
private static final String IN_THREAD_NOTIFICATION_PREF = "pref_key_inthread_notifications";
|
||||
public static final String MESSAGE_BODY_TEXT_SIZE_PREF = "pref_message_body_text_size";
|
||||
public static final String EPHEMERAL_MESSAGES_PREF = "pref_ephemeral_messages";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue