add a helper function for getting contact sources synchronously
This commit is contained in:
parent
24248699bc
commit
22a4cca1fe
|
@ -637,12 +637,16 @@ class ContactsHelper(val activity: BaseSimpleActivity) {
|
|||
|
||||
fun getContactSources(callback: (ArrayList<ContactSource>) -> Unit) {
|
||||
Thread {
|
||||
val sources = getDeviceContactSources()
|
||||
sources.add(ContactSource(activity.getString(R.string.phone_storage_hidden), SMT_PRIVATE))
|
||||
callback(ArrayList(sources))
|
||||
callback(getContactSourcesSync())
|
||||
}.start()
|
||||
}
|
||||
|
||||
private fun getContactSourcesSync(): ArrayList<ContactSource> {
|
||||
val sources = getDeviceContactSources()
|
||||
sources.add(ContactSource(activity.getString(R.string.phone_storage_hidden), SMT_PRIVATE))
|
||||
return ArrayList(sources)
|
||||
}
|
||||
|
||||
private fun getDeviceContactSources(): LinkedHashSet<ContactSource> {
|
||||
val sources = LinkedHashSet<ContactSource>()
|
||||
if (!activity.hasContactPermissions()) {
|
||||
|
|
Loading…
Reference in New Issue