mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-13 04:25:47 +02:00
Added option to show notifications for contacts only
This commit is contained in:
@@ -1501,6 +1501,8 @@ class Core {
|
||||
EntityAccount account, final EntityFolder folder,
|
||||
POP3Folder ifolder, POP3Store istore, State state) throws MessagingException {
|
||||
DB db = DB.getInstance(context);
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
boolean notify_known = prefs.getBoolean("notify_known", false);
|
||||
|
||||
Log.i(folder.name + " POP sync type=" + folder.type + " connected=" + (ifolder != null));
|
||||
|
||||
@@ -1641,6 +1643,8 @@ class Core {
|
||||
message.sender = MessageHelper.getSortKey(message.from);
|
||||
Uri lookupUri = ContactInfo.getLookupUri(message.from);
|
||||
message.avatar = (lookupUri == null ? null : lookupUri.toString());
|
||||
if (message.avatar == null && notify_known)
|
||||
message.ui_ignored = true;
|
||||
|
||||
// No MX check
|
||||
|
||||
@@ -2142,6 +2146,7 @@ class Core {
|
||||
|
||||
DB db = DB.getInstance(context);
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
boolean notify_known = prefs.getBoolean("notify_known", false);
|
||||
|
||||
// Find message by uid (fast, no headers required)
|
||||
EntityMessage message = db.message().getMessageByUid(folder.id, uid);
|
||||
@@ -2276,6 +2281,8 @@ class Core {
|
||||
message.sender = MessageHelper.getSortKey(message.from);
|
||||
Uri lookupUri = ContactInfo.getLookupUri(message.from);
|
||||
message.avatar = (lookupUri == null ? null : lookupUri.toString());
|
||||
if (message.avatar == null && notify_known)
|
||||
message.ui_ignored = true;
|
||||
|
||||
boolean check_mx = prefs.getBoolean("check_mx", false);
|
||||
if (check_mx)
|
||||
|
||||
@@ -70,6 +70,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
|
||||
|
||||
private SwitchCompat swBadge;
|
||||
private SwitchCompat swUnseenIgnored;
|
||||
private SwitchCompat swNotifyKnown;
|
||||
private SwitchCompat swNotifySummary;
|
||||
private SwitchCompat swNotifyRemove;
|
||||
private SwitchCompat swNotifyClear;
|
||||
@@ -90,7 +91,8 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
|
||||
"notify_flag", "notify_seen", "notify_snooze",
|
||||
"light", "sound",
|
||||
"badge", "unseen_ignored",
|
||||
"notify_summary", "notify_remove", "notify_clear", "notify_preview", "notify_preview_all", "wearable_preview",
|
||||
"notify_known", "notify_summary", "notify_remove", "notify_clear",
|
||||
"notify_preview", "notify_preview_all", "wearable_preview",
|
||||
"biometrics_notify",
|
||||
"alert_once"
|
||||
};
|
||||
@@ -126,6 +128,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
|
||||
|
||||
swBadge = view.findViewById(R.id.swBadge);
|
||||
swUnseenIgnored = view.findViewById(R.id.swUnseenIgnored);
|
||||
swNotifyKnown = view.findViewById(R.id.swNotifyKnown);
|
||||
swNotifySummary = view.findViewById(R.id.swNotifySummary);
|
||||
swNotifyRemove = view.findViewById(R.id.swNotifyRemove);
|
||||
swNotifyClear = view.findViewById(R.id.swNotifyClear);
|
||||
@@ -300,6 +303,14 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
|
||||
}
|
||||
});
|
||||
|
||||
swNotifyKnown.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("notify_known", checked).apply();
|
||||
enableOptions();
|
||||
}
|
||||
});
|
||||
|
||||
swNotifySummary.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
@@ -434,6 +445,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
|
||||
|
||||
swBadge.setChecked(prefs.getBoolean("badge", true));
|
||||
swUnseenIgnored.setChecked(prefs.getBoolean("unseen_ignored", false));
|
||||
swNotifyKnown.setChecked(prefs.getBoolean("notify_known", false));
|
||||
swNotifySummary.setChecked(prefs.getBoolean("notify_summary", false));
|
||||
swNotifyRemove.setChecked(prefs.getBoolean("notify_remove", true));
|
||||
swNotifyClear.setChecked(prefs.getBoolean("notify_clear", false));
|
||||
|
||||
Reference in New Issue
Block a user