Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ val coreNotificationModule = module {
actionCreator = get(),
resourceProvider = get(),
lockScreenNotificationCreator = get(),
messageListPreferencesManager = get(),
application = androidApplication(),
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ 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(
private val notificationHelper: NotificationHelper,
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)
Expand Down Expand Up @@ -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))
}
Expand Down
Loading