feat(monitor): Show disable hint in foreground notification when extra notification is enabled

This commit is contained in:
darken
2026-03-03 15:26:10 +00:00
committed by Matthias Urhahn
parent dcf2ade9ec
commit e13331dfcf
3 changed files with 14 additions and 5 deletions
@@ -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(
@@ -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()
+1
View File
@@ -66,6 +66,7 @@
<string name="notification_channel_device_status_label">Device status</string>
<string name="notification_channel_device_status_connected_label">Connected device</string>
<string name="monitor_notification_extra_enabled_hint">You can disable this notification in system settings.</string>
<string name="support_debuglog_label">Debug log</string>
<string name="support_debuglog_desc">Record everything the app is doing into a text file that you can share.</string>