Fixed wrong uses of Address.clean()

This commit is contained in:
Sylvain Berfini 2021-04-09 17:55:24 +02:00
parent cefb7ffd90
commit a0511246cd
4 changed files with 16 additions and 12 deletions

View file

@ -49,8 +49,9 @@ class CallViewModelFactory(private val call: Call) :
open class CallViewModel(val call: Call) : GenericContactViewModel(call.remoteAddress) {
val address: String by lazy {
call.remoteAddress.clean() // To remove gruu if any
LinphoneUtils.getDisplayableAddress(call.remoteAddress)
val copy = call.remoteAddress.clone()
copy.clean() // To remove gruu if any
LinphoneUtils.getDisplayableAddress(copy)
}
val isPaused = MutableLiveData<Boolean>()

View file

@ -293,8 +293,9 @@ class ChatMessagesListAdapter(
private fun addSenderToContacts() {
val chatMessage = binding.viewModel?.chatMessage
if (chatMessage != null) {
chatMessage.fromAddress.clean() // To remove gruu if any
addSipUriToContactEvent.value = Event(chatMessage.fromAddress.asStringUriOnly())
val copy = chatMessage.fromAddress.clone()
copy.clean() // To remove gruu if any
addSipUriToContactEvent.value = Event(copy.asStringUriOnly())
}
}
}

View file

@ -69,8 +69,9 @@ class DetailCallLogFragment : GenericFragment<HistoryDetailFragmentBinding>() {
binding.back.visibility = if (resources.getBoolean(R.bool.isTablet)) View.INVISIBLE else View.VISIBLE
binding.setNewContactClickListener {
viewModel.callLog.remoteAddress.clean()
Log.i("[History] Creating contact with SIP URI: ${viewModel.callLog.remoteAddress.asStringUriOnly()}")
val copy = viewModel.callLog.remoteAddress.clone()
copy.clean()
Log.i("[History] Creating contact with SIP URI: ${copy.asStringUriOnly()}")
navigateToContacts(viewModel.callLog.remoteAddress.asStringUriOnly())
}
@ -80,10 +81,10 @@ class DetailCallLogFragment : GenericFragment<HistoryDetailFragmentBinding>() {
Log.i("[History] Displaying contact $contact")
navigateToContact(contact)
} else {
val address = viewModel.callLog.remoteAddress
address.clean()
Log.i("[History] Displaying friend with address ${address.asStringUriOnly()}")
navigateToFriend(address)
val copy = viewModel.callLog.remoteAddress.clone()
copy.clean()
Log.i("[History] Displaying friend with address ${copy.asStringUriOnly()}")
navigateToFriend(copy)
}
}

View file

@ -45,8 +45,9 @@ class CallLogViewModelFactory(private val callLog: CallLog) :
class CallLogViewModel(val callLog: CallLog) : GenericContactViewModel(callLog.remoteAddress) {
val peerSipUri: String by lazy {
callLog.remoteAddress.clean() // To remove gruu if any
LinphoneUtils.getDisplayableAddress(callLog.remoteAddress)
val copy = callLog.remoteAddress.clone()
copy.clean() // To remove gruu if any
LinphoneUtils.getDisplayableAddress(copy)
}
val statusIconResource: Int by lazy {