Default to app icon if icon is not available for notification (#2936)

This commit is contained in:
Daniel Shokouhi 2022-10-01 13:15:24 -07:00 committed by GitHub
parent abf0220430
commit 48f2ca3125
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1103,8 +1103,11 @@ class MessagingManager @Inject constructor(
if (data[NOTIFICATION_ICON]?.startsWith("mdi:") == true && !data[NOTIFICATION_ICON]?.substringAfter("mdi:").isNullOrBlank() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
val iconName = data[NOTIFICATION_ICON]!!.split(":")[1]
val iconDrawable =
IconicsDrawable(context, "cmd-$iconName").toAndroidIconCompat()
builder.setSmallIcon(iconDrawable)
IconicsDrawable(context, "cmd-$iconName")
if (iconDrawable.icon != null)
builder.setSmallIcon(iconDrawable.toAndroidIconCompat())
else
builder.setSmallIcon(commonR.drawable.ic_stat_ic_notification)
} else
builder.setSmallIcon(commonR.drawable.ic_stat_ic_notification)
}