diff options
author | Marcel Hibbe <dev@mhibbe.de> | 2022-04-21 18:12:50 +0300 |
---|---|---|
committer | Marcel Hibbe <dev@mhibbe.de> | 2022-04-21 18:12:50 +0300 |
commit | 1cf55c6e8e9dba021697991465736c26b2a8a696 (patch) | |
tree | ac24ec70a961d2bf7632b11808a7f6749bfe2c4e | |
parent | 75b0f7af5db12b900e50b2d1895a384e709e7e96 (diff) |
fix text for reaction notification
hide content title for one2one rooms and reactions
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
-rw-r--r-- | app/src/main/java/com/nextcloud/talk/jobs/NotificationWorker.java | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/app/src/main/java/com/nextcloud/talk/jobs/NotificationWorker.java b/app/src/main/java/com/nextcloud/talk/jobs/NotificationWorker.java index bee4bc1e6..86c67b5ee 100644 --- a/app/src/main/java/com/nextcloud/talk/jobs/NotificationWorker.java +++ b/app/src/main/java/com/nextcloud/talk/jobs/NotificationWorker.java @@ -78,6 +78,7 @@ import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.security.PrivateKey; import java.util.HashMap; +import java.util.Objects; import java.util.zip.CRC32; import javax.crypto.Cipher; @@ -224,10 +225,13 @@ public class NotificationWorker extends Worker { HashMap<String, String> guestHashMap = subjectRichParameters.get("guest"); if (callHashMap != null && callHashMap.size() > 0 && callHashMap.containsKey("name")) { - if (notification.getObjectType().equals("chat")) { - decryptedPushMessage.setSubject(callHashMap.get("name")); + if (subjectRichParameters.containsKey("reaction")) { + decryptedPushMessage.setSubject(""); + decryptedPushMessage.setText(notification.getSubject()); + } else if (Objects.equals(notification.getObjectType(), "chat")) { + decryptedPushMessage.setSubject(Objects.requireNonNull(callHashMap.get("name"))); } else { - decryptedPushMessage.setSubject(notification.getSubject()); + decryptedPushMessage.setSubject(Objects.requireNonNull(notification.getSubject())); } if (callHashMap.containsKey("call-type")) { @@ -278,6 +282,8 @@ public class NotificationWorker extends Worker { } switch (conversationType) { + case "one2one": + decryptedPushMessage.setSubject(""); case "group": largeIcon = BitmapFactory.decodeResource(context.getResources(), R.drawable.ic_people_group_black_24px); break; @@ -309,10 +315,13 @@ public class NotificationWorker extends Worker { .setSubText(baseUrl) .setWhen(decryptedPushMessage.getTimestamp()) .setShowWhen(true) - .setContentTitle(EmojiCompat.get().process(decryptedPushMessage.getSubject())) .setContentIntent(pendingIntent) .setAutoCancel(true); + if (!TextUtils.isEmpty(decryptedPushMessage.getSubject())) { + notificationBuilder.setContentTitle(EmojiCompat.get().process(decryptedPushMessage.getSubject())); + } + if (!TextUtils.isEmpty(decryptedPushMessage.getText())) { notificationBuilder.setContentText(EmojiCompat.get().process(decryptedPushMessage.getText())); } |