From e13331dfcfeeb97a8ff49555240604223a0bd65a Mon Sep 17 00:00:00 2001 From: darken Date: Tue, 3 Mar 2026 16:24:20 +0100 Subject: [PATCH] feat(monitor): Show disable hint in foreground notification when extra notification is enabled --- .../capod/monitor/core/worker/MonitorService.kt | 3 ++- .../capod/monitor/ui/MonitorNotifications.kt | 15 +++++++++++---- app/src/main/res/values/strings.xml | 1 + 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/eu/darken/capod/monitor/core/worker/MonitorService.kt b/app/src/main/java/eu/darken/capod/monitor/core/worker/MonitorService.kt index 586634ca..20d55661 100644 --- a/app/src/main/java/eu/darken/capod/monitor/core/worker/MonitorService.kt +++ b/app/src/main/java/eu/darken/capod/monitor/core/worker/MonitorService.kt @@ -172,9 +172,10 @@ class MonitorService : Service() { .distinctUntilChanged() .throttleLatest(1000) .onEach { currentDevice -> + val useExtraNotification = generalSettings.useExtraMonitorNotification.value notificationManager.notify( MonitorNotifications.NOTIFICATION_ID, - notifications.getNotification(currentDevice), + notifications.getNotification(currentDevice, showHint = useExtraNotification), ) if (generalSettings.useExtraMonitorNotification.value && currentDevice != null) { notificationManager.notify( diff --git a/app/src/main/java/eu/darken/capod/monitor/ui/MonitorNotifications.kt b/app/src/main/java/eu/darken/capod/monitor/ui/MonitorNotifications.kt index 77bed4af..485cef4d 100644 --- a/app/src/main/java/eu/darken/capod/monitor/ui/MonitorNotifications.kt +++ b/app/src/main/java/eu/darken/capod/monitor/ui/MonitorNotifications.kt @@ -57,10 +57,17 @@ class MonitorNotifications @Inject constructor( setOngoing(true) } - private fun getBuilder(device: PodDevice?, channelId: String): NotificationCompat.Builder { + private fun getBuilder(device: PodDevice?, channelId: String, showHint: Boolean = false): NotificationCompat.Builder { if (device == null) { return baseBuilder(channelId).apply { - setStyle(NotificationCompat.BigTextStyle()) + if (showHint) { + setStyle( + NotificationCompat.BigTextStyle() + .bigText(context.getString(R.string.monitor_notification_extra_enabled_hint)) + ) + } else { + setStyle(NotificationCompat.BigTextStyle()) + } setContentTitle(context.getString(R.string.pods_none_label_short)) setSubText(context.getString(R.string.app_name)) } @@ -136,8 +143,8 @@ class MonitorNotifications @Inject constructor( } } - fun getNotification(podDevice: PodDevice?): Notification = - getBuilder(podDevice, NOTIFICATION_CHANNEL_ID).build() + fun getNotification(podDevice: PodDevice?, showHint: Boolean = false): Notification = + getBuilder(podDevice, NOTIFICATION_CHANNEL_ID, showHint).build() fun getNotificationConnected(podDevice: PodDevice?): Notification = getBuilder(podDevice, NOTIFICATION_CHANNEL_ID_CONNECTED).build() diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 095d2b4b..c3565bfe 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -66,6 +66,7 @@ Device status Connected device + You can disable this notification in system settings. Debug log Record everything the app is doing into a text file that you can share.