mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-01-31 07:55:03 +01:00
adding a couple checks of contacts permissions
This commit is contained in:
parent
d3c87e241c
commit
25c9abb92d
@ -109,7 +109,7 @@ class GroupContactsActivity : SimpleActivity(), RemoveFromGroupListener, Refresh
|
||||
}
|
||||
|
||||
override fun removeFromGroup(contacts: ArrayList<Contact>) {
|
||||
ContactsHelper(this).removeContactsFromGroup(contacts, group.id)
|
||||
removeContactsFromGroup(contacts, group.id)
|
||||
if (groupContacts.size == 0) {
|
||||
refreshContacts()
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ fun BaseSimpleActivity.addContactsToGroup(contacts: ArrayList<Contact>, groupId:
|
||||
fun BaseSimpleActivity.removeContactsFromGroup(contacts: ArrayList<Contact>, groupId: Long) {
|
||||
val publicContacts = contacts.filter { it.source != SMT_PRIVATE }
|
||||
val privateContacts = contacts.filter { it.source == SMT_PRIVATE }
|
||||
if (publicContacts.isNotEmpty()) {
|
||||
if (publicContacts.isNotEmpty() && hasContactPermissions()) {
|
||||
ContactsHelper(this).removeContactsFromGroup(contacts, groupId)
|
||||
}
|
||||
|
||||
|
@ -1024,12 +1024,16 @@ class ContactsHelper(val activity: BaseSimpleActivity) {
|
||||
|
||||
fun addFavorites(contacts: ArrayList<Contact>) {
|
||||
toggleLocalFavorites(contacts, true)
|
||||
toggleFavorites(contacts, true)
|
||||
if (activity.hasContactPermissions()) {
|
||||
toggleFavorites(contacts, true)
|
||||
}
|
||||
}
|
||||
|
||||
fun removeFavorites(contacts: ArrayList<Contact>) {
|
||||
toggleLocalFavorites(contacts, false)
|
||||
toggleFavorites(contacts, false)
|
||||
if (activity.hasContactPermissions()) {
|
||||
toggleFavorites(contacts, false)
|
||||
}
|
||||
}
|
||||
|
||||
private fun toggleFavorites(contacts: ArrayList<Contact>, addToFavorites: Boolean) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user