From 16f2aad5973163e7d473153af282f5fa5783ec36 Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Fri, 3 Aug 2018 23:56:13 +0200 Subject: also mark previews unread messages as read --- src/main/java/de/pixart/messenger/parser/MessageParser.java | 12 +++++++++++- .../java/de/pixart/messenger/ui/ConversationFragment.java | 4 +++- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'src/main') diff --git a/src/main/java/de/pixart/messenger/parser/MessageParser.java b/src/main/java/de/pixart/messenger/parser/MessageParser.java index e86758fd7..7cfd69e8b 100644 --- a/src/main/java/de/pixart/messenger/parser/MessageParser.java +++ b/src/main/java/de/pixart/messenger/parser/MessageParser.java @@ -844,7 +844,17 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece if (message.addReadByMarker(readByMarker)) { Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": added read by (" + readByMarker.getRealJid() + ") to message '" + message.getBody() + "'"); mXmppConnectionService.updateMessage(message, false); - mXmppConnectionService.markMessage(account, from.asBareJid(), id, Message.STATUS_SEND_DISPLAYED); + final Message displayedMessage = mXmppConnectionService.markMessage(account, from.asBareJid(), id, Message.STATUS_SEND_DISPLAYED); + Message m = displayedMessage == null ? null : displayedMessage.prev(); + while (m != null + && m.getStatus() == Message.STATUS_SEND_RECEIVED + && m.getTimeSent() < displayedMessage.getTimeSent()) { + mXmppConnectionService.markMessage(m, Message.STATUS_SEND_DISPLAYED); + m = m.prev(); + } + if (displayedMessage != null && selfAddressed) { + dismissNotification(account, counterpart, query); + } } } } diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java index 58f9441fa..f1ebb0d63 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java @@ -2540,7 +2540,9 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke if (!ReadByMarker.contains(marker, addedMarkers)) { addedMarkers.add(marker); //may be put outside this condition. set should do dedup anyway MucOptions.User user = mucOptions.findUser(marker); - shownMarkers.add(user); + if (user != null && !users.contains(user)) { + shownMarkers.add(user); + } } } final ReadByMarker markerForSender = ReadByMarker.from(messageList.get(i)); -- cgit v1.2.3