Skip to content

Commit 3e12625

Browse files
committed
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
1 parent 2200869 commit 3e12625

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

legacy/core/src/main/java/com/fsck/k9/notification/CoreNotificationKoinModule.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ val coreNotificationModule = module {
112112
actionCreator = get(),
113113
resourceProvider = get(),
114114
lockScreenNotificationCreator = get(),
115+
messageListPreferencesManager = get(),
115116
application = androidApplication(),
116117
)
117118
}

legacy/core/src/main/java/com/fsck/k9/notification/SingleMessageNotificationCreator.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@ import kotlinx.coroutines.Dispatchers
1010
import kotlinx.coroutines.SupervisorJob
1111
import kotlinx.coroutines.launch
1212
import net.thunderbird.core.logging.legacy.Log
13+
import net.thunderbird.core.preference.display.visualSettings.message.list.MessageListPreferencesManager
1314
import androidx.core.app.NotificationCompat.Builder as NotificationBuilder
1415

1516
internal class SingleMessageNotificationCreator(
1617
private val notificationHelper: NotificationHelper,
1718
private val actionCreator: NotificationActionCreator,
1819
private val resourceProvider: NotificationResourceProvider,
1920
private val lockScreenNotificationCreator: LockScreenNotificationCreator,
21+
private val messageListPreferencesManager: MessageListPreferencesManager,
2022
private val application: Application,
2123
) {
2224
private val scope = CoroutineScope(SupervisorJob() + Dispatchers.Main.immediate)
@@ -63,6 +65,8 @@ internal class SingleMessageNotificationCreator(
6365
}
6466

6567
private suspend fun NotificationBuilder.setAvatar(content: NotificationContent) = apply {
68+
if (!messageListPreferencesManager.getConfig().isShowContactPicture) return@apply
69+
6670
resourceProvider.avatar(content.sender)?.let {
6771
setLargeIcon(IconCompat.createWithAdaptiveBitmap(it).toIcon(application))
6872
}

0 commit comments

Comments
 (0)