Hide keep alive option

pull/189/head
M66B 4 years ago
parent bcbdf6dfdb
commit 42f27ccf03

@ -89,15 +89,6 @@ public class ApplicationEx extends Application implements SharedPreferences.OnSh
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
final boolean crash_reports = prefs.getBoolean("crash_reports", false);
try {
boolean tcp_keep_alive = prefs.getBoolean("tcp_keep_alive", false);
System.setProperty("fairemail.tcp_keep_alive", Boolean.toString(tcp_keep_alive));
} catch (Throwable ex) {
Log.e(ex);
}
prefs.registerOnSharedPreferenceChangeListener(this);
prev = Thread.getDefaultUncaughtExceptionHandler();
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
@ -123,6 +114,15 @@ public class ApplicationEx extends Application implements SharedPreferences.OnSh
upgrade(this);
try {
boolean tcp_keep_alive = prefs.getBoolean("tcp_keep_alive", false);
System.setProperty("fairemail.tcp_keep_alive", Boolean.toString(tcp_keep_alive));
} catch (Throwable ex) {
Log.e(ex);
}
prefs.registerOnSharedPreferenceChangeListener(this);
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O)
NotificationHelper.createNotificationChannels(this);
@ -384,6 +384,8 @@ public class ApplicationEx extends Application implements SharedPreferences.OnSh
editor.putBoolean("beige", false);
} else if (version < 1385)
editor.remove("parse_classes");
else if (version < 1401)
editor.remove("tcp_keep_alive");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && !BuildConfig.DEBUG)
editor.remove("background_service");

@ -62,6 +62,7 @@ public class FragmentOptionsConnection extends FragmentBase implements SharedPre
private EditText etTimeout;
private SwitchCompat swPreferIp4;
private SwitchCompat swTcpKeepAlive;
private TextView tvTcpKeepAliveHint;
private SwitchCompat swSslHarden;
private Button btnManage;
private TextView tvNetworkMetered;
@ -89,6 +90,7 @@ public class FragmentOptionsConnection extends FragmentBase implements SharedPre
etTimeout = view.findViewById(R.id.etTimeout);
swPreferIp4 = view.findViewById(R.id.swPreferIp4);
swTcpKeepAlive = view.findViewById(R.id.swTcpKeepAlive);
tvTcpKeepAliveHint = view.findViewById(R.id.tvTcpKeepAliveHint);
swSslHarden = view.findViewById(R.id.swSslHarden);
btnManage = view.findViewById(R.id.btnManage);
@ -168,6 +170,10 @@ public class FragmentOptionsConnection extends FragmentBase implements SharedPre
}
});
boolean debug = prefs.getBoolean("debug", false);
swTcpKeepAlive.setVisibility(debug || BuildConfig.DEBUG ? View.VISIBLE : View.GONE);
tvTcpKeepAliveHint.setVisibility(debug || BuildConfig.DEBUG ? View.VISIBLE : View.GONE);
swTcpKeepAlive.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {

Loading…
Cancel
Save