Allow disabling email address specific notification channels

This commit is contained in:
M66B 2019-04-17 10:23:51 +02:00
parent 6f833fa617
commit e0ca27a9cc
1 changed files with 10 additions and 2 deletions

View File

@ -1535,8 +1535,16 @@ class Core {
// Current // Current
for (TupleMessageEx message : messages) { for (TupleMessageEx message : messages) {
String group = Long.toString(message.accountNotify ? message.account : 0); // Check if notification channel enabled
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.O &&
message.from != null && message.from.length > 0) {
InternetAddress from = (InternetAddress) message.from[0];
NotificationChannel channel = nm.getNotificationChannel("notification." + from.getAddress().toLowerCase());
if (channel != null && channel.getImportance() == NotificationManager.IMPORTANCE_NONE)
continue;
}
String group = Long.toString(message.accountNotify ? message.account : 0);
if (!groupMessages.containsKey(group)) { if (!groupMessages.containsKey(group)) {
groupMessages.put(group, new ArrayList<TupleMessageEx>()); groupMessages.put(group, new ArrayList<TupleMessageEx>());
if (!groupNotifying.containsKey(group)) if (!groupNotifying.containsKey(group))
@ -1735,7 +1743,7 @@ class Core {
message.from != null && message.from.length > 0) { message.from != null && message.from.length > 0) {
InternetAddress from = (InternetAddress) message.from[0]; InternetAddress from = (InternetAddress) message.from[0];
NotificationChannel channel = nm.getNotificationChannel("notification." + from.getAddress().toLowerCase()); NotificationChannel channel = nm.getNotificationChannel("notification." + from.getAddress().toLowerCase());
if (channel != null && channel.getImportance() != NotificationManager.IMPORTANCE_NONE) if (channel != null)
channelName = channel.getId(); channelName = channel.getId();
} }
if (channelName == null) if (channelName == null)