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) { open class CallViewModel(val call: Call) : GenericContactViewModel(call.remoteAddress) {
val address: String by lazy { val address: String by lazy {
call.remoteAddress.clean() // To remove gruu if any val copy = call.remoteAddress.clone()
LinphoneUtils.getDisplayableAddress(call.remoteAddress) copy.clean() // To remove gruu if any
LinphoneUtils.getDisplayableAddress(copy)
} }
val isPaused = MutableLiveData<Boolean>() val isPaused = MutableLiveData<Boolean>()

View file

@ -293,8 +293,9 @@ class ChatMessagesListAdapter(
private fun addSenderToContacts() { private fun addSenderToContacts() {
val chatMessage = binding.viewModel?.chatMessage val chatMessage = binding.viewModel?.chatMessage
if (chatMessage != null) { if (chatMessage != null) {
chatMessage.fromAddress.clean() // To remove gruu if any val copy = chatMessage.fromAddress.clone()
addSipUriToContactEvent.value = Event(chatMessage.fromAddress.asStringUriOnly()) 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.back.visibility = if (resources.getBoolean(R.bool.isTablet)) View.INVISIBLE else View.VISIBLE
binding.setNewContactClickListener { binding.setNewContactClickListener {
viewModel.callLog.remoteAddress.clean() val copy = viewModel.callLog.remoteAddress.clone()
Log.i("[History] Creating contact with SIP URI: ${viewModel.callLog.remoteAddress.asStringUriOnly()}") copy.clean()
Log.i("[History] Creating contact with SIP URI: ${copy.asStringUriOnly()}")
navigateToContacts(viewModel.callLog.remoteAddress.asStringUriOnly()) navigateToContacts(viewModel.callLog.remoteAddress.asStringUriOnly())
} }
@ -80,10 +81,10 @@ class DetailCallLogFragment : GenericFragment<HistoryDetailFragmentBinding>() {
Log.i("[History] Displaying contact $contact") Log.i("[History] Displaying contact $contact")
navigateToContact(contact) navigateToContact(contact)
} else { } else {
val address = viewModel.callLog.remoteAddress val copy = viewModel.callLog.remoteAddress.clone()
address.clean() copy.clean()
Log.i("[History] Displaying friend with address ${address.asStringUriOnly()}") Log.i("[History] Displaying friend with address ${copy.asStringUriOnly()}")
navigateToFriend(address) navigateToFriend(copy)
} }
} }

View file

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