From aed1147e9f688ef1a6ec18518cbc678329d66f28 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 20 Mar 2018 14:50:52 +0100 Subject: [PATCH] use contact_id instead of raw_contact_id at deleting contacts from groups --- .../simplemobiletools/contacts/helpers/ContactsHelper.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/helpers/ContactsHelper.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/helpers/ContactsHelper.kt index 8b9d93fe..a652f17d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/helpers/ContactsHelper.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/helpers/ContactsHelper.kt @@ -670,8 +670,8 @@ class ContactsHelper(val activity: BaseSimpleActivity) { if (relevantGroupIDs.isNotEmpty()) { val IDsString = TextUtils.join(",", relevantGroupIDs) ContentProviderOperation.newDelete(ContactsContract.Data.CONTENT_URI).apply { - val selection = "${ContactsContract.Data.RAW_CONTACT_ID} = ? AND ${ContactsContract.Data.MIMETYPE} = ? AND ${ContactsContract.Data.DATA1} IN ($IDsString)" - val selectionArgs = arrayOf(contact.id.toString(), CommonDataKinds.GroupMembership.CONTENT_ITEM_TYPE) + val selection = "${ContactsContract.Data.CONTACT_ID} = ? AND ${ContactsContract.Data.MIMETYPE} = ? AND ${ContactsContract.Data.DATA1} IN ($IDsString)" + val selectionArgs = arrayOf(contact.contactId.toString(), CommonDataKinds.GroupMembership.CONTENT_ITEM_TYPE) withSelection(selection, selectionArgs) operations.add(build()) } @@ -764,8 +764,8 @@ class ContactsHelper(val activity: BaseSimpleActivity) { val operations = ArrayList() contacts.forEach { ContentProviderOperation.newDelete(ContactsContract.Data.CONTENT_URI).apply { - val selection = "${ContactsContract.Data.RAW_CONTACT_ID} = ? AND ${ContactsContract.Data.MIMETYPE} = ? AND ${ContactsContract.Data.DATA1} = ?" - val selectionArgs = arrayOf(it.id.toString(), CommonDataKinds.GroupMembership.CONTENT_ITEM_TYPE, groupId.toString()) + val selection = "${ContactsContract.Data.CONTACT_ID} = ? AND ${ContactsContract.Data.MIMETYPE} = ? AND ${ContactsContract.Data.DATA1} = ?" + val selectionArgs = arrayOf(it.contactId.toString(), CommonDataKinds.GroupMembership.CONTENT_ITEM_TYPE, groupId.toString()) withSelection(selection, selectionArgs) operations.add(build()) }