Skip to content

Commit 54c6439

Browse files
committed
SES-4292 - Truncating user names for tooltip
1 parent 9d48cea commit 54c6439

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

app/src/main/java/org/thoughtcrime/securesms/util/UserProfileUtils.kt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class UserProfileUtils @AssistedInject constructor(
9191
isResolvedBlinded -> {
9292
"${address.substring(0, 23)}\n${address.substring(23, 46)}\n${address.substring(46)}" to
9393
Phrase.from(context, R.string.tooltipAccountIdVisible)
94-
.put(NAME_KEY, recipient.name)
94+
.put(NAME_KEY, truncateName(recipient.name))
9595
.format()
9696
}
9797

@@ -119,6 +119,14 @@ class UserProfileUtils @AssistedInject constructor(
119119

120120
}
121121

122+
private fun truncateName(name: String): String {
123+
return if (name.length > 10) {
124+
name.take(10) + ""
125+
} else {
126+
name
127+
}
128+
}
129+
122130
fun onCommand(command: UserProfileModalCommands){
123131
when(command){
124132
UserProfileModalCommands.ShowProCTA -> {

0 commit comments

Comments
 (0)