diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2016-09-28 12:39:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-28 12:39:00 +0200 |
commit | e275fd8143ab4ca9775c30d64041256a04f7f875 (patch) | |
tree | e365306d5c27f3e90318c5ad2496170358b72af3 /src/main/java/eu/siacs/conversations/services/XmppConnectionService.java | |
parent | 43f5dfe1746a9986d0c4ffa9a0c193aa3cf509a1 (diff) | |
parent | 41db773b087afc3c915336ef4ba3295f9cee7628 (diff) |
Merge pull request #2027 from danielegobbetti/wear-reply-dismiss-notification
Dismiss the notification when replying from a wear notification [needs review!]
Diffstat (limited to 'src/main/java/eu/siacs/conversations/services/XmppConnectionService.java')
-rw-r--r-- | src/main/java/eu/siacs/conversations/services/XmppConnectionService.java | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index 52a846f2..39e28f93 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -575,7 +575,7 @@ public class XmppConnectionService extends Service { if (remoteInput != null && c != null) { final CharSequence body = remoteInput.getCharSequence("text_reply"); if (body != null && body.length() > 0) { - directReply(c, body.toString()); + directReply(c, body.toString(),intent.getBooleanExtra("dismiss_notification",false)); } } break; @@ -708,7 +708,7 @@ public class XmppConnectionService extends Service { } } - private void directReply(Conversation conversation, String body) { + private void directReply(Conversation conversation, String body, final boolean dismissAfterReply) { Message message = new Message(conversation,body,conversation.getNextEncryption()); message.markUnread(); if (message.getEncryption() == Message.ENCRYPTION_PGP) { @@ -717,7 +717,11 @@ public class XmppConnectionService extends Service { public void success(Message message) { message.setEncryption(Message.ENCRYPTION_DECRYPTED); sendMessage(message); - mNotificationService.pushFromDirectReply(message); + if (dismissAfterReply) { + markRead(message.getConversation(),true); + } else { + mNotificationService.pushFromDirectReply(message); + } } @Override @@ -732,7 +736,11 @@ public class XmppConnectionService extends Service { }); } else { sendMessage(message); - mNotificationService.pushFromDirectReply(message); + if (dismissAfterReply) { + markRead(conversation,true); + } else { + mNotificationService.pushFromDirectReply(message); + } } } |