Trim string before making a new call or creating a chat room

This commit is contained in:
Sylvain Berfini 2022-11-21 14:16:52 +01:00
parent ee40995f34
commit 59bcb63dee
2 changed files with 3 additions and 3 deletions

View file

@ -83,7 +83,7 @@ open class ContactsSelectionViewModel : MessageNotifierViewModel() {
}
fun applyFilter() {
val filterValue = filter.value.orEmpty()
val filterValue = filter.value.orEmpty().trim()
if (previousFilter.isNotEmpty() && (
previousFilter.length > filterValue.length ||
@ -97,7 +97,7 @@ open class ContactsSelectionViewModel : MessageNotifierViewModel() {
val domain = if (sipContactsSelected.value == true) coreContext.core.defaultAccount?.params?.domain ?: "" else ""
searchResultsPending = true
fastFetchJob?.cancel()
coreContext.contactsManager.magicSearch.getContactsListAsync(filter.value.orEmpty(), domain, MagicSearchSource.All.toInt(), MagicSearchAggregation.None)
coreContext.contactsManager.magicSearch.getContactsListAsync(filterValue, domain, MagicSearchSource.All.toInt(), MagicSearchAggregation.None)
val spinnerDelay = corePreferences.delayBeforeShowingContactsSearchSpinner.toLong()
fastFetchJob = viewModelScope.launch {

View file

@ -647,7 +647,7 @@ class CoreContext(
}
fun startCall(to: String) {
var stringAddress = to
var stringAddress = to.trim()
if (android.util.Patterns.PHONE.matcher(to).matches()) {
val contact = contactsManager.findContactByPhoneNumber(to)
val alias = contact?.getContactForPhoneNumberOrAddress(to)