mirror of https://github.com/M66B/FairEmail.git
Added option to synchronize messages without date
This commit is contained in:
parent
7bab4df9b7
commit
d878f76170
|
@ -1652,6 +1652,7 @@ class Core {
|
|||
keep_days++;
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
boolean sync_nodate = prefs.getBoolean("sync_nodate", false);
|
||||
boolean sync_unseen = prefs.getBoolean("sync_unseen", false);
|
||||
boolean sync_flagged = prefs.getBoolean("sync_flagged", false);
|
||||
boolean sync_kept = prefs.getBoolean("sync_kept", true);
|
||||
|
@ -1726,6 +1727,8 @@ class Core {
|
|||
// Reduce list of local uids
|
||||
Flags flags = ifolder.getPermanentFlags();
|
||||
SearchTerm searchTerm = new ReceivedDateTerm(ComparisonTerm.GE, new Date(sync_time));
|
||||
if (sync_nodate)
|
||||
searchTerm = new OrTerm(searchTerm, new ReceivedDateTerm(ComparisonTerm.LT, new Date(365 * 24 * 3600 * 1000L)));
|
||||
if (sync_unseen && flags.contains(Flags.Flag.SEEN))
|
||||
searchTerm = new OrTerm(searchTerm, new FlagTerm(new Flags(Flags.Flag.SEEN), false));
|
||||
if (sync_flagged && flags.contains(Flags.Flag.FLAGGED))
|
||||
|
|
|
@ -68,6 +68,7 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
|
|||
private TextView tvScheduleStart;
|
||||
private TextView tvScheduleEnd;
|
||||
private CheckBox[] cbDay;
|
||||
private SwitchCompat swNodate;
|
||||
private SwitchCompat swUnseen;
|
||||
private SwitchCompat swFlagged;
|
||||
private SwitchCompat swDeleteUnseen;
|
||||
|
@ -83,7 +84,7 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
|
|||
|
||||
private final static String[] RESET_OPTIONS = new String[]{
|
||||
"enabled", "poll_interval", "schedule", "schedule_start", "schedule_end",
|
||||
"sync_unseen", "sync_flagged", "delete_unseen", "sync_kept", "sync_folders", "subscriptions",
|
||||
"sync_nodate", "sync_unseen", "sync_flagged", "delete_unseen", "sync_kept", "sync_folders", "subscriptions",
|
||||
"check_mx", "check_reply"
|
||||
};
|
||||
|
||||
|
@ -113,6 +114,7 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
|
|||
view.findViewById(R.id.cbDay5),
|
||||
view.findViewById(R.id.cbDay6)
|
||||
};
|
||||
swNodate = view.findViewById(R.id.swNodate);
|
||||
swUnseen = view.findViewById(R.id.swUnseen);
|
||||
swFlagged = view.findViewById(R.id.swFlagged);
|
||||
swDeleteUnseen = view.findViewById(R.id.swDeleteUnseen);
|
||||
|
@ -214,6 +216,14 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
|
|||
});
|
||||
}
|
||||
|
||||
swNodate.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("sync_nodate", checked).apply();
|
||||
ServiceSynchronize.reload(getContext(), null, false, "sync_nodate=" + checked);
|
||||
}
|
||||
});
|
||||
|
||||
swUnseen.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
|
@ -353,6 +363,7 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
|
|||
for (int i = 0; i < 7; i++)
|
||||
cbDay[i].setChecked(prefs.getBoolean("schedule_day" + i, true));
|
||||
|
||||
swNodate.setChecked(prefs.getBoolean("sync_nodate", false));
|
||||
swUnseen.setChecked(prefs.getBoolean("sync_unseen", false));
|
||||
swFlagged.setChecked(prefs.getBoolean("sync_flagged", false));
|
||||
swDeleteUnseen.setChecked(prefs.getBoolean("delete_unseen", false));
|
||||
|
|
|
@ -257,6 +257,29 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/cbDay6" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swNodate"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_advanced_no_date"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvAdvanced"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<eu.faircode.email.FixedTextView
|
||||
android:id="@+id/tvNodateHint"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="48dp"
|
||||
android:text="@string/title_advanced_no_date_hint"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
android:textStyle="italic"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swNodate" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swUnseen"
|
||||
android:layout_width="0dp"
|
||||
|
@ -265,7 +288,7 @@
|
|||
android:text="@string/title_advanced_unseen"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvAdvanced"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvNodateHint"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<eu.faircode.email.FixedTextView
|
||||
|
|
|
@ -262,6 +262,7 @@
|
|||
<string name="title_advanced_always">Always synchronize these accounts</string>
|
||||
<string name="title_advanced_schedule">Schedule</string>
|
||||
<string name="title_advanced_advanced">Advanced</string>
|
||||
<string name="title_advanced_no_date">Messages without date</string>
|
||||
<string name="title_advanced_unseen">All unread messages</string>
|
||||
<string name="title_advanced_flagged">All starred messages</string>
|
||||
<string name="title_advanced_delete_unseen">Delete old unread messages</string>
|
||||
|
@ -455,6 +456,7 @@
|
|||
<string name="title_advanced_schedule_hint">Tap on a time to set a time</string>
|
||||
<string name="title_advanced_check_mx">Check sender email addresses on synchronizing messages</string>
|
||||
<string name="title_advanced_check_reply">Check reply email addresses on synchronizing messages</string>
|
||||
<string name="title_advanced_no_date_hint">Some providers store messages with an unknown, invalid or future date as messages without date</string>
|
||||
<string name="title_advanced_unseen_hint">Some providers don\'t support this properly, which may cause synchronizing none or all messages</string>
|
||||
<string name="title_advanced_deleted_unseen">When disabled, unread messages are kept on the device forever</string>
|
||||
<string name="title_advanced_sync_kept_hint">This will transfer extra data and consume extra battery power, especially if a lot of messages are stored on the device</string>
|
||||
|
|
Loading…
Reference in New Issue