Notification channels: No need to include the version in the constant name.

This commit is contained in:
Benoit Marty 2024-06-19 10:40:10 +02:00
parent 5fe5d38034
commit cfa5461b7d
2 changed files with 4 additions and 4 deletions

View file

@ -40,7 +40,7 @@ import javax.inject.Inject
* ========================================================================================== */ * ========================================================================================== */
internal const val SILENT_NOTIFICATION_CHANNEL_ID = "DEFAULT_SILENT_NOTIFICATION_CHANNEL_ID_V2" 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" internal const val NOISY_NOTIFICATION_CHANNEL_ID = "DEFAULT_NOISY_NOTIFICATION_CHANNEL_ID"
internal const val CALL_NOTIFICATION_CHANNEL_ID_V3 = "CALL_NOTIFICATION_CHANNEL_ID_V3" internal const val CALL_NOTIFICATION_CHANNEL_ID = "CALL_NOTIFICATION_CHANNEL_ID_V3"
internal const val RINGING_CALL_NOTIFICATION_CHANNEL_ID = "RINGING_CALL_NOTIFICATION_CHANNEL_ID" internal const val RINGING_CALL_NOTIFICATION_CHANNEL_ID = "RINGING_CALL_NOTIFICATION_CHANNEL_ID"
/** /**
@ -154,7 +154,7 @@ class DefaultNotificationChannels @Inject constructor(
// Register a channel for incoming and in progress call notifications with no ringing // Register a channel for incoming and in progress call notifications with no ringing
notificationManager.createNotificationChannel( notificationManager.createNotificationChannel(
NotificationChannel( NotificationChannel(
CALL_NOTIFICATION_CHANNEL_ID_V3, CALL_NOTIFICATION_CHANNEL_ID,
stringProvider.getString(R.string.notification_channel_call).ifEmpty { "Call" }, stringProvider.getString(R.string.notification_channel_call).ifEmpty { "Call" },
NotificationManager.IMPORTANCE_HIGH NotificationManager.IMPORTANCE_HIGH
) )
@ -191,7 +191,7 @@ class DefaultNotificationChannels @Inject constructor(
} }
override fun getChannelForIncomingCall(ring: Boolean): String { override fun getChannelForIncomingCall(ring: Boolean): String {
return if (ring) RINGING_CALL_NOTIFICATION_CHANNEL_ID else CALL_NOTIFICATION_CHANNEL_ID_V3 return if (ring) RINGING_CALL_NOTIFICATION_CHANNEL_ID else CALL_NOTIFICATION_CHANNEL_ID
} }
override fun getChannelIdForMessage(noisy: Boolean): String { override fun getChannelIdForMessage(noisy: Boolean): String {

View file

@ -55,7 +55,7 @@ class NotificationChannelsTest {
assertThat(ringingChannel).isEqualTo(RINGING_CALL_NOTIFICATION_CHANNEL_ID) assertThat(ringingChannel).isEqualTo(RINGING_CALL_NOTIFICATION_CHANNEL_ID)
val normalChannel = notificationChannels.getChannelForIncomingCall(ring = false) val normalChannel = notificationChannels.getChannelForIncomingCall(ring = false)
assertThat(normalChannel).isEqualTo(CALL_NOTIFICATION_CHANNEL_ID_V3) assertThat(normalChannel).isEqualTo(CALL_NOTIFICATION_CHANNEL_ID)
} }
@Test @Test