forked from upstream-mirrors/quik
Format phone number when composing message to new address
This commit is contained in:
@@ -59,6 +59,7 @@ import repository.ContactRepository
|
||||
import repository.MessageRepository
|
||||
import util.extensions.asObservable
|
||||
import java.net.URLDecoder
|
||||
import java.util.*
|
||||
import java.util.concurrent.TimeUnit
|
||||
import javax.inject.Inject
|
||||
|
||||
@@ -208,7 +209,8 @@ class ComposeViewModel(intent: Intent) : QkViewModel<ComposeView, ComposeState>(
|
||||
|
||||
// If the entry is a valid destination, allow it as a recipient
|
||||
if (PhoneNumberUtils.isWellFormedSmsAddress(query.toString())) {
|
||||
val newContact = Contact(numbers = RealmList(PhoneNumber(address = query.toString())))
|
||||
val newAddress = PhoneNumberUtils.formatNumber(query.toString(), Locale.getDefault().country)
|
||||
val newContact = Contact(numbers = RealmList(PhoneNumber(address = newAddress ?: query.toString())))
|
||||
filteredContacts = listOf(newContact) + filteredContacts
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user