mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 03:18:06 +00:00
Added hidden setting to allow hiding SIP URIs, show device name instead of SIP full SIP URI when doing trust call from contact details
This commit is contained in:
parent
b40fbcad77
commit
9c8c5f309e
23 changed files with 63 additions and 33 deletions
|
|
@ -795,16 +795,18 @@ fun Friend.getListOfSipAddresses(): ArrayList<Address> {
|
|||
fun Friend.getListOfSipAddressesAndPhoneNumbers(listener: ContactNumberOrAddressClickListener): ArrayList<ContactNumberOrAddressModel> {
|
||||
val addressesAndNumbers = arrayListOf<ContactNumberOrAddressModel>()
|
||||
|
||||
for (address in getListOfSipAddresses()) {
|
||||
val data = ContactNumberOrAddressModel(
|
||||
this,
|
||||
address,
|
||||
address.asStringUriOnly(),
|
||||
true, // SIP addresses are always enabled
|
||||
listener,
|
||||
true
|
||||
)
|
||||
addressesAndNumbers.add(data)
|
||||
if (!corePreferences.hideSipAddresses) {
|
||||
for (address in getListOfSipAddresses()) {
|
||||
val data = ContactNumberOrAddressModel(
|
||||
this,
|
||||
address,
|
||||
address.asStringUriOnly(),
|
||||
true, // SIP addresses are always enabled
|
||||
listener,
|
||||
true
|
||||
)
|
||||
addressesAndNumbers.add(data)
|
||||
}
|
||||
}
|
||||
if (corePreferences.hidePhoneNumbers) {
|
||||
return addressesAndNumbers
|
||||
|
|
@ -825,7 +827,7 @@ fun Friend.getListOfSipAddressesAndPhoneNumbers(listener: ContactNumberOrAddress
|
|||
if (address != null) {
|
||||
address.clean() // To remove ;user=phone
|
||||
presenceAddress = address
|
||||
if (addressesAndNumbers.find { it.address?.weakEqual(address) == true } == null) {
|
||||
if (!corePreferences.hideSipAddresses && addressesAndNumbers.find { it.address?.weakEqual(address) == true } == null) {
|
||||
val data = ContactNumberOrAddressModel(
|
||||
this,
|
||||
address,
|
||||
|
|
|
|||
|
|
@ -281,6 +281,10 @@ class CorePreferences
|
|||
val onlyDisplaySipUriUsername: Boolean
|
||||
get() = config.getBool("ui", "only_display_sip_uri_username", false)
|
||||
|
||||
@get:WorkerThread
|
||||
val hideSipAddresses: Boolean
|
||||
get() = config.getBool("ui", "hide_sip_addresses", false)
|
||||
|
||||
@get:WorkerThread
|
||||
val disableChat: Boolean
|
||||
get() = config.getBool("ui", "disable_chat_feature", false)
|
||||
|
|
|
|||
|
|
@ -145,6 +145,8 @@ class CurrentCallViewModel
|
|||
|
||||
val qualityIcon = MutableLiveData<Int>()
|
||||
|
||||
val hideSipAddresses = MutableLiveData<Boolean>()
|
||||
|
||||
var terminatedByUser = false
|
||||
|
||||
val isRemoteRecordingEvent: MutableLiveData<Event<Pair<Boolean, String>>> by lazy {
|
||||
|
|
@ -541,6 +543,7 @@ class CurrentCallViewModel
|
|||
videoUpdateInProgress.value = false
|
||||
|
||||
coreContext.postOnCoreThread { core ->
|
||||
hideSipAddresses.postValue(corePreferences.hideSipAddresses)
|
||||
coreContext.contactsManager.addListener(contactsListener)
|
||||
|
||||
core.addListener(coreListener)
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class MessageBottomSheetParticipantModel
|
|||
|
||||
@UiThread
|
||||
fun clicked() {
|
||||
if (!isOurOwnReaction && !corePreferences.onlyDisplaySipUriUsername) {
|
||||
if (!isOurOwnReaction && !corePreferences.onlyDisplaySipUriUsername && !corePreferences.hideSipAddresses) {
|
||||
showSipUri.postValue(showSipUri.value == false)
|
||||
} else {
|
||||
onClick?.invoke()
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ class ParticipantModel
|
|||
|
||||
@UiThread
|
||||
fun onClicked() {
|
||||
if (onClicked == null && !corePreferences.onlyDisplaySipUriUsername) {
|
||||
if (onClicked == null && !corePreferences.onlyDisplaySipUriUsername && !corePreferences.hideSipAddresses) {
|
||||
showSipUri.postValue(showSipUri.value == false)
|
||||
} else {
|
||||
onClicked?.invoke(this)
|
||||
|
|
|
|||
|
|
@ -56,6 +56,8 @@ class ConversationInfoViewModel
|
|||
|
||||
val isGroup = MutableLiveData<Boolean>()
|
||||
|
||||
val hideSipAddresses = MutableLiveData<Boolean>()
|
||||
|
||||
val isEndToEndEncrypted = MutableLiveData<Boolean>()
|
||||
|
||||
val subject = MutableLiveData<String>()
|
||||
|
|
@ -192,6 +194,7 @@ class ConversationInfoViewModel
|
|||
showPeerSipUri.value = false
|
||||
|
||||
coreContext.postOnCoreThread {
|
||||
hideSipAddresses.postValue(corePreferences.hideSipAddresses)
|
||||
coreContext.contactsManager.addListener(contactsListener)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -221,8 +221,8 @@ class ContactFragment : SlidingPaneChildFragment() {
|
|||
}
|
||||
|
||||
viewModel.startCallToDeviceToIncreaseTrustEvent.observe(viewLifecycleOwner) {
|
||||
it.consume { pair ->
|
||||
callDirectlyOrShowConfirmTrustCallDialog(pair.first, pair.second)
|
||||
it.consume { triple ->
|
||||
callDirectlyOrShowConfirmTrustCallDialog(triple.first, triple.second, triple.third)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -303,18 +303,18 @@ class ContactFragment : SlidingPaneChildFragment() {
|
|||
}
|
||||
|
||||
private fun showTrustProcessDialog() {
|
||||
val initials = viewModel.contact.value?.initials?.value ?: "JD"
|
||||
val initials = viewModel.contact.value?.initials?.value.orEmpty()
|
||||
val picture = viewModel.contact.value?.picturePath?.value.orEmpty()
|
||||
val model = ContactTrustDialogModel(initials, picture)
|
||||
val dialog = DialogUtils.getContactTrustProcessExplanationDialog(requireActivity(), model)
|
||||
dialog.show()
|
||||
}
|
||||
|
||||
private fun callDirectlyOrShowConfirmTrustCallDialog(contactName: String, deviceSipUri: String) {
|
||||
private fun callDirectlyOrShowConfirmTrustCallDialog(contactName: String, deviceName: String, deviceSipUri: String) {
|
||||
coreContext.postOnCoreThread {
|
||||
if (corePreferences.showDialogWhenCallingDeviceUuidDirectly) {
|
||||
coreContext.postOnMainThread {
|
||||
showConfirmTrustCallDialog(contactName, deviceSipUri)
|
||||
showConfirmTrustCallDialog(contactName, deviceName, deviceSipUri)
|
||||
}
|
||||
} else {
|
||||
val address = Factory.instance().createAddress(deviceSipUri)
|
||||
|
|
@ -325,11 +325,11 @@ class ContactFragment : SlidingPaneChildFragment() {
|
|||
}
|
||||
}
|
||||
|
||||
private fun showConfirmTrustCallDialog(contactName: String, deviceSipUri: String) {
|
||||
private fun showConfirmTrustCallDialog(contactName: String, deviceName: String, deviceSipUri: String) {
|
||||
val label = AppUtils.getFormattedString(
|
||||
R.string.contact_dialog_increase_trust_level_message,
|
||||
contactName,
|
||||
deviceSipUri
|
||||
deviceName
|
||||
)
|
||||
val model = ConfirmationDialogModel(label)
|
||||
val dialog = DialogUtils.getContactTrustCallConfirmationDialog(requireActivity(), model)
|
||||
|
|
|
|||
|
|
@ -129,8 +129,8 @@ class ContactViewModel
|
|||
MutableLiveData<Event<Boolean>>()
|
||||
}
|
||||
|
||||
val startCallToDeviceToIncreaseTrustEvent: MutableLiveData<Event<Pair<String, String>>> by lazy {
|
||||
MutableLiveData<Event<Pair<String, String>>>()
|
||||
val startCallToDeviceToIncreaseTrustEvent: MutableLiveData<Event<Triple<String, String, String>>> by lazy {
|
||||
MutableLiveData<Event<Triple<String, String, String>>>()
|
||||
}
|
||||
|
||||
val contactRemovedEvent: MutableLiveData<Event<Boolean>> by lazy {
|
||||
|
|
@ -601,7 +601,7 @@ class ContactViewModel
|
|||
) {
|
||||
if (::friend.isInitialized) {
|
||||
startCallToDeviceToIncreaseTrustEvent.value =
|
||||
Event(Pair(friend.name.orEmpty(), it.address.asStringUriOnly()))
|
||||
Event(Triple(friend.name.orEmpty(), it.name, it.address.asStringUriOnly()))
|
||||
}
|
||||
}
|
||||
)
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ class ContactsListViewModel
|
|||
init {
|
||||
fetchInProgress.value = true
|
||||
showFavourites.value = corePreferences.showFavoriteContacts
|
||||
showFilter.value = !corePreferences.hidePhoneNumbers
|
||||
showFilter.value = !corePreferences.hidePhoneNumbers && !corePreferences.hideSipAddresses
|
||||
|
||||
coreContext.postOnCoreThread { core ->
|
||||
updateDomainFilter()
|
||||
|
|
|
|||
|
|
@ -63,6 +63,8 @@ class HistoryViewModel
|
|||
|
||||
val isChatRoomAvailable = MutableLiveData<Boolean>()
|
||||
|
||||
val hideSipAddresses = MutableLiveData<Boolean>()
|
||||
|
||||
val callLogFoundEvent = MutableLiveData<Event<Boolean>>()
|
||||
|
||||
val chatRoomCreationErrorEvent: MutableLiveData<Event<Int>> by lazy {
|
||||
|
|
@ -135,6 +137,7 @@ class HistoryViewModel
|
|||
core.addListener(coreListener)
|
||||
chatDisabled.postValue(corePreferences.disableChat)
|
||||
videoCallDisabled.postValue(!core.isVideoEnabled)
|
||||
hideSipAddresses.postValue(corePreferences.hideSipAddresses)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ package org.linphone.ui.main.model
|
|||
import androidx.annotation.UiThread
|
||||
import androidx.annotation.WorkerThread
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import org.linphone.LinphoneApplication.Companion.corePreferences
|
||||
import org.linphone.core.Address
|
||||
import org.linphone.core.Friend
|
||||
import org.linphone.ui.main.contacts.model.ContactAvatarModel
|
||||
|
|
@ -48,7 +49,11 @@ class ConversationContactOrSuggestionModel
|
|||
address.username.orEmpty()
|
||||
}
|
||||
|
||||
val sipUri = address.asStringUriOnly()
|
||||
val sipUri = if (!corePreferences.hideSipAddresses) {
|
||||
address.asStringUriOnly()
|
||||
} else {
|
||||
address.username
|
||||
}
|
||||
|
||||
val initials = AppUtils.getInitials(conversationSubject ?: name)
|
||||
|
||||
|
|
|
|||
|
|
@ -86,6 +86,8 @@ class AccountProfileViewModel
|
|||
|
||||
val hideAccountSettings = MutableLiveData<Boolean>()
|
||||
|
||||
val hideSipAddresses = MutableLiveData<Boolean>()
|
||||
|
||||
val deviceId = MutableLiveData<String>()
|
||||
|
||||
val showDeviceId = MutableLiveData<Boolean>()
|
||||
|
|
@ -179,6 +181,7 @@ class AccountProfileViewModel
|
|||
|
||||
coreContext.postOnCoreThread {
|
||||
hideAccountSettings.postValue(corePreferences.hideAccountSettings)
|
||||
hideSipAddresses.postValue(corePreferences.hideSipAddresses)
|
||||
dialPlansLabelList.add("") // To allow removing selected dial plan
|
||||
|
||||
val dialPlans = Factory.instance().dialPlans.toList()
|
||||
|
|
|
|||
|
|
@ -100,6 +100,7 @@
|
|||
android:id="@+id/address"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="@{viewModel.hideSipAddresses ? View.GONE : View.VISIBLE}"
|
||||
android:text="@{viewModel.displayedAddress, default=`sip:johndoe@sip.linphone.org`}"
|
||||
android:textColor="@color/bc_white"
|
||||
android:textSize="14sp" />
|
||||
|
|
|
|||
|
|
@ -78,7 +78,8 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:text="@{viewModel.displayedAddress, default=`sip:johndoe@sip.linphone.org`}"
|
||||
android:textColor="@color/bc_white"
|
||||
android:textSize="14sp" />
|
||||
android:textSize="14sp"
|
||||
android:visibility="@{viewModel.hideSipAddresses ? View.GONE : View.VISIBLE}" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@
|
|||
android:text="@{viewModel.displayedAddress, default=`sip:johndoe@sip.linphone.org`}"
|
||||
android:textColor="@color/bc_white"
|
||||
android:textSize="14sp"
|
||||
android:visibility="@{viewModel.conferenceModel.isCurrentCallInConference ? View.GONE : View.VISIBLE}" />
|
||||
android:visibility="@{viewModel.hideSipAddresses || viewModel.conferenceModel.isCurrentCallInConference ? View.GONE : View.VISIBLE}" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
|||
|
|
@ -80,7 +80,8 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:text="@{viewModel.displayedAddress, default=`sip:johndoe@sip.linphone.org`}"
|
||||
android:textColor="@color/bc_white"
|
||||
android:textSize="14sp" />
|
||||
android:textSize="14sp"
|
||||
android:visibility="@{viewModel.hideSipAddresses ? View.GONE : View.VISIBLE}" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
|||
|
|
@ -213,6 +213,7 @@
|
|||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:text="@string/sip_address"
|
||||
android:visibility="@{!viewModel.hideSipAddresses || viewModel.showDeviceId ? View.VISIBLE : View.GONE, default=gone}"
|
||||
app:layout_constraintStart_toStartOf="@id/details_background"
|
||||
app:layout_constraintTop_toTopOf="@id/details_background"/>
|
||||
|
||||
|
|
@ -233,6 +234,7 @@
|
|||
android:drawableEnd="@drawable/copy"
|
||||
android:drawablePadding="5dp"
|
||||
app:drawableTint="?attr/color_main2_600"
|
||||
android:visibility="@{!viewModel.hideSipAddresses || viewModel.showDeviceId ? View.VISIBLE : View.GONE, default=gone}"
|
||||
app:layout_constraintStart_toEndOf="@id/sip_address_label"
|
||||
app:layout_constraintEnd_toEndOf="@id/details_background"
|
||||
app:layout_constraintTop_toTopOf="@id/sip_address_label"
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@
|
|||
android:text="@{viewModel.displayedAddress, default=`sip:johndoe@sip.linphone.org`}"
|
||||
android:textColor="@color/bc_white"
|
||||
android:textSize="14sp"
|
||||
android:visibility="@{viewModel.pipMode || viewModel.halfOpenedFolded ? View.GONE : View.VISIBLE}"
|
||||
android:visibility="@{viewModel.hideSipAddresses || viewModel.pipMode || viewModel.halfOpenedFolded ? View.GONE : View.VISIBLE}"
|
||||
app:layout_constraintTop_toBottomOf="@id/display_name"
|
||||
app:layout_constraintBottom_toBottomOf="@id/hinge_bottom"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@
|
|||
android:text="@{viewModel.displayedAddress, default=`sip:johndoe@sip.linphone.org`}"
|
||||
android:textColor="@color/bc_white"
|
||||
android:textSize="14sp"
|
||||
android:visibility="@{viewModel.hideSipAddresses ? View.GONE : View.VISIBLE}"
|
||||
app:layout_constraintTop_toBottomOf="@id/name"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@
|
|||
android:text="@{viewModel.displayedAddress, default=`sip:johndoe@sip.linphone.org`}"
|
||||
android:textColor="@color/bc_white"
|
||||
android:textSize="14sp"
|
||||
android:visibility="@{viewModel.conferenceModel.isCurrentCallInConference ? View.GONE : View.VISIBLE}"
|
||||
android:visibility="@{viewModel.hideSipAddresses || viewModel.conferenceModel.isCurrentCallInConference ? View.GONE : View.VISIBLE}"
|
||||
app:layout_constraintTop_toBottomOf="@id/name"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
|
|
|||
|
|
@ -100,6 +100,7 @@
|
|||
android:text="@{viewModel.displayedAddress, default=`sip:johndoe@sip.linphone.org`}"
|
||||
android:textColor="@color/bc_white"
|
||||
android:textSize="14sp"
|
||||
android:visibility="@{viewModel.hideSipAddresses ? View.GONE : View.VISIBLE}"
|
||||
app:layout_constraintTop_toBottomOf="@id/name"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@
|
|||
android:textSize="14sp"
|
||||
android:drawableEnd="@drawable/copy"
|
||||
android:drawablePadding="5dp"
|
||||
android:visibility="@{viewModel.isGroup ? View.GONE : View.VISIBLE, default=gone}"
|
||||
android:visibility="@{viewModel.isGroup || viewModel.hideSipAddresses ? View.GONE : View.VISIBLE, default=gone}"
|
||||
app:drawableTint="?attr/color_main2_600"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
|
@ -176,7 +176,7 @@
|
|||
android:textSize="14sp"
|
||||
android:drawableEnd="@drawable/copy"
|
||||
android:drawablePadding="5dp"
|
||||
android:visibility="@{viewModel.showPeerSipUri ? View.VISIBLE : View.GONE, default=gone}"
|
||||
android:visibility="@{viewModel.showPeerSipUri && !viewModel.hideSipAddresses ? View.VISIBLE : View.GONE, default=gone}"
|
||||
app:drawableTint="?attr/color_main2_600"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@
|
|||
android:textSize="14sp"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:visibility="@{viewModel.isConferenceCallLog ? View.GONE : View.VISIBLE}"
|
||||
android:visibility="@{viewModel.isConferenceCallLog || viewModel.hideSipAddresses ? View.GONE : View.VISIBLE}"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/name" />
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue