mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-02-20 05:20:56 +01:00
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 suffixComma = if (suffix.isEmpty()) "" else ", $suffix"
|
||||||
val fullName = "$prefix $firstPart $lastPart$suffixComma".trim()
|
val fullName = "$prefix $firstPart $lastPart$suffixComma".trim()
|
||||||
return if (fullName.isEmpty()) {
|
return if (fullName.isEmpty()) {
|
||||||
if (organization.isEmpty()) {
|
if (organization.isNotEmpty()) {
|
||||||
emails.firstOrNull()?.value?.trim() ?: ""
|
|
||||||
} else {
|
|
||||||
var fullOrganization = if (organization.jobPosition.isEmpty()) "" else "${organization.jobPosition}, "
|
var fullOrganization = if (organization.jobPosition.isEmpty()) "" else "${organization.jobPosition}, "
|
||||||
fullOrganization += organization.company
|
fullOrganization += organization.company
|
||||||
fullOrganization.trim().trimEnd(',')
|
fullOrganization.trim().trimEnd(',')
|
||||||
|
} else {
|
||||||
|
emails.firstOrNull()?.value?.trim() ?: ""
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fullName
|
fullName
|
||||||
|
@ -2,4 +2,6 @@ package com.simplemobiletools.contacts.models
|
|||||||
|
|
||||||
data class Organization(var company: String, var jobPosition: String) {
|
data class Organization(var company: String, var jobPosition: String) {
|
||||||
fun isEmpty() = company.isEmpty() && jobPosition.isEmpty()
|
fun isEmpty() = company.isEmpty() && jobPosition.isEmpty()
|
||||||
|
|
||||||
|
fun isNotEmpty() = !isEmpty()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user