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)) }