mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
Merge pull request #2265 from deltachat/adb/issue-1753
fix sound notifications, allow to set to "silent"
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user