Set default values for notification channels, do not rely only on importance level

This commit is contained in:
Sylvain Berfini 2025-04-02 15:15:09 +02:00
parent 9255830fe2
commit a5872ef8de

View file

@ -1618,6 +1618,7 @@ class NotificationsManager
val channel = NotificationChannel(id, name, NotificationManager.IMPORTANCE_HIGH).apply {
description = name
lockscreenVisibility = Notification.VISIBILITY_PUBLIC
setShowBadge(false)
}
notificationManager.createNotificationChannel(channel)
}
@ -1630,7 +1631,9 @@ class NotificationsManager
val channel = NotificationChannel(id, name, NotificationManager.IMPORTANCE_HIGH).apply {
description = name
lockscreenVisibility = Notification.VISIBILITY_PUBLIC
enableLights(true)
enableVibration(true)
setShowBadge(true)
}
notificationManager.createNotificationChannel(channel)
}
@ -1643,6 +1646,9 @@ class NotificationsManager
val channel = NotificationChannel(id, name, NotificationManager.IMPORTANCE_LOW).apply {
description = name
lockscreenVisibility = Notification.VISIBILITY_PUBLIC
enableLights(false)
enableVibration(false)
setShowBadge(false)
}
notificationManager.createNotificationChannel(channel)
}
@ -1655,7 +1661,9 @@ class NotificationsManager
val channel = NotificationChannel(id, name, NotificationManager.IMPORTANCE_HIGH).apply {
description = name
lockscreenVisibility = Notification.VISIBILITY_PUBLIC
enableLights(true)
enableVibration(true)
setShowBadge(true)
}
notificationManager.createNotificationChannel(channel)
}
@ -1667,6 +1675,9 @@ class NotificationsManager
val channel = NotificationChannel(id, name, NotificationManager.IMPORTANCE_LOW).apply {
description = context.getString(R.string.notification_channel_service_desc)
enableLights(false)
enableVibration(false)
setShowBadge(false)
}
notificationManager.createNotificationChannel(channel)
}