Loading app/src/main/java/io/heckel/ntfy/service/SubscriberService.kt +2 −2 Original line number Diff line number Diff line Loading @@ -257,8 +257,8 @@ class SubscriberService : Service() { it.setShowBadge(false) // Don't show long-press badge it } notificationManager.createNotificationChannel(channel) NotificationChannelHider(this, GlobalScope).hideChannel(NOTIFICATION_CHANNEL_ID) NotificationChannelHider(this, GlobalScope).createAndHideChannel(channel) return notificationManager } return null Loading notificationsreceiver/src/main/java/foundation/e/notificationsreceiver/bridges/androidinterfaces/NotificationChannelHider.kt +11 −4 Original line number Diff line number Diff line Loading @@ -36,7 +36,17 @@ class NotificationChannelHider( private const val UPDATE_CHANNEL_DELAY = 30000L } fun hideChannel(channelId: String) { private val notificationManager: NotificationManager by lazy { context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager } fun createAndHideChannel(notificationsChannel: NotificationChannel) { // Set blockable before create the channel, otherwise it will re-show on each create call. NotificationChannelHiddenMethods.setBlockable(notificationsChannel, true) notificationManager.createNotificationChannel(notificationsChannel) val channelId = notificationsChannel.id // Hide works if updating importance is called after the notification is // used as the ForegroundService notification. This may take a few seconds sometimes, so // we wait a few seconds. Loading @@ -47,9 +57,6 @@ class NotificationChannelHider( } private fun setImportanceToNone(channelId: String) { val notificationManager: NotificationManager by lazy { context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager } val notificationsChannel: NotificationChannel = notificationManager.getNotificationChannel(channelId) NotificationChannelHiddenMethods.setBlockable(notificationsChannel, true) notificationsChannel.importance = NotificationManager.IMPORTANCE_NONE Loading Loading
app/src/main/java/io/heckel/ntfy/service/SubscriberService.kt +2 −2 Original line number Diff line number Diff line Loading @@ -257,8 +257,8 @@ class SubscriberService : Service() { it.setShowBadge(false) // Don't show long-press badge it } notificationManager.createNotificationChannel(channel) NotificationChannelHider(this, GlobalScope).hideChannel(NOTIFICATION_CHANNEL_ID) NotificationChannelHider(this, GlobalScope).createAndHideChannel(channel) return notificationManager } return null Loading
notificationsreceiver/src/main/java/foundation/e/notificationsreceiver/bridges/androidinterfaces/NotificationChannelHider.kt +11 −4 Original line number Diff line number Diff line Loading @@ -36,7 +36,17 @@ class NotificationChannelHider( private const val UPDATE_CHANNEL_DELAY = 30000L } fun hideChannel(channelId: String) { private val notificationManager: NotificationManager by lazy { context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager } fun createAndHideChannel(notificationsChannel: NotificationChannel) { // Set blockable before create the channel, otherwise it will re-show on each create call. NotificationChannelHiddenMethods.setBlockable(notificationsChannel, true) notificationManager.createNotificationChannel(notificationsChannel) val channelId = notificationsChannel.id // Hide works if updating importance is called after the notification is // used as the ForegroundService notification. This may take a few seconds sometimes, so // we wait a few seconds. Loading @@ -47,9 +57,6 @@ class NotificationChannelHider( } private fun setImportanceToNone(channelId: String) { val notificationManager: NotificationManager by lazy { context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager } val notificationsChannel: NotificationChannel = notificationManager.getNotificationChannel(channelId) NotificationChannelHiddenMethods.setBlockable(notificationsChannel, true) notificationsChannel.importance = NotificationManager.IMPORTANCE_NONE Loading