From e245e2905836a2d6891e22d3d6d986bd8a5d3004 Mon Sep 17 00:00:00 2001 From: adbenitez Date: Mon, 2 Dec 2024 18:11:07 +0100 Subject: [PATCH] notify webxdc events, replies and reactions to own messages even if chat is muted --- .../notifications/NotificationCenter.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/thoughtcrime/securesms/notifications/NotificationCenter.java b/src/main/java/org/thoughtcrime/securesms/notifications/NotificationCenter.java index 59207078a..85db99903 100644 --- a/src/main/java/org/thoughtcrime/securesms/notifications/NotificationCenter.java +++ b/src/main/java/org/thoughtcrime/securesms/notifications/NotificationCenter.java @@ -360,7 +360,10 @@ public class NotificationCenter { } } - maybeAddNotification(accountId, dcChat, msgId, shortLine, tickerLine, true); + DcMsg quotedMsg = dcMsg.getQuotedMsg(); + boolean isMention = dcChat.isMultiUser() && quotedMsg != null && quotedMsg.isOutgoing(); + + maybeAddNotification(accountId, dcChat, msgId, shortLine, tickerLine, true, isMention); }); } @@ -376,7 +379,8 @@ public class NotificationCenter { DcContact sender = dcContext.getContact(contactId); String shortLine = context.getString(R.string.reaction_by_other, sender.getDisplayName(), reaction, dcMsg.getSummarytext(2000)); - maybeAddNotification(accountId, dcContext.getChat(dcMsg.getChatId()), msgId, shortLine, shortLine, false); + DcChat dcChat = dcContext.getChat(dcMsg.getChatId()); + maybeAddNotification(accountId, dcChat, msgId, shortLine, shortLine, false, dcChat.isMultiUser()); }); } @@ -403,18 +407,19 @@ public class NotificationCenter { JSONObject info = parentMsg.getWebxdcInfo(); final String name = JsonUtils.optString(info, "name"); String shortLine = name.isEmpty()? text : (name + ": " + text); - maybeAddNotification(accountId, dcContext.getChat(dcMsg.getChatId()), msgId, shortLine, shortLine, false); + DcChat dcChat = dcContext.getChat(dcMsg.getChatId()); + maybeAddNotification(accountId, dcChat, msgId, shortLine, shortLine, false, dcChat.isMultiUser()); }); } @WorkerThread - private void maybeAddNotification(int accountId, DcChat dcChat, int msgId, String shortLine, String tickerLine, boolean playInChatSound) { + private void maybeAddNotification(int accountId, DcChat dcChat, int msgId, String shortLine, String tickerLine, boolean playInChatSound, boolean isMention) { DcContext dcContext = context.dcAccounts.getAccount(accountId); int chatId = dcChat.getId(); ChatData chatData = new ChatData(accountId, chatId); - if (dcContext.isMuted() || dcChat.isMuted()) { + if (dcContext.isMuted() || (!isMention && dcChat.isMuted())) { return; }