From 9efb3c6dc685bf8505dbe4e6180b9c15a2133e42 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sat, 12 Jan 2019 08:55:46 +0100 Subject: [PATCH] synchronize around notification update from corrected messages --- .../java/eu/siacs/conversations/parser/MessageParser.java | 2 +- .../siacs/conversations/services/NotificationService.java | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/parser/MessageParser.java b/src/main/java/eu/siacs/conversations/parser/MessageParser.java index ddab3b778..cf7c45366 100644 --- a/src/main/java/eu/siacs/conversations/parser/MessageParser.java +++ b/src/main/java/eu/siacs/conversations/parser/MessageParser.java @@ -543,7 +543,6 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece } extractChatState(mXmppConnectionService.find(account, counterpart.asBareJid()), isTypeGroupChat, packet); mXmppConnectionService.updateMessage(replacedMessage, uuid); - mXmppConnectionService.getNotificationService().updateNotification(false); if (mXmppConnectionService.confirmMessages() && replacedMessage.getStatus() == Message.STATUS_RECEIVED && (replacedMessage.trusted() || replacedMessage.getType() == Message.TYPE_PRIVATE) @@ -557,6 +556,7 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece conversation.getAccount().getPgpDecryptionService().decrypt(replacedMessage, false); } } + mXmppConnectionService.getNotificationService().updateNotification(); return; } else { Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": received message correction but verification didn't check out"); diff --git a/src/main/java/eu/siacs/conversations/services/NotificationService.java b/src/main/java/eu/siacs/conversations/services/NotificationService.java index 1ea7b18f9..1894b91dc 100644 --- a/src/main/java/eu/siacs/conversations/services/NotificationService.java +++ b/src/main/java/eu/siacs/conversations/services/NotificationService.java @@ -366,7 +366,13 @@ public class NotificationService { mBuilder.setColor(ContextCompat.getColor(mXmppConnectionService, R.color.green600)); } - public void updateNotification(final boolean notify) { + public void updateNotification() { + synchronized (notifications) { + updateNotification(false); + } + } + + private void updateNotification(final boolean notify) { updateNotification(notify, null, false); }