Default contact age limit

pull/217/head
M66B 11 months ago
parent 5875bb603e
commit ff31677d7c

@ -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" +

Loading…
Cancel
Save