diff --git a/CHANGELOG.md b/CHANGELOG.md index a9a92d320..50875c220 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Fixed +- Fixed contacts imported from vCard files being mis-sorted (filed after "Z") when their name fields contained leading or trailing whitespace ([#195]) ## [1.6.0] - 2026-01-30 ### Added @@ -119,6 +121,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [#30]: https://github.com/FossifyOrg/Contacts/issues/30 [#78]: https://github.com/FossifyOrg/Contacts/issues/78 [#157]: https://github.com/FossifyOrg/Contacts/issues/157 +[#195]: https://github.com/FossifyOrg/Contacts/issues/195 [#201]: https://github.com/FossifyOrg/Contacts/issues/201 [#281]: https://github.com/FossifyOrg/Contacts/issues/281 [#289]: https://github.com/FossifyOrg/Contacts/issues/289 diff --git a/app/src/main/kotlin/org/fossify/contacts/helpers/VcfImporter.kt b/app/src/main/kotlin/org/fossify/contacts/helpers/VcfImporter.kt index d966813d9..4703f6aee 100644 --- a/app/src/main/kotlin/org/fossify/contacts/helpers/VcfImporter.kt +++ b/app/src/main/kotlin/org/fossify/contacts/helpers/VcfImporter.kt @@ -54,12 +54,12 @@ class VcfImporter(val activity: SimpleActivity) { val ezContacts = Ezvcard.parse(inputStream).all() for (ezContact in ezContacts) { val structuredName = ezContact.structuredName - val prefix = structuredName?.prefixes?.firstOrNull() ?: "" - val firstName = structuredName?.given ?: "" - val middleName = structuredName?.additionalNames?.firstOrNull() ?: "" - val surname = structuredName?.family ?: "" - val suffix = structuredName?.suffixes?.firstOrNull() ?: "" - val nickname = ezContact.nickname?.values?.firstOrNull() ?: "" + val prefix = structuredName?.prefixes?.firstOrNull()?.trim() ?: "" + val firstName = structuredName?.given?.trim() ?: "" + val middleName = structuredName?.additionalNames?.firstOrNull()?.trim() ?: "" + val surname = structuredName?.family?.trim() ?: "" + val suffix = structuredName?.suffixes?.firstOrNull()?.trim() ?: "" + val nickname = ezContact.nickname?.values?.firstOrNull()?.trim() ?: "" var photoUri = "" val phoneNumbers = ArrayList()