From 15e1fba013225b41dbb9648c445cd0360d0da8fc Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 19 Jun 2024 10:37:33 +0200 Subject: [PATCH] Notification channels: small iteration on old channel deletion. --- .../notifications/channels/NotificationChannels.kt | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/channels/NotificationChannels.kt b/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/channels/NotificationChannels.kt index a40871be4c..ddf12ebafb 100644 --- a/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/channels/NotificationChannels.kt +++ b/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/channels/NotificationChannels.kt @@ -41,10 +41,6 @@ import javax.inject.Inject private const val LISTENING_FOR_EVENTS_NOTIFICATION_CHANNEL_ID = "LISTEN_FOR_EVENTS_NOTIFICATION_CHANNEL_ID" internal const val SILENT_NOTIFICATION_CHANNEL_ID = "DEFAULT_SILENT_NOTIFICATION_CHANNEL_ID_V2" internal const val NOISY_NOTIFICATION_CHANNEL_ID = "DEFAULT_NOISY_NOTIFICATION_CHANNEL_ID" - -// Legacy channel -private const val CALL_NOTIFICATION_CHANNEL_ID_V2 = "CALL_NOTIFICATION_CHANNEL_ID_V2" - internal const val CALL_NOTIFICATION_CHANNEL_ID_V3 = "CALL_NOTIFICATION_CHANNEL_ID_V3" internal const val RINGING_CALL_NOTIFICATION_CHANNEL_ID = "RINGING_CALL_NOTIFICATION_CHANNEL_ID" @@ -110,15 +106,16 @@ class DefaultNotificationChannels @Inject constructor( } } // Migration - Remove deprecated channels - for (channelId in listOf("DEFAULT_SILENT_NOTIFICATION_CHANNEL_ID", "CALL_NOTIFICATION_CHANNEL_ID")) { + for (channelId in listOf( + "DEFAULT_SILENT_NOTIFICATION_CHANNEL_ID", + "CALL_NOTIFICATION_CHANNEL_ID", + "CALL_NOTIFICATION_CHANNEL_ID_V2", + )) { notificationManager.getNotificationChannel(channelId)?.let { notificationManager.deleteNotificationChannel(channelId) } } - // Migration - Create new call channel - notificationManager.deleteNotificationChannel(CALL_NOTIFICATION_CHANNEL_ID_V2) - /** * Default notification importance: shows everywhere, makes noise, but does not visually * intrude.