check if the default set contact source is valid at creating a new contact

This commit is contained in:
tibbi 2020-04-26 21:22:38 +02:00
parent 4b8ea90443
commit a9e639d73e

View File

@ -601,6 +601,18 @@ class EditContactActivity : ContactActivity() {
getPublicContactSource(contact!!.source) {
contact_source.text = it
}
// if the last used contact source is not available anymore, use the first available one. Could happen at ejecting SIM card
ContactsHelper(this).getSaveableContactSources { sources ->
val sourceNames = sources.map { it.name }
if (!sourceNames.contains(originalContactSource)) {
originalContactSource = sourceNames.first()
contact?.source = originalContactSource
getPublicContactSource(contact!!.source) {
contact_source.text = it
}
}
}
}
private fun setupTypePickers() {