adding a weird workaround or what at storing contacts on a SIM card

This commit is contained in:
tibbi 2020-04-27 22:04:39 +02:00
parent a9e639d73e
commit 7aa9cfa328
1 changed files with 11 additions and 0 deletions

View File

@ -1325,6 +1325,17 @@ class ContactsHelper(val context: Context) {
val results: Array<ContentProviderResult>
try {
results = context.contentResolver.applyBatch(AUTHORITY, operations)
// storing contacts on some devices seems to be messed up and they move on Phone instead, or disappear completely
// try storing a lighter contact version with this oldschool version too just so it wont disappear, future edits work well
if (getContactSourceType(contact.source).contains(".sim")) {
val simUri = Uri.parse("content://icc/adn")
ContentValues().apply {
put("number", contact.phoneNumbers.firstOrNull()?.value ?: "")
put("tag", contact.getNameToDisplay())
context.contentResolver.insert(simUri, this)
}
}
} finally {
scaledSizePhotoData = null
}