mark silent notifications as local only

Daniel Gultsch created

this will prevent silent notifications (for example those supressed by grace
period) showing up on my smart watch

Change summary

src/main/java/eu/siacs/conversations/parser/MessageParser.java         | 3 
src/main/java/eu/siacs/conversations/services/NotificationService.java | 2 
2 files changed, 5 insertions(+)

Detailed changes

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

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