From 9a9b4c8660c389cd66386953f24e1c96bb183c24 Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 26 Jun 2020 11:09:57 +0200 Subject: [PATCH] Removed SOCKS5 proxy support --- .../java/eu/faircode/email/EmailService.java | 17 ------- .../email/FragmentOptionsConnection.java | 32 +------------ .../eu/faircode/email/ServiceSynchronize.java | 1 - .../layout/fragment_options_connection.xml | 45 +------------------ app/src/main/res/values/strings.xml | 3 -- 5 files changed, 2 insertions(+), 96 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/EmailService.java b/app/src/main/java/eu/faircode/email/EmailService.java index 33b2e58b74..ef1b397b63 100644 --- a/app/src/main/java/eu/faircode/email/EmailService.java +++ b/app/src/main/java/eu/faircode/email/EmailService.java @@ -145,25 +145,8 @@ public class EmailService implements AutoCloseable { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); this.harden = prefs.getBoolean("ssl_harden", false); - boolean socks_enabled = prefs.getBoolean("socks_enabled", false); - String socks_proxy = prefs.getString("socks_proxy", "localhost:9050"); - boolean auth_sasl = prefs.getBoolean("auth_sasl", true); - // SOCKS proxy - if (socks_enabled) { - String[] address = socks_proxy.split(":"); - String host = (address.length > 0 ? address[0] : null); - String port = (address.length > 1 ? address[1] : null); - if (TextUtils.isEmpty(host)) - host = "localhost"; - if (TextUtils.isEmpty(port)) - port = "9050"; - properties.put("mail." + protocol + ".socks.host", host); - properties.put("mail." + protocol + ".socks.port", port); - Log.i("Using SOCKS proxy=" + host + ":" + port); - } - properties.put("mail.event.scope", "folder"); properties.put("mail.event.executor", executor); diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsConnection.java b/app/src/main/java/eu/faircode/email/FragmentOptionsConnection.java index fe9c0c6e92..9672b08ef6 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsConnection.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsConnection.java @@ -61,15 +61,12 @@ public class FragmentOptionsConnection extends FragmentBase implements SharedPre private SwitchCompat swRlah; private EditText etTimeout; private SwitchCompat swSslHarden; - private SwitchCompat swSocks; - private EditText etSocks; - private Button btnSocks; private Button btnManage; private TextView tvConnectionType; private TextView tvConnectionRoaming; private final static String[] RESET_OPTIONS = new String[]{ - "metered", "download", "roaming", "rlah", "timeout", "ssl_harden", "socks_enabled", "socks_proxy" + "metered", "download", "roaming", "rlah", "timeout", "ssl_harden" }; @Override @@ -88,9 +85,6 @@ public class FragmentOptionsConnection extends FragmentBase implements SharedPre swRlah = view.findViewById(R.id.swRlah); etTimeout = view.findViewById(R.id.etTimeout); swSslHarden = view.findViewById(R.id.swSslHarden); - swSocks = view.findViewById(R.id.swSocks); - etSocks = view.findViewById(R.id.etSocks); - btnSocks = view.findViewById(R.id.btnSocks); btnManage = view.findViewById(R.id.btnManage); tvConnectionType = view.findViewById(R.id.tvConnectionType); @@ -168,26 +162,6 @@ public class FragmentOptionsConnection extends FragmentBase implements SharedPre } }); - swSocks.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { - @Override - public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { - prefs.edit().putBoolean("socks_enabled", checked).apply(); - etSocks.setEnabled(checked); - btnSocks.setEnabled(checked); - } - }); - - btnSocks.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - String proxy = etSocks.getText().toString(); - if (TextUtils.isEmpty(proxy)) - prefs.edit().remove("socks_proxy").apply(); - else - prefs.edit().putString("socks_proxy", proxy).apply(); - } - }); - final Intent manage = getIntentConnectivity(); PackageManager pm = getContext().getPackageManager(); btnManage.setVisibility( @@ -295,10 +269,6 @@ public class FragmentOptionsConnection extends FragmentBase implements SharedPre etTimeout.setHint(Integer.toString(EmailService.DEFAULT_CONNECT_TIMEOUT)); swSslHarden.setChecked(prefs.getBoolean("ssl_harden", false)); - swSocks.setChecked(prefs.getBoolean("socks_enabled", false)); - etSocks.setText(prefs.getString("socks_proxy", null)); - etSocks.setEnabled(swSocks.isChecked()); - btnSocks.setEnabled(swSocks.isChecked()); } private static Intent getIntentConnectivity() { diff --git a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java index 6b9b3613bb..00e6bf3352 100644 --- a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java +++ b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java @@ -124,7 +124,6 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences private static final List PREF_RELOAD = Collections.unmodifiableList(Arrays.asList( "metered", "roaming", "rlah", // force reconnect "ssl_harden", // force reconnect - "socks_enabled", "socks_proxy", // force reconnect "badge", "unseen_ignored", // force update badge/widget "debug" // force reconnect )); diff --git a/app/src/main/res/layout/fragment_options_connection.xml b/app/src/main/res/layout/fragment_options_connection.xml index f879e6eea9..b511696fe4 100644 --- a/app/src/main/res/layout/fragment_options_connection.xml +++ b/app/src/main/res/layout/fragment_options_connection.xml @@ -207,49 +207,6 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/swSslHarden" /> - - - - -