mirror of
https://github.com/nextcloud/talk-android
synced 2025-03-06 14:27:24 +00:00
Merge pull request #1936 from nextcloud/bugfix/1935/fixReactionNotificationSubject
fix text for reaction notification + hide content title for one2one rooms and reactions
This commit is contained in:
commit
30d57fda4f
@ -78,6 +78,7 @@ import java.security.InvalidKeyException;
|
|||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
import java.security.PrivateKey;
|
import java.security.PrivateKey;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.zip.CRC32;
|
import java.util.zip.CRC32;
|
||||||
|
|
||||||
import javax.crypto.Cipher;
|
import javax.crypto.Cipher;
|
||||||
@ -224,10 +225,13 @@ public class NotificationWorker extends Worker {
|
|||||||
HashMap<String, String> guestHashMap = subjectRichParameters.get("guest");
|
HashMap<String, String> guestHashMap = subjectRichParameters.get("guest");
|
||||||
|
|
||||||
if (callHashMap != null && callHashMap.size() > 0 && callHashMap.containsKey("name")) {
|
if (callHashMap != null && callHashMap.size() > 0 && callHashMap.containsKey("name")) {
|
||||||
if (notification.getObjectType().equals("chat")) {
|
if (subjectRichParameters.containsKey("reaction")) {
|
||||||
decryptedPushMessage.setSubject(callHashMap.get("name"));
|
decryptedPushMessage.setSubject("");
|
||||||
|
decryptedPushMessage.setText(notification.getSubject());
|
||||||
|
} else if (Objects.equals(notification.getObjectType(), "chat")) {
|
||||||
|
decryptedPushMessage.setSubject(Objects.requireNonNull(callHashMap.get("name")));
|
||||||
} else {
|
} else {
|
||||||
decryptedPushMessage.setSubject(notification.getSubject());
|
decryptedPushMessage.setSubject(Objects.requireNonNull(notification.getSubject()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (callHashMap.containsKey("call-type")) {
|
if (callHashMap.containsKey("call-type")) {
|
||||||
@ -278,6 +282,8 @@ public class NotificationWorker extends Worker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (conversationType) {
|
switch (conversationType) {
|
||||||
|
case "one2one":
|
||||||
|
decryptedPushMessage.setSubject("");
|
||||||
case "group":
|
case "group":
|
||||||
largeIcon = BitmapFactory.decodeResource(context.getResources(), R.drawable.ic_people_group_black_24px);
|
largeIcon = BitmapFactory.decodeResource(context.getResources(), R.drawable.ic_people_group_black_24px);
|
||||||
break;
|
break;
|
||||||
@ -309,10 +315,13 @@ public class NotificationWorker extends Worker {
|
|||||||
.setSubText(baseUrl)
|
.setSubText(baseUrl)
|
||||||
.setWhen(decryptedPushMessage.getTimestamp())
|
.setWhen(decryptedPushMessage.getTimestamp())
|
||||||
.setShowWhen(true)
|
.setShowWhen(true)
|
||||||
.setContentTitle(EmojiCompat.get().process(decryptedPushMessage.getSubject()))
|
|
||||||
.setContentIntent(pendingIntent)
|
.setContentIntent(pendingIntent)
|
||||||
.setAutoCancel(true);
|
.setAutoCancel(true);
|
||||||
|
|
||||||
|
if (!TextUtils.isEmpty(decryptedPushMessage.getSubject())) {
|
||||||
|
notificationBuilder.setContentTitle(EmojiCompat.get().process(decryptedPushMessage.getSubject()));
|
||||||
|
}
|
||||||
|
|
||||||
if (!TextUtils.isEmpty(decryptedPushMessage.getText())) {
|
if (!TextUtils.isEmpty(decryptedPushMessage.getText())) {
|
||||||
notificationBuilder.setContentText(EmojiCompat.get().process(decryptedPushMessage.getText()));
|
notificationBuilder.setContentText(EmojiCompat.get().process(decryptedPushMessage.getText()));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user