From a1b2f99983285942f63a12f2661bf157a2f8a708 Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 21 Sep 2018 13:18:26 +0000 Subject: [PATCH] Removed compress / prever IPv4 options --- .../email/BoundaryCallbackMessages.java | 2 +- .../eu/faircode/email/FragmentAccount.java | 4 ++-- .../eu/faircode/email/FragmentFolder.java | 4 ++-- .../eu/faircode/email/FragmentIdentity.java | 2 +- .../eu/faircode/email/FragmentOptions.java | 22 ----------------- .../java/eu/faircode/email/MessageHelper.java | 10 +++----- .../eu/faircode/email/ServiceSynchronize.java | 4 ++-- app/src/main/res/layout/fragment_options.xml | 24 ++----------------- app/src/main/res/values/strings.xml | 2 -- 9 files changed, 13 insertions(+), 61 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/BoundaryCallbackMessages.java b/app/src/main/java/eu/faircode/email/BoundaryCallbackMessages.java index 9eaf36ff38..fc97bcc8c3 100644 --- a/app/src/main/java/eu/faircode/email/BoundaryCallbackMessages.java +++ b/app/src/main/java/eu/faircode/email/BoundaryCallbackMessages.java @@ -147,7 +147,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback folders = new ArrayList<>(); - Properties props = MessageHelper.getSessionProperties(context, auth_type); + Properties props = MessageHelper.getSessionProperties(auth_type); Session isession = Session.getInstance(props, null); isession.setDebug(true); IMAPStore istore = null; @@ -712,7 +712,7 @@ public class FragmentAccount extends FragmentEx { // Check IMAP server if (synchronize) { - Session isession = Session.getInstance(MessageHelper.getSessionProperties(context, auth_type), null); + Session isession = Session.getInstance(MessageHelper.getSessionProperties(auth_type), null); isession.setDebug(true); IMAPStore istore = null; try { diff --git a/app/src/main/java/eu/faircode/email/FragmentFolder.java b/app/src/main/java/eu/faircode/email/FragmentFolder.java index 6c40fe8dd3..189f4e0cea 100644 --- a/app/src/main/java/eu/faircode/email/FragmentFolder.java +++ b/app/src/main/java/eu/faircode/email/FragmentFolder.java @@ -133,7 +133,7 @@ public class FragmentFolder extends FragmentEx { if (folder == null || !folder.name.equals(name)) { EntityAccount account = db.account().getAccount(folder == null ? aid : folder.account); - Properties props = MessageHelper.getSessionProperties(context, account.auth_type); + Properties props = MessageHelper.getSessionProperties(account.auth_type); Session isession = Session.getInstance(props, null); istore = (IMAPStore) isession.getStore("imaps"); Helper.connect(context, istore, account); @@ -236,7 +236,7 @@ public class FragmentFolder extends FragmentEx { EntityFolder folder = db.folder().getFolder(id); EntityAccount account = db.account().getAccount(folder.account); - Properties props = MessageHelper.getSessionProperties(context, account.auth_type); + Properties props = MessageHelper.getSessionProperties(account.auth_type); Session isession = Session.getInstance(props, null); istore = (IMAPStore) isession.getStore("imaps"); Helper.connect(context, istore, account); diff --git a/app/src/main/java/eu/faircode/email/FragmentIdentity.java b/app/src/main/java/eu/faircode/email/FragmentIdentity.java index c731ca5791..9dba3a36ab 100644 --- a/app/src/main/java/eu/faircode/email/FragmentIdentity.java +++ b/app/src/main/java/eu/faircode/email/FragmentIdentity.java @@ -338,7 +338,7 @@ public class FragmentIdentity extends FragmentEx { // Check SMTP server if (synchronize) { - Properties props = MessageHelper.getSessionProperties(context, auth_type); + Properties props = MessageHelper.getSessionProperties(auth_type); Session isession = Session.getInstance(props, null); isession.setDebug(true); Transport itransport = isession.getTransport(starttls ? "smtp" : "smtps"); diff --git a/app/src/main/java/eu/faircode/email/FragmentOptions.java b/app/src/main/java/eu/faircode/email/FragmentOptions.java index baff3aff1f..0af7101219 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptions.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptions.java @@ -32,10 +32,8 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; public class FragmentOptions extends FragmentEx { - private CheckBox cbCompressImap; private CheckBox cbAvatars; private CheckBox cbLight; - private CheckBox cbIpV4; private CheckBox cbDebug; @Override @@ -46,25 +44,14 @@ public class FragmentOptions extends FragmentEx { View view = inflater.inflate(R.layout.fragment_options, container, false); // Get controls - cbCompressImap = view.findViewById(R.id.cbCompressImap); cbAvatars = view.findViewById(R.id.cbAvatars); cbLight = view.findViewById(R.id.cbLight); - cbIpV4 = view.findViewById(R.id.cbIpV4); cbDebug = view.findViewById(R.id.cbDebug); // Wire controls final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); - cbCompressImap.setChecked(prefs.getBoolean("compress", true)); - cbCompressImap.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { - @Override - public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { - prefs.edit().putBoolean("compress", checked).apply(); - ServiceSynchronize.reload(getContext(), "compress=" + checked); - } - }); - cbAvatars.setChecked(prefs.getBoolean("avatars", true)); cbAvatars.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override @@ -81,15 +68,6 @@ public class FragmentOptions extends FragmentEx { } }); - cbIpV4.setChecked(prefs.getBoolean("ipv4", false)); - cbIpV4.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { - @Override - public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { - prefs.edit().putBoolean("ipv4", checked).apply(); - ServiceSynchronize.reload(getContext(), "IPv4=" + checked); - } - }); - cbDebug.setChecked(prefs.getBoolean("debug", false)); cbDebug.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override diff --git a/app/src/main/java/eu/faircode/email/MessageHelper.java b/app/src/main/java/eu/faircode/email/MessageHelper.java index 5c9e39e718..e2857217fe 100644 --- a/app/src/main/java/eu/faircode/email/MessageHelper.java +++ b/app/src/main/java/eu/faircode/email/MessageHelper.java @@ -20,8 +20,6 @@ package eu.faircode.email; */ import android.content.Context; -import android.content.SharedPreferences; -import android.preference.PreferenceManager; import android.text.TextUtils; import android.util.Base64; import android.util.Log; @@ -63,11 +61,9 @@ public class MessageHelper { final static int NETWORK_TIMEOUT = 60 * 1000; // milliseconds - static Properties getSessionProperties(Context context, int auth_type) { + static Properties getSessionProperties(int auth_type) { Properties props = new Properties(); - SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); - // https://javaee.github.io/javamail/docs/api/com/sun/mail/imap/package-summary.html#properties props.put("mail.imaps.ssl.checkserveridentity", "true"); props.put("mail.imaps.ssl.trust", "*"); @@ -85,7 +81,7 @@ public class MessageHelper { // https://tools.ietf.org/html/rfc4978 // https://docs.oracle.com/javase/8/docs/api/java/util/zip/Deflater.html - if (prefs.getBoolean("compress", true)) { + if (false) { Log.i(Helper.TAG, "IMAP compress enabled"); props.put("mail.imaps.compress.enable", "true"); //props.put("mail.imaps.compress.level", "-1"); @@ -140,7 +136,7 @@ public class MessageHelper { System.setProperty("mail.mime.multipart.ignoremissingboundaryparameter", "true"); // javax.mail.internet.ParseException: In parameter list System.setProperty("mail.mime.multipart.ignoreexistingboundaryparameter", "true"); - if (prefs.getBoolean("ipv4", false)) { + if (false) { Log.i(Helper.TAG, "Prefering IPv4"); System.setProperty("java.net.preferIPv4Stack", "true"); } diff --git a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java index b245cde988..9147e4650b 100644 --- a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java +++ b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java @@ -561,7 +561,7 @@ public class ServiceSynchronize extends LifecycleService { System.setProperty("mail.socket.debug", Boolean.toString(debug)); // Create session - Properties props = MessageHelper.getSessionProperties(this, account.auth_type); + Properties props = MessageHelper.getSessionProperties(account.auth_type); final Session isession = Session.getInstance(props, null); isession.setDebug(debug); // adb -t 1 logcat | grep "fairemail\|System.out" @@ -1243,7 +1243,7 @@ public class ServiceSynchronize extends LifecycleService { } // Create session - Properties props = MessageHelper.getSessionProperties(this, ident.auth_type); + Properties props = MessageHelper.getSessionProperties(ident.auth_type); final Session isession = Session.getInstance(props, null); // Create message diff --git a/app/src/main/res/layout/fragment_options.xml b/app/src/main/res/layout/fragment_options.xml index bf9b49d034..f122108b76 100644 --- a/app/src/main/res/layout/fragment_options.xml +++ b/app/src/main/res/layout/fragment_options.xml @@ -11,16 +11,6 @@ android:layout_width="match_parent" android:layout_height="match_parent"> - - + app:layout_constraintTop_toTopOf="parent" /> - - + app:layout_constraintTop_toBottomOf="@id/cbLight" /> \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6f25252df7..2559fce7c2 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -76,10 +76,8 @@ Dark theme Advanced options - Compress IMAP data Show contact photos Use notification light - Prefer IPv4 connections Debug mode Select …