1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-28 02:37:16 +00:00

Small optimization

This commit is contained in:
M66B 2021-02-08 08:38:00 +01:00
parent 22a6d2a0eb
commit 0749728c3d

View file

@ -3336,14 +3336,20 @@ class Core {
} }
private static void updateContactInfo(Context context, final EntityFolder folder, final EntityMessage message) { private static void updateContactInfo(Context context, final EntityFolder folder, final EntityMessage message) {
DB db = DB.getInstance(context);
if (EntityFolder.DRAFTS.equals(folder.type) || if (EntityFolder.DRAFTS.equals(folder.type) ||
EntityFolder.ARCHIVE.equals(folder.type) || EntityFolder.ARCHIVE.equals(folder.type) ||
EntityFolder.TRASH.equals(folder.type) || EntityFolder.TRASH.equals(folder.type) ||
EntityFolder.JUNK.equals(folder.type)) EntityFolder.JUNK.equals(folder.type))
return; return;
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean suggest_sent = prefs.getBoolean("suggest_sent", true);
boolean suggest_received = prefs.getBoolean("suggest_received", false);
if (!suggest_sent && !suggest_received)
return;
DB db = DB.getInstance(context);
int type = (folder.isOutgoing() ? EntityContact.TYPE_TO : EntityContact.TYPE_FROM); int type = (folder.isOutgoing() ? EntityContact.TYPE_TO : EntityContact.TYPE_FROM);
// Check if from self // Check if from self
@ -3364,10 +3370,6 @@ class Core {
} }
} }
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean suggest_sent = prefs.getBoolean("suggest_sent", true);
boolean suggest_received = prefs.getBoolean("suggest_received", false);
if (type == EntityContact.TYPE_TO && !suggest_sent) if (type == EntityContact.TYPE_TO && !suggest_sent)
return; return;
if (type == EntityContact.TYPE_FROM && !suggest_received) if (type == EntityContact.TYPE_FROM && !suggest_received)