Small optimization

pull/194/head
M66B 5 years ago
parent 22a6d2a0eb
commit 0749728c3d

@ -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)

Loading…
Cancel
Save