From b4c4691f1cc259ba170370f8e74c470d806c593f Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 19 Jun 2018 16:10:55 +0200 Subject: [PATCH] fix #174, make "Filter out duplicates" a bit more agressive --- .../simplemobiletools/contacts/models/Contact.kt | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/models/Contact.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/models/Contact.kt index 5e16348a..a5a95c7a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/models/Contact.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/models/Contact.kt @@ -85,8 +85,19 @@ data class Contact(val id: Int, var prefix: String, var firstName: String, var m fun getHashToCompare(): Int { val newPhoneNumbers = ArrayList() - phoneNumbers.mapTo(newPhoneNumbers, { PhoneNumber(it.value.replace(pattern, ""), 0) }) + phoneNumbers.mapTo(newPhoneNumbers) { PhoneNumber(it.value.replace(pattern, ""), 0) } + + val newEvents = ArrayList() + events.mapTo(newEvents) { Event(it.value.replace(pattern, ""), 0) } + + val newAddresses = ArrayList
() + addresses.mapTo(newAddresses) { Address(it.value, 0) } + + val newEmails = ArrayList() + emails.mapTo(newEmails) { Email(it.value, 0) } + return copy(id = 0, prefix = "", firstName = getFullName().toLowerCase(), middleName = "", surname = "", suffix = "", photoUri = "", - phoneNumbers = newPhoneNumbers, source = "", starred = 0, contactId = 0, thumbnailUri = "", notes = "").hashCode() + phoneNumbers = newPhoneNumbers, events = newEvents, addresses = newAddresses, emails = newEmails, source = "", starred = 0, + contactId = 0, thumbnailUri = "", notes = "", groups = ArrayList(), websites = ArrayList(), organization = Organization("", "")).hashCode() } }