Skip to content

Commit 22a4cca

Browse files
committed
add a helper function for getting contact sources synchronously
1 parent 2424869 commit 22a4cca

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

app/src/main/kotlin/com/simplemobiletools/contacts/helpers/ContactsHelper.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -637,12 +637,16 @@ class ContactsHelper(val activity: BaseSimpleActivity) {
637637

638638
fun getContactSources(callback: (ArrayList<ContactSource>) -> Unit) {
639639
Thread {
640-
val sources = getDeviceContactSources()
641-
sources.add(ContactSource(activity.getString(R.string.phone_storage_hidden), SMT_PRIVATE))
642-
callback(ArrayList(sources))
640+
callback(getContactSourcesSync())
643641
}.start()
644642
}
645643

644+
private fun getContactSourcesSync(): ArrayList<ContactSource> {
645+
val sources = getDeviceContactSources()
646+
sources.add(ContactSource(activity.getString(R.string.phone_storage_hidden), SMT_PRIVATE))
647+
return ArrayList(sources)
648+
}
649+
646650
private fun getDeviceContactSources(): LinkedHashSet<ContactSource> {
647651
val sources = LinkedHashSet<ContactSource>()
648652
if (!activity.hasContactPermissions()) {

0 commit comments

Comments
 (0)