Use individual notification channels for background connection and call status.

fork-5.53.8
Cody Henthorne 2022-02-15 16:36:29 -05:00 zatwierdzone przez Greyson Parrelli
rodzic a1bcbe9c86
commit 9389ee17b6
4 zmienionych plików z 19 dodań i 9 usunięć

Wyświetl plik

@ -264,7 +264,7 @@ public class IncomingMessageObserver {
public int onStartCommand(Intent intent, int flags, int startId) {
super.onStartCommand(intent, flags, startId);
NotificationCompat.Builder builder = new NotificationCompat.Builder(getApplicationContext(), NotificationChannels.OTHER);
NotificationCompat.Builder builder = new NotificationCompat.Builder(getApplicationContext(), NotificationChannels.BACKGROUND);
builder.setContentTitle(getApplicationContext().getString(R.string.MessageRetrievalService_signal));
builder.setContentText(getApplicationContext().getString(R.string.MessageRetrievalService_background_connection_enabled));
builder.setPriority(NotificationCompat.PRIORITY_MIN);

Wyświetl plik

@ -72,6 +72,8 @@ public class NotificationChannels {
public static final String OTHER = "other_v3";
public static final String VOICE_NOTES = "voice_notes";
public static final String JOIN_EVENTS = "join_events";
public static final String BACKGROUND = "background_connection";
public static final String CALL_STATUS = "call_status";
/**
* Ensures all of the notification channels are created. No harm in repeat calls. Call is safely
@ -596,6 +598,8 @@ public class NotificationChannels {
NotificationChannel other = new NotificationChannel(OTHER, context.getString(R.string.NotificationChannel_other), NotificationManager.IMPORTANCE_LOW);
NotificationChannel voiceNotes = new NotificationChannel(VOICE_NOTES, context.getString(R.string.NotificationChannel_voice_notes), NotificationManager.IMPORTANCE_LOW);
NotificationChannel joinEvents = new NotificationChannel(JOIN_EVENTS, context.getString(R.string.NotificationChannel_contact_joined_signal), NotificationManager.IMPORTANCE_DEFAULT);
NotificationChannel background = new NotificationChannel(BACKGROUND, context.getString(R.string.NotificationChannel_background_connection), NotificationManager.IMPORTANCE_LOW);
NotificationChannel callStatus = new NotificationChannel(CALL_STATUS, context.getString(R.string.NotificationChannel_call_status), NotificationManager.IMPORTANCE_LOW);
messages.setGroup(CATEGORY_MESSAGES);
setVibrationEnabled(messages, SignalStore.settings().isMessageVibrateEnabled());
@ -609,8 +613,10 @@ public class NotificationChannels {
setVibrationEnabled(other, false);
voiceNotes.setShowBadge(false);
joinEvents.setShowBadge(false);
background.setShowBadge(false);
callStatus.setShowBadge(false);
notificationManager.createNotificationChannels(Arrays.asList(messages, calls, failures, backups, lockedStatus, other, voiceNotes, joinEvents));
notificationManager.createNotificationChannels(Arrays.asList(messages, calls, failures, backups, lockedStatus, other, voiceNotes, joinEvents, background, callStatus));
if (BuildConfig.PLAY_STORE_DISABLED) {
NotificationChannel appUpdates = new NotificationChannel(APP_UPDATES, context.getString(R.string.NotificationChannel_app_updates), NotificationManager.IMPORTANCE_HIGH);

Wyświetl plik

@ -86,12 +86,12 @@ public class CallNotificationBuilder {
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, contentIntent, 0);
return new NotificationCompat.Builder(context, NotificationChannels.OTHER).setSmallIcon(R.drawable.ic_call_secure_white_24dp)
.setContentIntent(pendingIntent)
.setOngoing(true)
.setContentTitle(context.getString(R.string.NotificationBarManager__stopping_signal_call_service))
.setPriority(NotificationCompat.PRIORITY_MIN)
.build();
return new NotificationCompat.Builder(context, NotificationChannels.CALL_STATUS).setSmallIcon(R.drawable.ic_call_secure_white_24dp)
.setContentIntent(pendingIntent)
.setOngoing(true)
.setContentTitle(context.getString(R.string.NotificationBarManager__stopping_signal_call_service))
.setPriority(NotificationCompat.PRIORITY_MIN)
.build();
}
public static int getStoppingNotificationId() {
@ -107,7 +107,7 @@ public class CallNotificationBuilder {
if (callActivityRestricted() && type == TYPE_INCOMING_RINGING) {
return NotificationChannels.CALLS;
} else {
return NotificationChannels.OTHER;
return NotificationChannels.CALL_STATUS;
}
}

Wyświetl plik

@ -1868,6 +1868,10 @@
<string name="NotificationChannel_voice_notes">Voice Notes</string>
<string name="NotificationChannel_contact_joined_signal">Contact joined Signal</string>
<string name="NotificationChannels__no_activity_available_to_open_notification_channel_settings">No activity available to open notification channel settings.</string>
<!-- Notification channel name for showing persistent background connection on devices without push notifications -->
<string name="NotificationChannel_background_connection">Background connection</string>
<!-- Notification channel name for showing call status information (like connection, ongoing, etc.) Not ringing. -->
<string name="NotificationChannel_call_status">Call status</string>
<!-- ProfileEditNameFragment -->
<!-- QuickResponseService -->