Remove smsMmsChannel notification channel

## Summary

Remove the dead "New Message" notification channel.

This channel was used for a tiny period, probably around 4 years ago, when we thought the only way to support sending MMS on Android was to be the default SMS app, thus we wanted to show users a notification when they received messages while our app was in charge of handling them.

Thankfully, we do not need to be the default SMS app, so this notification channel should be removed.

## Test Plan

### Before:
Looking at the list of notification streams in the settings for KDE Connect will include a "New Message" channel. Notifications are never posted to this channel.

### After:
Users will not see a "New Message" channel. Note that it does show a count of deleted streams, to prevent spam. See [documentation](https://developer.android.com/develop/ui/views/notifications/channels#DeleteChannel) for explanation.
This commit is contained in:
Simon Redman
2023-09-12 02:31:52 +00:00
parent b4f33adb6c
commit 1096ace12c
2 changed files with 9 additions and 7 deletions

View File

@@ -360,7 +360,6 @@ SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted
<string name="notification_channel_media_control">Media control</string>
<string name="notification_channel_filetransfer">File transfer</string>
<string name="notification_channel_high_priority">High priority</string>
<string name="notification_channel_sms_mms">New Message</string>
<string name="mpris_stop">Stop the current player</string>
<string name="copy_url_to_clipboard">Copy URL to clipboard</string>

View File

@@ -20,6 +20,7 @@ import org.kde.kdeconnect_tp.R;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
public class NotificationHelper {
@@ -28,7 +29,6 @@ public class NotificationHelper {
public final static String DEFAULT = "default";
public final static String MEDIA_CONTROL = "media_control";
public final static String FILETRANSFER = "filetransfer";
public final static String SMS_MMS = "sms_mms";
public final static String RECEIVENOTIFICATION = "receive";
public final static String HIGHPRIORITY = "highpriority";
}
@@ -73,10 +73,6 @@ public class NotificationHelper {
.Builder(Channels.RECEIVENOTIFICATION, NotificationManagerCompat.IMPORTANCE_DEFAULT)
.setName(context.getString(R.string.notification_channel_receivenotification))
.build();
final NotificationChannelCompat smsMmsChannel = new NotificationChannelCompat
.Builder(Channels.SMS_MMS, NotificationManagerCompat.IMPORTANCE_DEFAULT)
.setName(context.getString(R.string.notification_channel_sms_mms))
.build();
final NotificationChannelCompat highPriorityChannel = new NotificationChannelCompat
.Builder(Channels.HIGHPRIORITY, NotificationManagerCompat.IMPORTANCE_HIGH)
.setName(context.getString(R.string.notification_channel_high_priority))
@@ -84,8 +80,15 @@ public class NotificationHelper {
final List<NotificationChannelCompat> channels = Arrays.asList(persistentChannel,
defaultChannel, mediaChannel, fileTransferChannel, receiveNotificationChannel,
smsMmsChannel, highPriorityChannel);
highPriorityChannel);
NotificationManagerCompat.from(context).createNotificationChannelsCompat(channels);
// Delete any notification channels which weren't added.
// Use this to deprecate old channels.
NotificationManagerCompat.from(context).deleteUnlistedNotificationChannels(
channels.stream()
.map(notificationChannelCompat -> notificationChannelCompat.getId())
.collect(Collectors.toList()));
}
public static void setPersistentNotificationEnabled(Context context, boolean enabled) {