From 5acb84328db667622f2849fe067e824f2e914358 Mon Sep 17 00:00:00 2001 From: adbenitez Date: Wed, 6 Apr 2022 16:58:49 -0400 Subject: [PATCH 1/2] set correct value for silent sound in default notification settings --- .../securesms/preferences/NotificationsPreferenceFragment.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/org/thoughtcrime/securesms/preferences/NotificationsPreferenceFragment.java b/src/org/thoughtcrime/securesms/preferences/NotificationsPreferenceFragment.java index 929a48f34..d7035a33f 100644 --- a/src/org/thoughtcrime/securesms/preferences/NotificationsPreferenceFragment.java +++ b/src/org/thoughtcrime/securesms/preferences/NotificationsPreferenceFragment.java @@ -49,6 +49,7 @@ public class NotificationsPreferenceFragment extends ListSummaryPreferenceFragme this.findPreference(Prefs.RINGTONE_PREF) .setOnPreferenceClickListener(preference -> { Uri current = Prefs.getNotificationRingtone(getContext()); + if (current.toString().isEmpty()) current = null; // silent Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER); intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, true); From b98dd7bd365cc530752e473521a4f840222487ec Mon Sep 17 00:00:00 2001 From: adbenitez Date: Wed, 6 Apr 2022 17:05:40 -0400 Subject: [PATCH 2/2] set channel sound to silent when needed --- .../securesms/notifications/NotificationCenter.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/org/thoughtcrime/securesms/notifications/NotificationCenter.java b/src/org/thoughtcrime/securesms/notifications/NotificationCenter.java index 43558f56a..6ea55e708 100644 --- a/src/org/thoughtcrime/securesms/notifications/NotificationCenter.java +++ b/src/org/thoughtcrime/securesms/notifications/NotificationCenter.java @@ -173,7 +173,7 @@ public class NotificationCenter { // channelIds: CH_MSG_* are used here, the other ones from outside (defined here to have some overview) public static final String CH_MSG_PREFIX = "ch_msg"; - public static final String CH_MSG_VERSION = "4"; + public static final String CH_MSG_VERSION = "5"; public static final String CH_PERMANENT = "dc_foreground_notification_ch"; public static final String CH_GENERIC = "ch_generic"; @@ -291,6 +291,8 @@ public class NotificationCenter { new AudioAttributes.Builder().setContentType(AudioAttributes.CONTENT_TYPE_UNKNOWN) .setUsage(AudioAttributes.USAGE_NOTIFICATION_COMMUNICATION_INSTANT) .build()); + } else { + channel.setSound(null, null); } notificationManager.createNotificationChannel(channel); @@ -377,7 +379,7 @@ public class NotificationCenter { if (!notificationChannelsSupported()) { if (signal) { Uri sound = effectiveSound(chatId); - if (sound != null) { + if (sound != null && !TextUtils.isEmpty(sound.toString())) { builder.setSound(sound); } boolean vibrate = effectiveVibrate(chatId);