do not update contact organization, if there is none
This commit is contained in:
parent
8449b00b7d
commit
f1aa4e96d7
|
@ -154,7 +154,7 @@ class ContactsHelper(val context: Context) {
|
|||
val mimetype = cursor.getStringValue(Data.MIMETYPE)
|
||||
|
||||
// ignore names at Organization type contacts
|
||||
if (cursor.getStringValue(Data.MIMETYPE) == StructuredName.CONTENT_ITEM_TYPE) {
|
||||
if (mimetype == StructuredName.CONTENT_ITEM_TYPE) {
|
||||
prefix = cursor.getStringValue(StructuredName.PREFIX) ?: ""
|
||||
firstName = cursor.getStringValue(StructuredName.GIVEN_NAME) ?: ""
|
||||
middleName = cursor.getStringValue(StructuredName.MIDDLE_NAME) ?: ""
|
||||
|
@ -1012,6 +1012,7 @@ class ContactsHelper(val context: Context) {
|
|||
}
|
||||
|
||||
// add organization
|
||||
if (contact.organization.isNotEmpty()) {
|
||||
ContentProviderOperation.newInsert(Data.CONTENT_URI).apply {
|
||||
withValue(Data.RAW_CONTACT_ID, contact.id)
|
||||
withValue(Data.MIMETYPE, CommonDataKinds.Organization.CONTENT_ITEM_TYPE)
|
||||
|
@ -1021,6 +1022,7 @@ class ContactsHelper(val context: Context) {
|
|||
withValue(CommonDataKinds.Organization.TYPE, DEFAULT_ORGANIZATION_TYPE)
|
||||
operations.add(build())
|
||||
}
|
||||
}
|
||||
|
||||
// delete websites
|
||||
ContentProviderOperation.newDelete(Data.CONTENT_URI).apply {
|
||||
|
|
Loading…
Reference in New Issue