From 213371d18f1a497f42cbb64122f547788e077261 Mon Sep 17 00:00:00 2001 From: marcRDZ Date: Mon, 4 Nov 2024 14:11:13 +0100 Subject: [PATCH] Extract chip initials from display name --- .../navigation/drawer/ui/account/AccountAvatar.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/feature/navigation/drawer/src/main/kotlin/app/k9mail/feature/navigation/drawer/ui/account/AccountAvatar.kt b/feature/navigation/drawer/src/main/kotlin/app/k9mail/feature/navigation/drawer/ui/account/AccountAvatar.kt index c4142dff931..3e6d2e5e5b7 100644 --- a/feature/navigation/drawer/src/main/kotlin/app/k9mail/feature/navigation/drawer/ui/account/AccountAvatar.kt +++ b/feature/navigation/drawer/src/main/kotlin/app/k9mail/feature/navigation/drawer/ui/account/AccountAvatar.kt @@ -50,7 +50,7 @@ internal fun AccountAvatar( .border(2.dp, MainTheme.colors.surfaceContainerLowest, CircleShape), ) { Placeholder( - email = account.account.email, + displayName = account.account.displayName, ) // TODO: Add image loading } @@ -64,11 +64,11 @@ internal fun AccountAvatar( @Composable private fun Placeholder( - email: String, + displayName: String, modifier: Modifier = Modifier, ) { TextTitleMedium( - text = extractDomainInitials(email).uppercase(), + text = extractNameInitials(displayName).uppercase(), modifier = modifier, ) } @@ -102,6 +102,6 @@ private fun UnreadBadge( } } -private fun extractDomainInitials(email: String): String { - return email.split("@")[1].take(2) +private fun extractNameInitials(displayName: String): String { + return displayName.take(2) }