mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 03:18:06 +00:00
Added missing trims
This commit is contained in:
parent
fa7c6907be
commit
dc01abf48f
10 changed files with 33 additions and 45 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -7,6 +7,7 @@
|
|||
/.idea/workspace.xml
|
||||
/.idea/navEditor.xml
|
||||
/.idea/assetWizardSettings.xml
|
||||
.idea/deploymentTargetDropDown.xml
|
||||
.DS_Store
|
||||
/build
|
||||
/captures
|
||||
|
|
|
|||
17
.idea/deploymentTargetDropDown.xml
generated
17
.idea/deploymentTargetDropDown.xml
generated
|
|
@ -1,17 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="deploymentTargetDropDown">
|
||||
<runningDeviceTargetSelectedWithDropDown>
|
||||
<Target>
|
||||
<type value="RUNNING_DEVICE_TARGET" />
|
||||
<deviceKey>
|
||||
<Key>
|
||||
<type value="SERIAL_NUMBER" />
|
||||
<value value="1A051FDEE005XG" />
|
||||
</Key>
|
||||
</deviceKey>
|
||||
</Target>
|
||||
</runningDeviceTargetSelectedWithDropDown>
|
||||
<timeTargetWasSelectedWithDropDown value="2023-09-07T11:13:39.568123492Z" />
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -138,6 +138,7 @@ class AccountCreationViewModel @UiThread constructor() : ViewModel() {
|
|||
response: String?
|
||||
) {
|
||||
Log.i("$TAG onCreateAccount status [$status] ($response)")
|
||||
accountCreator.token = null
|
||||
operationInProgress.postValue(false)
|
||||
|
||||
when (status) {
|
||||
|
|
@ -254,13 +255,13 @@ class AccountCreationViewModel @UiThread constructor() : ViewModel() {
|
|||
fun confirmPhoneNumber() {
|
||||
coreContext.postOnCoreThread {
|
||||
if (::accountCreator.isInitialized) {
|
||||
val prefix = internationalPrefix.value.orEmpty()
|
||||
val prefix = internationalPrefix.value.orEmpty().trim()
|
||||
val digitsPrefix = if (prefix.startsWith("+")) {
|
||||
prefix.substring(1)
|
||||
} else {
|
||||
prefix
|
||||
}
|
||||
val number = phoneNumber.value.orEmpty()
|
||||
val number = phoneNumber.value.orEmpty().trim()
|
||||
accountCreator.setPhoneNumber(number, digitsPrefix)
|
||||
|
||||
val normalizedPhoneNumber = accountCreator.phoneNumber
|
||||
|
|
@ -316,7 +317,7 @@ class AccountCreationViewModel @UiThread constructor() : ViewModel() {
|
|||
@WorkerThread
|
||||
private fun checkUsername() {
|
||||
usernameError.postValue("")
|
||||
accountCreator.username = username.value.orEmpty()
|
||||
accountCreator.username = username.value.orEmpty().trim()
|
||||
|
||||
operationInProgress.postValue(true)
|
||||
val status = accountCreator.isAccountExist
|
||||
|
|
@ -342,7 +343,7 @@ class AccountCreationViewModel @UiThread constructor() : ViewModel() {
|
|||
@WorkerThread
|
||||
private fun createAccount() {
|
||||
operationInProgress.postValue(true)
|
||||
accountCreator.password = password.value.orEmpty()
|
||||
accountCreator.password = password.value.orEmpty().trim()
|
||||
val status = accountCreator.createAccount()
|
||||
|
||||
Log.i("$TAG createAccount returned $status")
|
||||
|
|
|
|||
|
|
@ -113,13 +113,13 @@ class AccountLoginViewModel @UiThread constructor() : ViewModel() {
|
|||
coreContext.postOnCoreThread { core ->
|
||||
core.loadConfigFromXml(corePreferences.linphoneDefaultValuesPath)
|
||||
|
||||
val user = username.value.orEmpty()
|
||||
val user = username.value.orEmpty().trim()
|
||||
val domain = corePreferences.defaultDomain
|
||||
|
||||
newlyCreatedAuthInfo = Factory.instance().createAuthInfo(
|
||||
user,
|
||||
null,
|
||||
password.value.orEmpty(),
|
||||
password.value.orEmpty().trim(),
|
||||
null,
|
||||
null,
|
||||
domain
|
||||
|
|
@ -130,7 +130,7 @@ class AccountLoginViewModel @UiThread constructor() : ViewModel() {
|
|||
val identityAddress = Factory.instance().createAddress("sip:$user@$domain")
|
||||
accountParams.identityAddress = identityAddress
|
||||
|
||||
val prefix = internationalPrefix.value.orEmpty()
|
||||
val prefix = internationalPrefix.value.orEmpty().trim()
|
||||
if (prefix.isNotEmpty()) {
|
||||
val prefixDigits = if (prefix.startsWith("+")) {
|
||||
prefix.substring(1)
|
||||
|
|
|
|||
|
|
@ -128,13 +128,13 @@ class ThirdPartySipAccountLoginViewModel @UiThread constructor() : ViewModel() {
|
|||
coreContext.postOnCoreThread { core ->
|
||||
core.loadConfigFromXml(corePreferences.thirdPartyDefaultValuesPath)
|
||||
|
||||
val user = username.value.orEmpty()
|
||||
val domainValue = domain.value.orEmpty()
|
||||
val user = username.value.orEmpty().trim()
|
||||
val domainValue = domain.value.orEmpty().trim()
|
||||
|
||||
newlyCreatedAuthInfo = Factory.instance().createAuthInfo(
|
||||
user,
|
||||
null,
|
||||
password.value.orEmpty(),
|
||||
password.value.orEmpty().trim(),
|
||||
null,
|
||||
null,
|
||||
domainValue
|
||||
|
|
@ -145,19 +145,19 @@ class ThirdPartySipAccountLoginViewModel @UiThread constructor() : ViewModel() {
|
|||
|
||||
val identityAddress = Factory.instance().createAddress("sip:$user@$domainValue")
|
||||
if (displayName.value.orEmpty().isNotEmpty()) {
|
||||
identityAddress?.displayName = displayName.value.orEmpty()
|
||||
identityAddress?.displayName = displayName.value.orEmpty().trim()
|
||||
}
|
||||
accountParams.identityAddress = identityAddress
|
||||
|
||||
val serverAddress = Factory.instance().createAddress("sip:$domainValue")
|
||||
serverAddress?.transport = when (transport.value.orEmpty()) {
|
||||
serverAddress?.transport = when (transport.value.orEmpty().trim()) {
|
||||
TCP -> TransportType.Tcp
|
||||
TLS -> TransportType.Tls
|
||||
else -> TransportType.Udp
|
||||
}
|
||||
accountParams.serverAddress = serverAddress
|
||||
|
||||
val prefix = internationalPrefix.value.orEmpty()
|
||||
val prefix = internationalPrefix.value.orEmpty().trim()
|
||||
if (prefix.isNotEmpty()) {
|
||||
val prefixDigits = if (prefix.startsWith("+")) {
|
||||
prefix.substring(1)
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ class CallsListFragment : GenericFragment() {
|
|||
}
|
||||
|
||||
listViewModel.searchFilter.observe(viewLifecycleOwner) { filter ->
|
||||
listViewModel.applyFilter(filter)
|
||||
listViewModel.applyFilter(filter.trim())
|
||||
}
|
||||
|
||||
listViewModel.focusSearchBarEvent.observe(viewLifecycleOwner) {
|
||||
|
|
|
|||
|
|
@ -147,8 +147,9 @@ class StartCallFragment : GenericFragment() {
|
|||
}
|
||||
|
||||
viewModel.searchFilter.observe(viewLifecycleOwner) { filter ->
|
||||
contactsListViewModel.applyFilter(filter)
|
||||
viewModel.applyFilter(filter)
|
||||
val trimmed = filter.trim()
|
||||
contactsListViewModel.applyFilter(trimmed)
|
||||
viewModel.applyFilter(trimmed)
|
||||
}
|
||||
|
||||
viewModel.appendDigitToSearchBarEvent.observe(viewLifecycleOwner) {
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ class ContactsListFragment : GenericFragment() {
|
|||
}
|
||||
|
||||
listViewModel.searchFilter.observe(viewLifecycleOwner) { filter ->
|
||||
listViewModel.applyFilter(filter)
|
||||
listViewModel.applyFilter(filter.trim())
|
||||
}
|
||||
|
||||
listViewModel.focusSearchBarEvent.observe(viewLifecycleOwner) {
|
||||
|
|
|
|||
|
|
@ -133,14 +133,16 @@ class ContactNewOrEditViewModel @UiThread constructor() : ViewModel() {
|
|||
// Disable peer to peer short term presence
|
||||
friend.incSubscribePolicy = SubscribePolicy.SPDeny
|
||||
}
|
||||
friend.name = "${firstName.value.orEmpty().trim()} ${lastName.value.orEmpty().trim()}"
|
||||
val fn = firstName.value.orEmpty().trim()
|
||||
val ln = lastName.value.orEmpty().trim()
|
||||
friend.name = "$fn $ln"
|
||||
|
||||
friend.edit()
|
||||
|
||||
val vCard = friend.vcard
|
||||
if (vCard != null) {
|
||||
vCard.familyName = lastName.value
|
||||
vCard.givenName = firstName.value
|
||||
vCard.familyName = fn
|
||||
vCard.givenName = ln
|
||||
|
||||
val picture = picturePath.value.orEmpty()
|
||||
if (picture.isNotEmpty()) {
|
||||
|
|
@ -155,9 +157,9 @@ class ContactNewOrEditViewModel @UiThread constructor() : ViewModel() {
|
|||
friend.removeAddress(address)
|
||||
}
|
||||
for (address in sipAddresses) {
|
||||
val data = address.value.value
|
||||
if (!data.isNullOrEmpty()) {
|
||||
val parsedAddress = core.interpretUrl(data.trim(), true)
|
||||
val data = address.value.value.orEmpty().trim()
|
||||
if (data.isNotEmpty()) {
|
||||
val parsedAddress = core.interpretUrl(data, true)
|
||||
if (parsedAddress != null) {
|
||||
friend.addAddress(parsedAddress)
|
||||
}
|
||||
|
|
@ -168,9 +170,9 @@ class ContactNewOrEditViewModel @UiThread constructor() : ViewModel() {
|
|||
friend.removePhoneNumber(number)
|
||||
}
|
||||
for (number in phoneNumbers) {
|
||||
val data = number.value.value
|
||||
if (!data.isNullOrEmpty()) {
|
||||
friend.addPhoneNumber(data.trim())
|
||||
val data = number.value.value.orEmpty().trim()
|
||||
if (data.isNotEmpty()) {
|
||||
friend.addPhoneNumber(data)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -55,8 +55,8 @@ class AccountProfileViewModel @UiThread constructor() : ViewModel() {
|
|||
|
||||
copy.internationalPrefix = internationalPrefix.value.orEmpty()
|
||||
|
||||
val newPictureUri = picturePath.value
|
||||
if (!newPictureUri.isNullOrEmpty() && newPictureUri != params.pictureUri) {
|
||||
val newPictureUri = picturePath.value.orEmpty().trim()
|
||||
if (newPictureUri.isNotEmpty() && newPictureUri != params.pictureUri) {
|
||||
Log.i("$TAG New account profile picture [$newPictureUri]")
|
||||
copy.pictureUri = newPictureUri
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue