Use structured name when formatted name is empty
This commit is contained in:
parent
d95985841a
commit
8dc4687328
3 changed files with 19 additions and 16 deletions
|
|
@ -13,3 +13,19 @@ fun parseVCardFromUri(context: Context, uri: Uri, callback: (vCards: List<VCard>
|
|||
callback(vCards)
|
||||
}
|
||||
}
|
||||
|
||||
fun VCard?.parseNameFromVCard(): String? {
|
||||
if (this == null) return null
|
||||
var fullName = formattedName?.value
|
||||
if (fullName.isNullOrEmpty()) {
|
||||
val structured = structuredName
|
||||
val given = structured?.given
|
||||
val family = structured.family
|
||||
fullName = if (family != null) {
|
||||
given?.plus(" ")?.plus(family)
|
||||
} else {
|
||||
given
|
||||
}
|
||||
}
|
||||
return fullName
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue