Revert "Experiment: leave on device for IMAP"

This reverts commit 75f1af1c98.
This commit is contained in:
M66B 2022-11-04 13:17:24 +01:00
parent aea038afc7
commit 0216388b29
4 changed files with 7 additions and 39 deletions

View File

@ -1847,14 +1847,8 @@ class Core {
}
}
if (BuildConfig.DEBUG && account.leave_on_device) {
EntityMessage message = db.message().getMessageByUid(folder.id, uid);
if (message != null)
db.message().setMessageUiDeleted(message.id, true);
} else {
int count = db.message().deleteMessage(folder.id, uid);
Log.i(folder.name + " delete local uid=" + uid + " count=" + count);
}
int count = db.message().deleteMessage(folder.id, uid);
Log.i(folder.name + " delete local uid=" + uid + " count=" + count);
} else
throw ex;
} finally {
@ -3896,14 +3890,8 @@ class Core {
// Delete local messages not at remote
Log.i(folder.name + " delete=" + uids.size());
for (Long uid : uids) {
if (BuildConfig.DEBUG && account.leave_on_device) {
EntityMessage message = db.message().getMessageByUid(folder.id, uid);
if (message != null)
db.message().setMessageUiDeleted(message.id, true);
} else {
int count = db.message().deleteMessage(folder.id, uid);
Log.i(folder.name + " delete local uid=" + uid + " count=" + count);
}
int count = db.message().deleteMessage(folder.id, uid);
Log.i(folder.name + " delete local uid=" + uid + " count=" + count);
}
List<EntityRule> rules = db.rule().getEnabledRules(folder.id);

View File

@ -125,7 +125,6 @@ public class FragmentAccount extends FragmentBase {
private TextView tvNotifyPro;
private CheckBox cbBrowse;
private CheckBox cbAutoSeen;
private CheckBox cbLeaveDevice;
private EditText etInterval;
private CheckBox cbNoop;
private CheckBox cbPartialFetch;
@ -245,7 +244,6 @@ public class FragmentAccount extends FragmentBase {
tvNotifyPro = view.findViewById(R.id.tvNotifyPro);
cbBrowse = view.findViewById(R.id.cbBrowse);
cbAutoSeen = view.findViewById(R.id.cbAutoSeen);
cbLeaveDevice = view.findViewById(R.id.cbLeaveDevice);
etInterval = view.findViewById(R.id.etInterval);
cbNoop = view.findViewById(R.id.cbNoop);
cbPartialFetch = view.findViewById(R.id.cbPartialFetch);
@ -513,9 +511,6 @@ public class FragmentAccount extends FragmentBase {
etInterval.setHint(Integer.toString(EntityAccount.DEFAULT_KEEP_ALIVE_INTERVAL));
if (!BuildConfig.DEBUG)
Helper.hide(cbLeaveDevice);
btnCheck.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@ -938,7 +933,6 @@ public class FragmentAccount extends FragmentBase {
args.putBoolean("notify", cbNotify.isChecked());
args.putBoolean("browse", cbBrowse.isChecked());
args.putBoolean("auto_seen", cbAutoSeen.isChecked());
args.putBoolean("leave_device", cbLeaveDevice.isChecked());
args.putString("interval", etInterval.getText().toString());
args.putBoolean("noop", cbNoop.isChecked());
args.putBoolean("partial_fetch", cbPartialFetch.isChecked());
@ -1014,7 +1008,6 @@ public class FragmentAccount extends FragmentBase {
boolean notify = args.getBoolean("notify");
boolean browse = args.getBoolean("browse");
boolean auto_seen = args.getBoolean("auto_seen");
boolean leave_device = args.getBoolean("leave_device");
String interval = args.getString("interval");
boolean noop = args.getBoolean("noop");
boolean partial_fetch = args.getBoolean("partial_fetch");
@ -1122,8 +1115,6 @@ public class FragmentAccount extends FragmentBase {
return true;
if (!Objects.equals(account.auto_seen, auto_seen))
return true;
if (!Objects.equals(account.leave_on_device, leave_device))
return true;
if (!Objects.equals(account.poll_interval, poll_interval))
return true;
if (!Objects.equals(account.keep_alive_noop, noop))
@ -1271,7 +1262,6 @@ public class FragmentAccount extends FragmentBase {
account.notify = notify;
account.browse = browse;
account.auto_seen = auto_seen;
account.leave_on_device = leave_device;
if (account.poll_interval != poll_interval) {
account.keep_alive_ok = false;
@ -1646,7 +1636,6 @@ public class FragmentAccount extends FragmentBase {
cbPrimary.setChecked(account == null ? false : account.primary);
cbBrowse.setChecked(account == null ? true : account.browse);
cbAutoSeen.setChecked(account == null ? true : account.auto_seen);
cbLeaveDevice.setChecked(account == null ? true : account.leave_on_device);
etInterval.setText(account == null ? "" : Long.toString(account.poll_interval));
cbNoop.setChecked(account == null ? true : account.keep_alive_noop);
cbPartialFetch.setChecked(account == null ? true : account.partial_fetch);

View File

@ -5312,7 +5312,7 @@ public class FragmentMessages extends FragmentBase
menu.findItem(R.id.menu_filter_unflagged).setVisible(folder);
menu.findItem(R.id.menu_filter_unknown).setVisible(folder && !drafts && !sent);
menu.findItem(R.id.menu_filter_snoozed).setVisible(folder && !drafts);
menu.findItem(R.id.menu_filter_deleted).setVisible(folder && (!perform_expunge || BuildConfig.DEBUG));
menu.findItem(R.id.menu_filter_deleted).setVisible(folder && !perform_expunge);
menu.findItem(R.id.menu_filter_duplicates).setVisible(viewType == AdapterMessage.ViewType.THREAD);
menu.findItem(R.id.menu_filter_trash).setVisible(viewType == AdapterMessage.ViewType.THREAD);

View File

@ -611,15 +611,6 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvBrowseHint" />
<CheckBox
android:id="@+id/cbLeaveDevice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_leave_on_device"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbAutoSeen" />
<!-- keep alive -->
<TextView
@ -630,7 +621,7 @@
android:text="@string/title_keep_alive_interval"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbLeaveDevice" />
app:layout_constraintTop_toBottomOf="@id/cbAutoSeen" />
<eu.faircode.email.EditTextPlain
android:id="@+id/etInterval"
@ -1168,7 +1159,7 @@
cbNotify,tvNotifyRemark,tvNotifyPro,
cbSynchronize,cbIgnoreSchedule,cbOnDemand,tvLeave,cbPrimary,
cbBrowse,tvBrowseHint,
cbAutoSeen,cbLeaveDevice,
cbAutoSeen,
tvInterval,etInterval,tvIntervalRemark,cbNoop,tvNoopRemark,
cbPartialFetch,tvPartialFetchRemark,cbIgnoreSize,rgDate,tvDateRemark,
cbUnicode,cbUnmeteredOnly,cbVpnOnly" />