Added account setting to disable partial fetch

https://javaee.github.io/javamail/docs/NOTES.txt
pull/156/head
M66B 5 years ago
parent 56858282b9
commit f327b7b284

File diff suppressed because it is too large Load Diff

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

@ -457,6 +457,25 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/etInterval" />
<CheckBox
android:id="@+id/cbPartialFetch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_partial_fetch"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvIntervalRemark" />
<TextView
android:id="@+id/tvPartialFetchRemark"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/title_account_partial_fetch_hint"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="italic"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbPartialFetch" />
<!-- check -->
<Button
@ -467,7 +486,7 @@
android:tag="disable"
android:text="@string/title_check"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvIntervalRemark" />
app:layout_constraintTop_toBottomOf="@id/tvPartialFetchRemark" />
<eu.faircode.email.ContentLoadingProgressBar
android:id="@+id/pbCheck"
@ -740,7 +759,8 @@
cbNotify,tvNotifyPro,
cbSynchronize,cbPrimary,
cbBrowse,tvBrowseHint,
tvInterval,etInterval,tvIntervalRemark" />
tvInterval,etInterval,tvIntervalRemark,
cbPartialFetch,tvPartialFetchRemark" />
<androidx.constraintlayout.widget.Group
android:id="@+id/grpFolders"

@ -281,6 +281,7 @@
<string name="title_account_name">Account name</string>
<string name="title_account_name_hint">Used to differentiate folders</string>
<string name="title_account_interval_hint">Frequency of refreshing the connection for push messages or frequency of checking for new messages</string>
<string name="title_account_partial_fetch_hint">Disable this only in case of empty messages or corrupt attachments</string>
<string name="title_account_signature">Signature text</string>
<string name="title_account_color">Color</string>
<string name="title_account_notify">Separate notifications</string>
@ -309,6 +310,7 @@
<string name="title_primary_account">Primary (default account)</string>
<string name="title_primary_identity">Primary (default identity)</string>
<string name="title_keep_alive_interval">Keep-alive/poll interval (minutes)</string>
<string name="title_partial_fetch" translatable="false">Partial fetch</string>
<string name="title_check">Check</string>
<string name="title_no_name">Name missing</string>
<string name="title_no_email">Email address missing</string>

Loading…
Cancel
Save