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