Disable server alerts by default for Play Store version

This commit is contained in:
M66B
2026-01-16 07:27:37 +01:00
parent 3af9c0fdf5
commit ebb60aee5c
4 changed files with 26 additions and 3 deletions

View File

@@ -223,6 +223,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
private SeekBar sbMaxBackOff;
private SwitchCompat swLogarithmicBackoff;
private SwitchCompat swExactAlarms;
private SwitchCompat swServerAlerts;
private SwitchCompat swNativeDkim;
private SwitchCompat swNativeArc;
private EditText etNativeArcWhitelist;
@@ -312,7 +313,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
"imap_compress", "auth_plain", "auth_login", "auth_ntlm", "auth_sasl", "auth_apop", "use_top", "forget_top",
"keep_alive_poll", "empty_pool", "idle_done", "fast_fetch",
"max_backoff_power", "logarithmic_backoff",
"exact_alarms",
"exact_alarms", "server_alerts",
"native_dkim", "native_arc", "native_arc_whitelist", "strict_alignment",
"svg", "webp", "animate_images",
"preview_hidden", "preview_quotes",
@@ -497,6 +498,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
sbMaxBackOff = view.findViewById(R.id.sbMaxBackOff);
swLogarithmicBackoff = view.findViewById(R.id.swLogarithmicBackoff);
swExactAlarms = view.findViewById(R.id.swExactAlarms);
swServerAlerts = view.findViewById(R.id.swServerAlerts);
swNativeDkim = view.findViewById(R.id.swNativeDkim);
swNativeArc = view.findViewById(R.id.swNativeArc);
etNativeArcWhitelist = view.findViewById(R.id.etNativeArcWhitelist);
@@ -1651,6 +1653,13 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
}
});
swServerAlerts.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("server_alerts", checked).apply();
}
});
swNativeDkim.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@@ -2651,6 +2660,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
swLogarithmicBackoff.setChecked(prefs.getBoolean("logarithmic_backoff", true));
swExactAlarms.setChecked(prefs.getBoolean("exact_alarms", true));
swServerAlerts.setChecked(prefs.getBoolean("server_alerts", !Helper.isPlayStoreInstall()));
swNativeDkim.setEnabled(!BuildConfig.PLAY_STORE_RELEASE || true);
swNativeDkim.setChecked(prefs.getBoolean("native_dkim", false));
swNativeArc.setEnabled(swNativeDkim.isEnabled() && swNativeDkim.isChecked());

View File

@@ -1717,7 +1717,8 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
EntityLog.log(ServiceSynchronize.this, EntityLog.Type.Account, account,
account.name + " alert: " + message);
if (!ConnectionHelper.isMaxConnections(message))
if (!ConnectionHelper.isMaxConnections(message) &&
prefs.getBoolean("server_alerts", !Helper.isPlayStoreInstall()))
try {
NotificationManager nm =
Helper.getSystemService(ServiceSynchronize.this, NotificationManager.class);