mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-19 04:18:53 +01:00
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 repository.MessageRepository
|
||||||
import util.extensions.asObservable
|
import util.extensions.asObservable
|
||||||
import java.net.URLDecoder
|
import java.net.URLDecoder
|
||||||
|
import java.util.*
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
import javax.inject.Inject
|
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 the entry is a valid destination, allow it as a recipient
|
||||||
if (PhoneNumberUtils.isWellFormedSmsAddress(query.toString())) {
|
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
|
filteredContacts = listOf(newContact) + filteredContacts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user