fix a glitch with casual Phone Storage not being visible

This commit is contained in:
tibbi 2022-03-24 10:31:18 +01:00
parent 4d9940865c
commit faf6a8597a

View File

@ -810,12 +810,17 @@ class ContactsHelper(val context: Context) {
}
}
var hadEmptyAccount = false
val contentResolverAccounts = getContentResolverAccounts().filter {
if (it.name.isEmpty() && it.type.isEmpty()) {
hadEmptyAccount = true
}
it.name.isNotEmpty() && it.type.isNotEmpty() && !accounts.contains(Account(it.name, it.type))
}
sources.addAll(contentResolverAccounts)
if (!sources.any { it.type.startsWith("com.google") || it.type.startsWith("com.android") || it.type.startsWith("com.qualcomm") }) {
if (hadEmptyAccount) {
sources.add(ContactSource("", "", context.getString(R.string.phone_storage)))
}