Removed compress / prever IPv4 options

This commit is contained in:
M66B 2018-09-21 13:18:26 +00:00
parent 8dbf639a48
commit a1b2f99983
9 changed files with 13 additions and 61 deletions

View File

@ -147,7 +147,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
EntityAccount account = db.account().getAccount(folder.account);
if (imessages == null) {
Properties props = MessageHelper.getSessionProperties(context, account.auth_type);
Properties props = MessageHelper.getSessionProperties(account.auth_type);
props.setProperty("mail.imap.throwsearchexception", "true");
Session isession = Session.getInstance(props, null);

View File

@ -467,7 +467,7 @@ public class FragmentAccount extends FragmentEx {
// Check IMAP server / get folders
List<EntityFolder> 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 {

View File

@ -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);

View File

@ -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");

View File

@ -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

View File

@ -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");
}

View File

@ -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

View File

@ -11,16 +11,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<CheckBox
android:id="@+id/cbCompressImap"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_compress_imap"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<CheckBox
android:id="@+id/cbAvatars"
android:layout_width="wrap_content"
@ -29,7 +19,7 @@
android:layout_marginTop="12dp"
android:text="@string/title_advanced_avatars"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbCompressImap" />
app:layout_constraintTop_toTopOf="parent" />
<CheckBox
android:id="@+id/cbLight"
@ -41,16 +31,6 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbAvatars" />
<CheckBox
android:id="@+id/cbIpV4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_ipv4"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbLight" />
<CheckBox
android:id="@+id/cbDebug"
android:layout_width="wrap_content"
@ -59,6 +39,6 @@
android:layout_marginTop="12dp"
android:text="@string/title_advanced_debug"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbIpV4" />
app:layout_constraintTop_toBottomOf="@id/cbLight" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>

View File

@ -76,10 +76,8 @@
<string name="title_setup_dark_theme">Dark theme</string>
<string name="title_advanced">Advanced options</string>
<string name="title_advanced_compress_imap">Compress IMAP data</string>
<string name="title_advanced_avatars">Show contact photos</string>
<string name="title_advanced_light">Use notification light</string>
<string name="title_advanced_ipv4">Prefer IPv4 connections</string>
<string name="title_advanced_debug">Debug mode</string>
<string name="title_select">Select &#8230;</string>