mirror of
https://github.com/SimpleMobileTools/Simple-SMS-Messenger.git
synced 2025-06-05 21:49:22 +02:00
Also add name prefix and suffix
This commit is contained in:
@@ -18,14 +18,14 @@ fun VCard?.parseNameFromVCard(): String? {
|
|||||||
if (this == null) return null
|
if (this == null) return null
|
||||||
var fullName = formattedName?.value
|
var fullName = formattedName?.value
|
||||||
if (fullName.isNullOrEmpty()) {
|
if (fullName.isNullOrEmpty()) {
|
||||||
val structured = structuredName
|
val structured = structuredName ?: return null
|
||||||
val given = structured?.given
|
val nameComponents = arrayListOf<String?>().apply {
|
||||||
val family = structured.family
|
addAll(structured.prefixes)
|
||||||
fullName = if (family != null) {
|
add(structured.given)
|
||||||
given?.plus(" ")?.plus(family)
|
add(structured.family)
|
||||||
} else {
|
addAll(structured.suffixes)
|
||||||
given
|
|
||||||
}
|
}
|
||||||
|
fullName = nameComponents.filter { !it.isNullOrEmpty() }.joinToString(separator = " ")
|
||||||
}
|
}
|
||||||
return fullName
|
return fullName
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user