mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-02-05 02:08:14 +01:00
catch and show exceptions thrown at modifying groups
This commit is contained in:
parent
855b4e0188
commit
8f890f4f54
@ -1217,6 +1217,7 @@ class ContactsHelper(val context: Context) {
|
||||
}
|
||||
|
||||
fun addContactsToGroup(contacts: ArrayList<Contact>, groupId: Long) {
|
||||
try {
|
||||
val operations = ArrayList<ContentProviderOperation>()
|
||||
contacts.forEach {
|
||||
ContentProviderOperation.newInsert(Data.CONTENT_URI).apply {
|
||||
@ -1232,7 +1233,6 @@ class ContactsHelper(val context: Context) {
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
context.contentResolver.applyBatch(AUTHORITY, operations)
|
||||
} catch (e: Exception) {
|
||||
context.showErrorToast(e)
|
||||
@ -1240,6 +1240,7 @@ class ContactsHelper(val context: Context) {
|
||||
}
|
||||
|
||||
fun removeContactsFromGroup(contacts: ArrayList<Contact>, groupId: Long) {
|
||||
try {
|
||||
val operations = ArrayList<ContentProviderOperation>()
|
||||
contacts.forEach {
|
||||
ContentProviderOperation.newDelete(Data.CONTENT_URI).apply {
|
||||
@ -1255,6 +1256,9 @@ class ContactsHelper(val context: Context) {
|
||||
}
|
||||
}
|
||||
context.contentResolver.applyBatch(AUTHORITY, operations)
|
||||
} catch (e: Exception) {
|
||||
context.showErrorToast(e)
|
||||
}
|
||||
}
|
||||
|
||||
fun insertContact(contact: Contact): Boolean {
|
||||
|
Loading…
x
Reference in New Issue
Block a user