diff options
author | Christian Schneppe <christian.schneppe@pix-art.de> | 2019-11-03 19:10:09 +0100 |
---|---|---|
committer | Christian Schneppe <christian.schneppe@pix-art.de> | 2019-11-03 19:10:09 +0100 |
commit | 6a672b4aacfd62fcbbbe3ea031bf53c0daace132 (patch) | |
tree | 02062605c3f3d81d1aeda07211c0c5e8b6944c1a | |
parent | 78ef54d600163638e74cdccb1f44f19dfa7ec3b4 (diff) |
mark silent notifications as local only
this will prevent silent notifications (for example those supressed by grace period) showing up on my smart watch
-rw-r--r-- | src/main/java/de/pixart/messenger/parser/MessageParser.java | 3 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/services/NotificationService.java | 2 |
2 files changed, 5 insertions, 0 deletions
diff --git a/src/main/java/de/pixart/messenger/parser/MessageParser.java b/src/main/java/de/pixart/messenger/parser/MessageParser.java index ab65c101d..020866fa1 100644 --- a/src/main/java/de/pixart/messenger/parser/MessageParser.java +++ b/src/main/java/de/pixart/messenger/parser/MessageParser.java @@ -941,6 +941,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/de/pixart/messenger/services/NotificationService.java b/src/main/java/de/pixart/messenger/services/NotificationService.java index 9ad7850a1..dcbff4f17 100644 --- a/src/main/java/de/pixart/messenger/services/NotificationService.java +++ b/src/main/java/de/pixart/messenger/services/NotificationService.java @@ -457,6 +457,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); |