some tweaks

This commit is contained in:
adbenitez 2025-09-11 21:44:15 +02:00
parent c2abe42b60
commit 7698ac5c06
2 changed files with 4 additions and 8 deletions

View file

@ -1,5 +1,3 @@
// called when the user click the "clear" or "mark read" button in the system notification
package org.thoughtcrime.securesms.notifications; package org.thoughtcrime.securesms.notifications;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;

View file

@ -160,7 +160,7 @@ public class NotificationCenter {
return PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT | IntentUtils.FLAG_MUTABLE()); return PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT | IntentUtils.FLAG_MUTABLE());
} }
private PendingIntent getAnswerIntent(ChatData chatData, int callId, String payload) { public PendingIntent getAnswerIntent(ChatData chatData, int callId, String payload) {
final Intent chatIntent = new Intent(context, ConversationActivity.class) final Intent chatIntent = new Intent(context, ConversationActivity.class)
.putExtra(ConversationActivity.ACCOUNT_ID_EXTRA, chatData.accountId) .putExtra(ConversationActivity.ACCOUNT_ID_EXTRA, chatData.accountId)
.putExtra(ConversationActivity.CHAT_ID_EXTRA, chatData.chatId) .putExtra(ConversationActivity.CHAT_ID_EXTRA, chatData.chatId)
@ -180,7 +180,7 @@ public class NotificationCenter {
.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT | IntentUtils.FLAG_MUTABLE()); .getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT | IntentUtils.FLAG_MUTABLE());
} }
private PendingIntent getDeclineCallIntent(ChatData chatData, int callId) { public PendingIntent getDeclineCallIntent(ChatData chatData, int callId) {
Intent intent = new Intent(DeclineCallReceiver.DECLINE_ACTION); Intent intent = new Intent(DeclineCallReceiver.DECLINE_ACTION);
intent.setClass(context, DeclineCallReceiver.class); intent.setClass(context, DeclineCallReceiver.class);
intent.putExtra(DeclineCallReceiver.ACCOUNT_ID_EXTRA, chatData.accountId); intent.putExtra(DeclineCallReceiver.ACCOUNT_ID_EXTRA, chatData.accountId);
@ -364,7 +364,7 @@ public class NotificationCenter {
return channelId; return channelId;
} }
private String getCallNotificationChannel(NotificationManagerCompat notificationManager, ChatData chatData, String name) { public String getCallNotificationChannel(NotificationManagerCompat notificationManager, ChatData chatData, String name) {
String channelId = CH_CALLS_PREFIX + "-" + chatData.accountId + "-"+ chatData.chatId; String channelId = CH_CALLS_PREFIX + "-" + chatData.accountId + "-"+ chatData.chatId;
if (notificationChannelsSupported()) { if (notificationChannelsSupported()) {
@ -454,8 +454,6 @@ public class NotificationCenter {
Notification notif = builder.build(); Notification notif = builder.build();
notif.flags = notif.flags | Notification.FLAG_INSISTENT; notif.flags = notif.flags | Notification.FLAG_INSISTENT;
// add notification, we use one notification per chat,
// esp. older android are not that great at grouping
try { try {
notificationManager.notify("call-" + accId, callId, notif); notificationManager.notify("call-" + accId, callId, notif);
} catch (Exception e) { } catch (Exception e) {
@ -833,7 +831,7 @@ public class NotificationCenter {
} }
} }
private static class ChatData { public static class ChatData {
public final int accountId; public final int accountId;
public final int chatId; public final int chatId;