mirror of
https://github.com/M66B/FairEmail.git
synced 2026-01-03 03:19:24 +01:00
Added account setting to disable partial fetch
https://javaee.github.io/javamail/docs/NOTES.txt
This commit is contained in:
@@ -256,6 +256,10 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
||||
|
||||
// Get properties
|
||||
Properties props = MessageHelper.getSessionProperties(account.auth_type, account.realm, account.insecure);
|
||||
if (!account.partial_fetch) {
|
||||
props.put("mail.imap.partialfetch", "false");
|
||||
props.put("mail.imaps.partialfetch", "false");
|
||||
}
|
||||
props.put("mail." + protocol + ".separatestoreconnection", "true");
|
||||
|
||||
// Create session
|
||||
|
||||
@@ -54,7 +54,7 @@ import io.requery.android.database.sqlite.RequerySQLiteOpenHelperFactory;
|
||||
// https://developer.android.com/topic/libraries/architecture/room.html
|
||||
|
||||
@Database(
|
||||
version = 87,
|
||||
version = 88,
|
||||
entities = {
|
||||
EntityIdentity.class,
|
||||
EntityAccount.class,
|
||||
@@ -869,6 +869,13 @@ public abstract class DB extends RoomDatabase {
|
||||
db.execSQL("DROP VIEW `folderview`");
|
||||
}
|
||||
})
|
||||
.addMigrations(new Migration(87, 88) {
|
||||
@Override
|
||||
public void migrate(SupportSQLiteDatabase db) {
|
||||
Log.i("DB migration from version " + startVersion + " to " + endVersion);
|
||||
db.execSQL("ALTER TABLE `account` ADD COLUMN `partial_fetch` INTEGER NOT NULL DEFAULT 1");
|
||||
}
|
||||
})
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@@ -89,6 +89,8 @@ public class EntityAccount extends EntityOrder implements Serializable {
|
||||
public Long swipe_right;
|
||||
@NonNull
|
||||
public Integer poll_interval; // keep-alive interval
|
||||
@NonNull
|
||||
public Boolean partial_fetch = true;
|
||||
public String prefix; // namespace, obsolete
|
||||
|
||||
public Long created;
|
||||
@@ -164,6 +166,7 @@ public class EntityAccount extends EntityOrder implements Serializable {
|
||||
json.put("swipe_right", swipe_right);
|
||||
|
||||
json.put("poll_interval", poll_interval);
|
||||
json.put("partial_fetch", partial_fetch);
|
||||
// not created
|
||||
// not state
|
||||
// not error
|
||||
@@ -209,6 +212,11 @@ public class EntityAccount extends EntityOrder implements Serializable {
|
||||
|
||||
account.poll_interval = json.getInt("poll_interval");
|
||||
|
||||
if (json.has("partial_fetch"))
|
||||
account.partial_fetch = json.getBoolean("partial_fetch");
|
||||
else
|
||||
account.partial_fetch = true;
|
||||
|
||||
return account;
|
||||
}
|
||||
|
||||
@@ -234,6 +242,7 @@ public class EntityAccount extends EntityOrder implements Serializable {
|
||||
Objects.equals(this.swipe_left, other.swipe_left) &&
|
||||
Objects.equals(this.swipe_right, other.swipe_right) &&
|
||||
this.poll_interval.equals(other.poll_interval) &&
|
||||
this.partial_fetch == other.partial_fetch &&
|
||||
Objects.equals(this.created, other.created) &&
|
||||
Objects.equals(this.tbd, other.tbd) &&
|
||||
Objects.equals(this.state, other.state) &&
|
||||
|
||||
@@ -118,6 +118,7 @@ public class FragmentAccount extends FragmentBase {
|
||||
private CheckBox cbNotify;
|
||||
private CheckBox cbBrowse;
|
||||
private EditText etInterval;
|
||||
private CheckBox cbPartialFetch;
|
||||
|
||||
private Button btnCheck;
|
||||
private ContentLoadingProgressBar pbCheck;
|
||||
@@ -194,6 +195,7 @@ public class FragmentAccount extends FragmentBase {
|
||||
cbNotify = view.findViewById(R.id.cbNotify);
|
||||
cbBrowse = view.findViewById(R.id.cbBrowse);
|
||||
etInterval = view.findViewById(R.id.etInterval);
|
||||
cbPartialFetch = view.findViewById(R.id.cbPartialFetch);
|
||||
|
||||
btnCheck = view.findViewById(R.id.btnCheck);
|
||||
pbCheck = view.findViewById(R.id.pbCheck);
|
||||
@@ -756,6 +758,7 @@ public class FragmentAccount extends FragmentBase {
|
||||
args.putBoolean("notify", cbNotify.isChecked());
|
||||
args.putBoolean("browse", cbBrowse.isChecked());
|
||||
args.putString("interval", etInterval.getText().toString());
|
||||
args.putBoolean("partial_fetch", cbPartialFetch.isChecked());
|
||||
|
||||
args.putSerializable("drafts", drafts);
|
||||
args.putSerializable("sent", sent);
|
||||
@@ -804,6 +807,7 @@ public class FragmentAccount extends FragmentBase {
|
||||
boolean notify = args.getBoolean("notify");
|
||||
boolean browse = args.getBoolean("browse");
|
||||
String interval = args.getString("interval");
|
||||
boolean partial_fetch = args.getBoolean("partial_fetch");
|
||||
|
||||
EntityFolder drafts = (EntityFolder) args.getSerializable("drafts");
|
||||
EntityFolder sent = (EntityFolder) args.getSerializable("sent");
|
||||
@@ -846,7 +850,8 @@ public class FragmentAccount extends FragmentBase {
|
||||
boolean reload = (check || account == null ||
|
||||
account.synchronize != synchronize ||
|
||||
account.notify != notify ||
|
||||
!account.poll_interval.equals(Integer.parseInt(interval)));
|
||||
!account.poll_interval.equals(Integer.parseInt(interval)) ||
|
||||
account.partial_fetch != partial_fetch);
|
||||
|
||||
Long last_connected = null;
|
||||
if (account != null && synchronize == account.synchronize)
|
||||
@@ -920,6 +925,7 @@ public class FragmentAccount extends FragmentBase {
|
||||
account.notify = notify;
|
||||
account.browse = browse;
|
||||
account.poll_interval = Integer.parseInt(interval);
|
||||
account.partial_fetch = partial_fetch;
|
||||
|
||||
if (!update)
|
||||
account.created = now;
|
||||
@@ -1136,6 +1142,7 @@ public class FragmentAccount extends FragmentBase {
|
||||
cbPrimary.setChecked(account == null ? false : account.primary);
|
||||
cbBrowse.setChecked(account == null ? true : account.browse);
|
||||
etInterval.setText(account == null ? "" : Long.toString(account.poll_interval));
|
||||
cbPartialFetch.setChecked(account == null ? true : account.partial_fetch);
|
||||
|
||||
color = (account == null || account.color == null ? Color.TRANSPARENT : account.color);
|
||||
|
||||
|
||||
@@ -137,7 +137,6 @@ public class MessageHelper {
|
||||
//props.put("mail.imaps.compress.strategy", "0");
|
||||
|
||||
props.put("mail.imaps.throwsearchexception", "true");
|
||||
//props.put("mail.imaps.partialfetch", "false");
|
||||
props.put("mail.imaps.fetchsize", Integer.toString(FETCH_SIZE));
|
||||
props.put("mail.imaps.peek", "true");
|
||||
|
||||
@@ -162,7 +161,6 @@ public class MessageHelper {
|
||||
props.put("mail.imap.compress.enable", "true");
|
||||
|
||||
props.put("mail.imap.throwsearchexception", "true");
|
||||
//props.put("mail.imap.partialfetch", "false");
|
||||
props.put("mail.imap.fetchsize", Integer.toString(FETCH_SIZE));
|
||||
props.put("mail.imap.peek", "true");
|
||||
|
||||
|
||||
@@ -570,6 +570,10 @@ public class ServiceSynchronize extends LifecycleService {
|
||||
|
||||
// Get properties
|
||||
Properties props = MessageHelper.getSessionProperties(account.auth_type, account.realm, account.insecure);
|
||||
if (!account.partial_fetch) {
|
||||
props.put("mail.imap.partialfetch", "false");
|
||||
props.put("mail.imaps.partialfetch", "false");
|
||||
}
|
||||
|
||||
// Create session
|
||||
final Session isession = Session.getInstance(props, null);
|
||||
|
||||
Reference in New Issue
Block a user