From adfbe59e5785e4858718d4ad5113f51ae37c91b9 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Fri, 1 Nov 2019 11:03:54 +0100 Subject: [PATCH] mark silent notifications as local only this will prevent silent notifications (for example those supressed by grace period) showing up on my smart watch --- src/main/java/eu/siacs/conversations/parser/MessageParser.java | 3 +++ .../eu/siacs/conversations/services/NotificationService.java | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/main/java/eu/siacs/conversations/parser/MessageParser.java b/src/main/java/eu/siacs/conversations/parser/MessageParser.java index b9bedec1a..84bee6408 100644 --- a/src/main/java/eu/siacs/conversations/parser/MessageParser.java +++ b/src/main/java/eu/siacs/conversations/parser/MessageParser.java @@ -827,6 +827,9 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece final Jid sender = InvalidJid.getNullForInvalid(displayed.getAttributeAsJid("sender")); if (packet.fromAccount(account) && !selfAddressed) { dismissNotification(account, counterpart, query); + if (query == null) { + activateGracePeriod(account); + } } else if (isTypeGroupChat) { Conversation conversation = mXmppConnectionService.find(account, counterpart.asBareJid()); if (conversation != null && id != null && sender != null) { diff --git a/src/main/java/eu/siacs/conversations/services/NotificationService.java b/src/main/java/eu/siacs/conversations/services/NotificationService.java index 4d31bfb6a..e61a6b296 100644 --- a/src/main/java/eu/siacs/conversations/services/NotificationService.java +++ b/src/main/java/eu/siacs/conversations/services/NotificationService.java @@ -442,6 +442,8 @@ public class NotificationService { } catch (SecurityException e) { Log.d(Config.LOGTAG, "unable to use custom notification sound " + uri.toString()); } + } else { + mBuilder.setLocalOnly(true); } if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { mBuilder.setCategory(Notification.CATEGORY_MESSAGE);