only check for nc contacts if phonebook on device is not empty

This commit is contained in:
Marcel Hibbe 2021-03-17 11:17:36 +01:00
parent 5e1b69bbe6
commit 5b6fd3759f
No known key found for this signature in database
GPG Key ID: C793F8B59F43CE7B

View File

@ -91,6 +91,7 @@ class ContactAddressBookWorker(val context: Context, workerParameters: WorkerPar
// collect all contacts with phone number // collect all contacts with phone number
val contactsWithNumbers = collectPhoneNumbers() val contactsWithNumbers = collectPhoneNumbers()
if(contactsWithNumbers.isNotEmpty()){
val currentLocale = ConfigurationCompat.getLocales(context.resources.configuration)[0].country val currentLocale = ConfigurationCompat.getLocales(context.resources.configuration)[0].country
val map = mutableMapOf<String, Any>() val map = mutableMapOf<String, Any>()
@ -113,18 +114,15 @@ class ContactAddressBookWorker(val context: Context, workerParameters: WorkerPar
} }
override fun onNext(foundContacts: ContactsByNumberOverall) { override fun onNext(foundContacts: ContactsByNumberOverall) {
Log.d(javaClass.simpleName, "next")
// todo update
up(foundContacts) up(foundContacts)
} }
override fun onError(e: Throwable) { override fun onError(e: Throwable) {
// TODO error handling Log.e(javaClass.simpleName, "Failed to searchContactsByPhoneNumber", e)
Log.d(javaClass.simpleName, "error")
} }
}) })
}
// store timestamp // store timestamp
appPreferences.setPhoneBookIntegrationLastRun(System.currentTimeMillis()) appPreferences.setPhoneBookIntegrationLastRun(System.currentTimeMillis())