notify webxdc events, replies and reactions to own messages even if chat is muted

This commit is contained in:
adbenitez
2024-12-02 18:11:07 +01:00
parent 1b57880be3
commit e245e29058
@@ -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;
}