mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-12 12:03:17 +02:00
Default contact age limit
This commit is contained in:
@@ -39,6 +39,7 @@ import org.json.JSONObject;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -102,9 +103,13 @@ public class EntityContact implements Serializable {
|
||||
@NonNull EntityAccount account,
|
||||
@NonNull EntityFolder folder,
|
||||
@NonNull EntityMessage message) {
|
||||
if (account.protocol == EntityAccount.TYPE_IMAP) {
|
||||
int days = (folder.isOutgoing() ? folder.keep_days : folder.sync_days);
|
||||
if (message.received < account.created - days * 24 * 3600 * 1000L)
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
int purge_contact_age = prefs.getInt("purge_contact_age", 1);
|
||||
if (purge_contact_age > 0) {
|
||||
long now = new Date().getTime();
|
||||
long ago = now - purge_contact_age * 30 * 24 * 3600 * 1000L;
|
||||
if (message.received < ago)
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -114,7 +119,6 @@ public class EntityContact implements Serializable {
|
||||
EntityFolder.JUNK.equals(folder.type))
|
||||
return;
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
boolean suggest_sent = prefs.getBoolean("suggest_sent", true);
|
||||
boolean suggest_received = prefs.getBoolean("suggest_received", false);
|
||||
|
||||
|
||||
@@ -944,7 +944,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
|
||||
int purge_contact_age = prefs.getInt("purge_contact_age", 0);
|
||||
int purge_contact_age = prefs.getInt("purge_contact_age", 1);
|
||||
int purge_contact_freq = prefs.getInt("purge_contact_freq", 0);
|
||||
|
||||
swKeyboard.setChecked(prefs.getBoolean("keyboard", true));
|
||||
|
||||
@@ -334,7 +334,7 @@ public class WorkerCleanup extends Worker {
|
||||
Fts4DbHelper.optimize(sdb);
|
||||
}
|
||||
|
||||
int purge_contact_age = prefs.getInt("purge_contact_age", 0);
|
||||
int purge_contact_age = prefs.getInt("purge_contact_age", 1);
|
||||
int purge_contact_freq = prefs.getInt("purge_contact_freq", 0);
|
||||
|
||||
Log.breadcrumb("worker", "cleanup", "contacts" +
|
||||
|
||||
Reference in New Issue
Block a user