From 9e0ad369dd8a41cea037c49953752cc0f9e8e7b1 Mon Sep 17 00:00:00 2001
From: James Rich <2199651+jamesarich@users.noreply.github.com>
Date: Wed, 29 Apr 2026 11:02:41 -0500
Subject: [PATCH] fix: update notification icon (#5293)
---
.../drawable/meshtastic_ic_notification.xml | 35 +++++++++++++++++++
.../service/AndroidNotificationManager.kt | 6 ++--
.../service/MeshServiceNotificationsImpl.kt | 10 +++---
.../meshtastic/core/service/ReplyReceiver.kt | 4 +--
.../service/worker/ServiceKeepAliveWorker.kt | 3 +-
5 files changed, 49 insertions(+), 9 deletions(-)
create mode 100644 core/resources/src/androidMain/res/drawable/meshtastic_ic_notification.xml
diff --git a/core/resources/src/androidMain/res/drawable/meshtastic_ic_notification.xml b/core/resources/src/androidMain/res/drawable/meshtastic_ic_notification.xml
new file mode 100644
index 000000000..f8b6eb3ce
--- /dev/null
+++ b/core/resources/src/androidMain/res/drawable/meshtastic_ic_notification.xml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
diff --git a/core/service/src/androidMain/kotlin/org/meshtastic/core/service/AndroidNotificationManager.kt b/core/service/src/androidMain/kotlin/org/meshtastic/core/service/AndroidNotificationManager.kt
index 17735e28c..05d86954c 100644
--- a/core/service/src/androidMain/kotlin/org/meshtastic/core/service/AndroidNotificationManager.kt
+++ b/core/service/src/androidMain/kotlin/org/meshtastic/core/service/AndroidNotificationManager.kt
@@ -24,6 +24,7 @@ import androidx.core.content.getSystemService
import org.koin.core.annotation.Single
import org.meshtastic.core.repository.Notification
import org.meshtastic.core.repository.NotificationManager
+import org.meshtastic.core.resources.R.drawable
import org.meshtastic.core.resources.Res
import org.meshtastic.core.resources.getString
import org.meshtastic.core.resources.meshtastic_alerts_notifications
@@ -36,7 +37,8 @@ import android.app.NotificationManager as SystemNotificationManager
@Single
class AndroidNotificationManager(private val context: Context) : NotificationManager {
- private val notificationManager = context.getSystemService()!!
+ private val notificationManager =
+ checkNotNull(context.getSystemService()) { "NotificationManager not found" }
private data class ChannelConfig(val id: String, val importance: Int)
@@ -106,7 +108,7 @@ class AndroidNotificationManager(private val context: Context) : NotificationMan
NotificationCompat.Builder(context, notification.category.channelConfig().id)
.setContentTitle(notification.title)
.setContentText(notification.message)
- .setSmallIcon(android.R.drawable.ic_dialog_info)
+ .setSmallIcon(drawable.meshtastic_ic_notification)
.setAutoCancel(true)
.setSilent(notification.isSilent)
diff --git a/core/service/src/androidMain/kotlin/org/meshtastic/core/service/MeshServiceNotificationsImpl.kt b/core/service/src/androidMain/kotlin/org/meshtastic/core/service/MeshServiceNotificationsImpl.kt
index 211e3b9c4..1cf497de1 100644
--- a/core/service/src/androidMain/kotlin/org/meshtastic/core/service/MeshServiceNotificationsImpl.kt
+++ b/core/service/src/androidMain/kotlin/org/meshtastic/core/service/MeshServiceNotificationsImpl.kt
@@ -51,6 +51,7 @@ import org.meshtastic.core.repository.MeshServiceNotifications
import org.meshtastic.core.repository.NodeRepository
import org.meshtastic.core.repository.PacketRepository
import org.meshtastic.core.repository.SERVICE_NOTIFY_ID
+import org.meshtastic.core.resources.R.drawable
import org.meshtastic.core.resources.R.raw
import org.meshtastic.core.resources.Res
import org.meshtastic.core.resources.client_notification
@@ -111,7 +112,8 @@ class MeshServiceNotificationsImpl(
private val nodeRepository: Lazy,
) : MeshServiceNotifications {
- private val notificationManager = context.getSystemService()!!
+ private val notificationManager =
+ checkNotNull(context.getSystemService()) { "NotificationManager not found" }
companion object {
const val MAX_BATTERY_LEVEL = 100
@@ -418,7 +420,7 @@ class MeshServiceNotificationsImpl(
if (nodeId == DataPacket.ID_LOCAL) {
ourNode ?: nodeRepository.value.getNode(nodeId)
} else {
- nodeRepository.value.getNode(nodeId ?: "")
+ nodeRepository.value.getNode(nodeId.orEmpty())
}
}
.first()
@@ -480,7 +482,7 @@ class MeshServiceNotificationsImpl(
val summaryNotification =
commonBuilder(NotificationType.DirectMessage)
- .setSmallIcon(context.applicationInfo.icon)
+ .setSmallIcon(drawable.meshtastic_ic_notification)
.setStyle(messagingStyle)
.setGroup(GROUP_KEY_MESSAGES)
.setGroupSummary(true)
@@ -841,7 +843,7 @@ class MeshServiceNotificationsImpl(
type: NotificationType,
contentIntent: PendingIntent? = null,
): NotificationCompat.Builder {
- val smallIcon = context.applicationInfo.icon
+ val smallIcon = drawable.meshtastic_ic_notification
return NotificationCompat.Builder(context, type.channelId)
.setSmallIcon(smallIcon)
diff --git a/core/service/src/androidMain/kotlin/org/meshtastic/core/service/ReplyReceiver.kt b/core/service/src/androidMain/kotlin/org/meshtastic/core/service/ReplyReceiver.kt
index d7a943783..2bb9ff6be 100644
--- a/core/service/src/androidMain/kotlin/org/meshtastic/core/service/ReplyReceiver.kt
+++ b/core/service/src/androidMain/kotlin/org/meshtastic/core/service/ReplyReceiver.kt
@@ -58,8 +58,8 @@ class ReplyReceiver :
val remoteInput = RemoteInput.getResultsFromIntent(intent)
if (remoteInput != null) {
- val contactKey = intent.getStringExtra(CONTACT_KEY) ?: ""
- val message = remoteInput.getCharSequence(KEY_TEXT_REPLY)?.toString() ?: ""
+ val contactKey = intent.getStringExtra(CONTACT_KEY).orEmpty()
+ val message = remoteInput.getCharSequence(KEY_TEXT_REPLY)?.toString().orEmpty()
val pendingResult = goAsync()
scope.launch {
diff --git a/core/service/src/androidMain/kotlin/org/meshtastic/core/service/worker/ServiceKeepAliveWorker.kt b/core/service/src/androidMain/kotlin/org/meshtastic/core/service/worker/ServiceKeepAliveWorker.kt
index 9bda51e00..7ab159d35 100644
--- a/core/service/src/androidMain/kotlin/org/meshtastic/core/service/worker/ServiceKeepAliveWorker.kt
+++ b/core/service/src/androidMain/kotlin/org/meshtastic/core/service/worker/ServiceKeepAliveWorker.kt
@@ -28,6 +28,7 @@ import co.touchlab.kermit.Logger
import org.koin.android.annotation.KoinWorker
import org.meshtastic.core.repository.MeshServiceNotifications
import org.meshtastic.core.repository.SERVICE_NOTIFY_ID
+import org.meshtastic.core.resources.R.drawable
import org.meshtastic.core.service.MeshService
import org.meshtastic.core.service.startService
@@ -80,7 +81,7 @@ class ServiceKeepAliveWorker(
// We use "my_service" which matches NotificationType.ServiceState.channelId in MeshServiceNotificationsImpl
return NotificationCompat.Builder(applicationContext, "my_service")
- .setSmallIcon(applicationContext.applicationInfo.icon)
+ .setSmallIcon(drawable.meshtastic_ic_notification)
.setContentTitle("Resuming Mesh Service")
.setPriority(NotificationCompat.PRIORITY_LOW)
.setOngoing(true)