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