make an if/else check clearer
This commit is contained in:
parent
952cce20c0
commit
6de4f09319
|
@ -94,12 +94,12 @@ data class Contact(val id: Int, var prefix: String, var firstName: String, var m
|
|||
val suffixComma = if (suffix.isEmpty()) "" else ", $suffix"
|
||||
val fullName = "$prefix $firstPart $lastPart$suffixComma".trim()
|
||||
return if (fullName.isEmpty()) {
|
||||
if (organization.isEmpty()) {
|
||||
emails.firstOrNull()?.value?.trim() ?: ""
|
||||
} else {
|
||||
if (organization.isNotEmpty()) {
|
||||
var fullOrganization = if (organization.jobPosition.isEmpty()) "" else "${organization.jobPosition}, "
|
||||
fullOrganization += organization.company
|
||||
fullOrganization.trim().trimEnd(',')
|
||||
} else {
|
||||
emails.firstOrNull()?.value?.trim() ?: ""
|
||||
}
|
||||
} else {
|
||||
fullName
|
||||
|
|
|
@ -2,4 +2,6 @@ package com.simplemobiletools.contacts.models
|
|||
|
||||
data class Organization(var company: String, var jobPosition: String) {
|
||||
fun isEmpty() = company.isEmpty() && jobPosition.isEmpty()
|
||||
|
||||
fun isNotEmpty() = !isEmpty()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue