From 3e126257640db953330e58d72d5c3754ed79ca0f Mon Sep 17 00:00:00 2001 From: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Date: Thu, 2 Apr 2026 23:40:12 -0700 Subject: [PATCH] fix: respect showContactPicture setting in notifications Check the message list showContactPicture preference before loading and displaying contact avatars in new mail notifications. When the setting is disabled, notifications no longer show the avatar as the large icon. Fixes #10750 --- .../com/fsck/k9/notification/CoreNotificationKoinModule.kt | 1 + .../fsck/k9/notification/SingleMessageNotificationCreator.kt | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/legacy/core/src/main/java/com/fsck/k9/notification/CoreNotificationKoinModule.kt b/legacy/core/src/main/java/com/fsck/k9/notification/CoreNotificationKoinModule.kt index 06af6db2df7..10e4e60ca62 100644 --- a/legacy/core/src/main/java/com/fsck/k9/notification/CoreNotificationKoinModule.kt +++ b/legacy/core/src/main/java/com/fsck/k9/notification/CoreNotificationKoinModule.kt @@ -112,6 +112,7 @@ val coreNotificationModule = module { actionCreator = get(), resourceProvider = get(), lockScreenNotificationCreator = get(), + messageListPreferencesManager = get(), application = androidApplication(), ) } diff --git a/legacy/core/src/main/java/com/fsck/k9/notification/SingleMessageNotificationCreator.kt b/legacy/core/src/main/java/com/fsck/k9/notification/SingleMessageNotificationCreator.kt index 76b2fef3ad7..4ff235441e1 100644 --- a/legacy/core/src/main/java/com/fsck/k9/notification/SingleMessageNotificationCreator.kt +++ b/legacy/core/src/main/java/com/fsck/k9/notification/SingleMessageNotificationCreator.kt @@ -10,6 +10,7 @@ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.SupervisorJob import kotlinx.coroutines.launch import net.thunderbird.core.logging.legacy.Log +import net.thunderbird.core.preference.display.visualSettings.message.list.MessageListPreferencesManager import androidx.core.app.NotificationCompat.Builder as NotificationBuilder internal class SingleMessageNotificationCreator( @@ -17,6 +18,7 @@ internal class SingleMessageNotificationCreator( private val actionCreator: NotificationActionCreator, private val resourceProvider: NotificationResourceProvider, private val lockScreenNotificationCreator: LockScreenNotificationCreator, + private val messageListPreferencesManager: MessageListPreferencesManager, private val application: Application, ) { private val scope = CoroutineScope(SupervisorJob() + Dispatchers.Main.immediate) @@ -63,6 +65,8 @@ internal class SingleMessageNotificationCreator( } private suspend fun NotificationBuilder.setAvatar(content: NotificationContent) = apply { + if (!messageListPreferencesManager.getConfig().isShowContactPicture) return@apply + resourceProvider.avatar(content.sender)?.let { setLargeIcon(IconCompat.createWithAdaptiveBitmap(it).toIcon(application)) }