diff options
author | Christian Schneppe <christian.schneppe@pix-art.de> | 2020-02-01 10:10:00 +0100 |
---|---|---|
committer | Christian Schneppe <christian.schneppe@pix-art.de> | 2020-02-01 10:10:00 +0100 |
commit | 94d125945c980f54579d59d35ac36ed676ce4b34 (patch) | |
tree | 83a17f1ea85c53de6df4ea0b24865231cd83d503 /src/main | |
parent | 1373c583e98dc7eb051bca615f708071e6338210 (diff) |
add ability to reply on private messages in notifications
fixes #191
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/de/pixart/messenger/services/XmppConnectionService.java | 14 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/ConversationFragment.java | 4 |
2 files changed, 13 insertions, 5 deletions
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java index 2fc6f74c6..6f857889b 100644 --- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java +++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java @@ -695,7 +695,14 @@ public class XmppConnectionService extends Service { restoredFromDatabaseLatch.await(); final Conversation c = findConversationByUuid(uuid); if (c != null) { - directReply(c, body.toString(), dismissNotification); + boolean pn = false; + if (c.getMode() == Conversational.MODE_MULTI) { + if (c.getLatestMessage().isPrivateMessage()) { + pn = true; + c.setNextCounterpart(c.getLatestMessage().getCounterpart()); + } + } + directReply(c, body.toString(), dismissNotification, pn); } } catch (InterruptedException e) { Log.d(Config.LOGTAG, "unable to process direct reply"); @@ -949,8 +956,11 @@ public class XmppConnectionService extends Service { } } - private void directReply(Conversation conversation, String body, final boolean dismissAfterReply) { + private void directReply(Conversation conversation, String body, final boolean dismissAfterReply, final boolean pn) { Message message = new Message(conversation, body, conversation.getNextEncryption()); + if (pn) { + Message.configurePrivateMessage(message); + } message.markUnread(); if (message.getEncryption() == Message.ENCRYPTION_PGP) { getPgpEngine().encrypt(message, new UiCallback<Message>() { diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java index 6dbf00840..5a6f542f3 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java @@ -1334,9 +1334,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke deleteFile.setTitle(activity.getString(R.string.delete_x_file, UIHelper.getFileDescriptionString(activity, m))); } } - if (showError) { - showErrorMessage.setVisible(true); - } + showErrorMessage.setVisible(showError); final String mime = m.isFileOrImage() ? m.getMimeType() : null; if ((m.isGeoUri() && GeoHelper.openInOsmAnd(getActivity(), m)) || (mime != null && mime.startsWith("audio/"))) { openWith.setVisible(true); |