Use linphone API to get contact's devices & trust

This commit is contained in:
Sylvain Berfini 2024-02-29 11:58:10 +01:00
parent 2de4067b03
commit d023519cd8
35 changed files with 282 additions and 137 deletions

View file

@ -1,10 +1,10 @@
package org.linphone.contacts
import androidx.lifecycle.MutableLiveData
import org.linphone.core.ChatRoom
import org.linphone.core.SecurityLevel
abstract class AbstractAvatarModel {
val trust = MutableLiveData<ChatRoom.SecurityLevel>()
val trust = MutableLiveData<SecurityLevel>()
val showTrust = MutableLiveData<Boolean>()

View file

@ -50,6 +50,7 @@ import org.linphone.core.Factory
import org.linphone.core.Friend
import org.linphone.core.FriendList
import org.linphone.core.FriendListListenerStub
import org.linphone.core.SecurityLevel
import org.linphone.core.tools.Log
import org.linphone.ui.main.MainActivity
import org.linphone.ui.main.contacts.model.ContactAvatarModel
@ -179,7 +180,8 @@ class ContactsManager @UiThread constructor() {
"$TAG Found SIP URI [$sipUri] in knownContactsAvatarsMap, forcing presence update"
)
val oldModel = knownContactsAvatarsMap[sipUri]
oldModel?.update()
val address = Factory.instance().createAddress(sipUri)
oldModel?.update(address)
}
}
@ -337,6 +339,7 @@ class ContactsManager @UiThread constructor() {
fakeFriend.name = LinphoneUtils.getDisplayName(localAccount.params.identityAddress)
fakeFriend.photo = localAccount.params.pictureUri
val model = ContactAvatarModel(fakeFriend)
model.trust.postValue(SecurityLevel.EndToEndEncryptedAndVerified) // TODO CHECK: as it is ourselves, force encrypted level?
unknownContactsAvatarsMap[key] = model
model
} else {
@ -344,7 +347,7 @@ class ContactsManager @UiThread constructor() {
val friend = coreContext.contactsManager.findContactByAddress(clone)
if (friend != null) {
Log.d("$TAG Matching friend [${friend.name}] found for SIP URI [$key]")
val model = ContactAvatarModel(friend)
val model = ContactAvatarModel(friend, address)
knownContactsAvatarsMap[key] = model
model
} else {
@ -383,7 +386,7 @@ class ContactsManager @UiThread constructor() {
}
Log.w("$TAG Avatar model not found in map with SIP URI [$key]")
val avatar = ContactAvatarModel(friend)
val avatar = ContactAvatarModel(friend, address)
knownContactsAvatarsMap[key] = avatar
return avatar

View file

@ -41,11 +41,11 @@ import org.linphone.core.AudioDevice
import org.linphone.core.Call
import org.linphone.core.CallListenerStub
import org.linphone.core.CallStats
import org.linphone.core.ChatRoom.SecurityLevel
import org.linphone.core.Core
import org.linphone.core.CoreListenerStub
import org.linphone.core.MediaDirection
import org.linphone.core.MediaEncryption
import org.linphone.core.SecurityLevel
import org.linphone.core.StreamType
import org.linphone.core.tools.Log
import org.linphone.ui.call.model.AudioDeviceModel
@ -722,11 +722,18 @@ class CurrentCallViewModel @UiThread constructor() : ViewModel() {
Log.i(
"$TAG Current call media encryption is ZRTP, auth token is ${if (isDeviceTrusted) "trusted" else "not trusted yet"}"
)
val securityLevel = if (isDeviceTrusted) SecurityLevel.Safe else SecurityLevel.Encrypted
val securityLevel = if (isDeviceTrusted) SecurityLevel.EndToEndEncryptedAndVerified else SecurityLevel.EndToEndEncrypted
val avatarModel = contact.value
if (avatarModel != null) {
avatarModel.trust.postValue(securityLevel)
contact.postValue(avatarModel)
// Also update avatar contact model if any for the rest of the app
val address = currentCall.remoteAddress
val storedModel = coreContext.contactsManager.getContactAvatarModelForAddress(
address
)
storedModel.updateSecurityLevel(address)
} else {
Log.e("$TAG No avatar model found!")
}
@ -829,7 +836,7 @@ class CurrentCallViewModel @UiThread constructor() : ViewModel() {
// coreContext.contactsManager.getContactAvatarModelForAddress(address)
val friend = coreContext.contactsManager.findContactByAddress(address)
if (friend != null) {
ContactAvatarModel(friend)
ContactAvatarModel(friend, address)
} else {
val fakeFriend = coreContext.core.createFriend()
fakeFriend.name = LinphoneUtils.getDisplayName(address)
@ -837,6 +844,7 @@ class CurrentCallViewModel @UiThread constructor() : ViewModel() {
ContactAvatarModel(fakeFriend)
}
}
updateEncryption()
contact.postValue(model)

View file

@ -38,7 +38,9 @@ import androidx.navigation.fragment.findNavController
import androidx.navigation.fragment.navArgs
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import java.io.File
import org.linphone.LinphoneApplication.Companion.coreContext
import org.linphone.R
import org.linphone.core.Factory
import org.linphone.core.tools.Log
import org.linphone.databinding.ContactFragmentBinding
import org.linphone.ui.main.MainActivity
@ -289,8 +291,8 @@ class ContactFragment : SlidingPaneChildFragment() {
dialog.show()
}
private fun showConfirmTrustCallDialog(contact: String, device: String) {
val model = TrustCallDialogModel(contact, device)
private fun showConfirmTrustCallDialog(contactName: String, deviceSipUri: String) {
val model = TrustCallDialogModel(contactName, deviceSipUri)
val dialog = DialogUtils.getContactTrustCallConfirmationDialog(requireActivity(), model)
model.dismissEvent.observe(viewLifecycleOwner) {
@ -304,7 +306,12 @@ class ContactFragment : SlidingPaneChildFragment() {
if (model.doNotShowAnymore.value == true) {
// TODO: never display this anymore
}
// TODO: start call
coreContext.postOnCoreThread {
val address = Factory.instance().createAddress(deviceSipUri)
if (address != null) {
coreContext.startCall(address, forceZRTP = true)
}
}
dialog.dismiss()
}
}

View file

@ -26,7 +26,7 @@ import org.linphone.LinphoneApplication.Companion.coreContext
import org.linphone.R
import org.linphone.contacts.AbstractAvatarModel
import org.linphone.contacts.getNativeContactPictureUri
import org.linphone.core.ChatRoom.SecurityLevel
import org.linphone.core.Address
import org.linphone.core.ConsolidatedPresence
import org.linphone.core.Friend
import org.linphone.core.FriendListenerStub
@ -35,7 +35,7 @@ import org.linphone.ui.main.model.isInSecureMode
import org.linphone.utils.AppUtils
import org.linphone.utils.TimestampUtils
class ContactAvatarModel @WorkerThread constructor(val friend: Friend) : AbstractAvatarModel() {
class ContactAvatarModel @WorkerThread constructor(val friend: Friend, val address: Address? = null) : AbstractAvatarModel() {
companion object {
private const val TAG = "[Contact Avatar Model]"
}
@ -69,7 +69,7 @@ class ContactAvatarModel @WorkerThread constructor(val friend: Friend) : Abstrac
friend.addListener(friendListener)
}
update()
update(address)
}
@WorkerThread
@ -80,15 +80,25 @@ class ContactAvatarModel @WorkerThread constructor(val friend: Friend) : Abstrac
}
@WorkerThread
fun update() {
fun update(address: Address?) {
updateSecurityLevel(address)
isFavourite.postValue(friend.starred)
initials.postValue(AppUtils.getInitials(friend.name.orEmpty()))
trust.postValue(SecurityLevel.Encrypted) // TODO FIXME: use API
showTrust.postValue(coreContext.core.defaultAccount?.isInSecureMode())
images.postValue(arrayListOf(getAvatarUri(friend).toString()))
name.postValue(friend.name)
computePresence()
computePresence(address)
}
@WorkerThread
fun updateSecurityLevel(address: Address?) {
if (address == null) {
trust.postValue(friend.securityLevel)
} else {
trust.postValue(friend.getSecurityLevelForAddress(address))
}
}
@WorkerThread
@ -111,8 +121,12 @@ class ContactAvatarModel @WorkerThread constructor(val friend: Friend) : Abstrac
}
@WorkerThread
private fun computePresence() {
val presence = friend.consolidatedPresence
private fun computePresence(address: Address? = null) {
val presence = if (address == null) {
friend.consolidatedPresence
} else {
friend.getPresenceModelForUriOrTel(address.asStringUriOnly())?.consolidatedPresence ?: friend.consolidatedPresence
}
Log.d("$TAG Friend [${friend.name}] presence status is [$presence]")
presenceStatus.postValue(presence)

View file

@ -21,9 +21,11 @@ package org.linphone.ui.main.contacts.model
import androidx.annotation.UiThread
import androidx.annotation.WorkerThread
import org.linphone.core.Address
class ContactDeviceModel @WorkerThread constructor(
val name: String,
val address: Address,
val trusted: Boolean,
private val onCall: ((model: ContactDeviceModel) -> Unit)? = null
) {

View file

@ -33,10 +33,14 @@ import org.linphone.R
import org.linphone.contacts.ContactsManager
import org.linphone.contacts.getListOfSipAddressesAndPhoneNumbers
import org.linphone.core.Address
import org.linphone.core.Call
import org.linphone.core.ChatRoom
import org.linphone.core.ChatRoomListenerStub
import org.linphone.core.ChatRoomParams
import org.linphone.core.Core
import org.linphone.core.CoreListenerStub
import org.linphone.core.Friend
import org.linphone.core.SecurityLevel
import org.linphone.core.tools.Log
import org.linphone.ui.main.contacts.model.ContactAvatarModel
import org.linphone.ui.main.contacts.model.ContactDeviceModel
@ -63,6 +67,9 @@ class ContactViewModel @UiThread constructor() : ViewModel() {
val devices = MutableLiveData<ArrayList<ContactDeviceModel>>()
val trustedDevicesPercentage = MutableLiveData<Int>()
val trustedDevicesPercentageFloat = MutableLiveData<Float>()
val company = MutableLiveData<String>()
val title = MutableLiveData<String>()
@ -207,17 +214,35 @@ class ContactViewModel @UiThread constructor() : ViewModel() {
}
}
private val coreListener = object : CoreListenerStub() {
override fun onCallStateChanged(
core: Core,
call: Call,
state: Call.State?,
message: String
) {
if (call.state == Call.State.End) {
// Updates trust if need be
fetchDevicesAndTrust()
}
}
}
private lateinit var friend: Friend
private var refKey: String = ""
init {
expandNumbersAndAddresses.value = true
expandDevicesTrust.value = false // TODO FIXME: set it to true when it will work for real
trustedDevicesPercentage.value = 0
coreContext.postOnCoreThread { core ->
core.addListener(coreListener)
chatDisabled.postValue(corePreferences.disableChat)
videoCallDisabled.postValue(!core.isVideoEnabled)
expandDevicesTrust.postValue(
LinphoneUtils.getDefaultAccount()?.isInSecureMode() == true
)
coreContext.contactsManager.addListener(contactsListener)
}
}
@ -226,7 +251,8 @@ class ContactViewModel @UiThread constructor() : ViewModel() {
override fun onCleared() {
super.onCleared()
coreContext.postOnCoreThread {
coreContext.postOnCoreThread { core ->
core.removeListener(coreListener)
coreContext.contactsManager.removeListener(contactsListener)
contact.value?.destroy()
}
@ -267,21 +293,7 @@ class ContactViewModel @UiThread constructor() : ViewModel() {
val addressesAndNumbers = friend.getListOfSipAddressesAndPhoneNumbers(listener)
sipAddressesAndPhoneNumbers.postValue(addressesAndNumbers)
val devicesList = arrayListOf<ContactDeviceModel>()
// TODO FIXME: use real devices list from API
devicesList.add(ContactDeviceModel("Pixel 6 Pro de Sylvain", true))
devicesList.add(ContactDeviceModel("Sylvain Galaxy Tab S9 Pro+ Ultra", true))
devicesList.add(
ContactDeviceModel("MacBook Pro de Marcel", false) {
// TODO: check if do not show dialog anymore setting is set
if (::friend.isInitialized) {
startCallToDeviceToIncreaseTrustEvent.value =
Event(Pair(friend.name.orEmpty(), it.name))
}
}
)
devicesList.add(ContactDeviceModel("sylvain@fedora-linux-38", true))
devices.postValue(devicesList)
fetchDevicesAndTrust()
}
@UiThread
@ -596,4 +608,45 @@ class ContactViewModel @UiThread constructor() : ViewModel() {
}
}
}
@WorkerThread
private fun fetchDevicesAndTrust() {
val devicesList = arrayListOf<ContactDeviceModel>()
val friendDevices = friend.devices
if (friendDevices.isEmpty()) {
Log.w("$TAG No device found for friend [${friend.name}]")
} else {
val devicesCount = friendDevices.size
var trustedDevicesCount = 0
for (device in friendDevices) {
val trusted = device.securityLevel == SecurityLevel.EndToEndEncryptedAndVerified
devicesList.add(
ContactDeviceModel(
device.displayName ?: "???", // TODO: what to do if device name isn't available?
device.address,
trusted
) {
// TODO: check if do not show dialog anymore setting is set
if (::friend.isInitialized) {
startCallToDeviceToIncreaseTrustEvent.value =
Event(Pair(friend.name.orEmpty(), it.address.asStringUriOnly()))
}
}
)
if (trusted) {
trustedDevicesCount += 1
}
}
if (devicesList.isNotEmpty()) {
trustedDevicesPercentage.postValue(trustedDevicesCount * 100 / devicesCount.toInt())
trustedDevicesPercentageFloat.postValue(
trustedDevicesCount / devicesCount.toFloat() / 2
)
}
}
devices.postValue(devicesList)
}
}

View file

@ -33,6 +33,7 @@ import org.linphone.core.ChatRoom
import org.linphone.core.Core
import org.linphone.core.CoreListenerStub
import org.linphone.core.RegistrationState
import org.linphone.core.SecurityLevel
import org.linphone.core.tools.Log
import org.linphone.utils.AppUtils
import org.linphone.utils.LinphoneUtils
@ -93,7 +94,7 @@ class AccountModel @WorkerThread constructor(
account.addListener(accountListener)
coreContext.core.addListener(coreListener)
trust.postValue(ChatRoom.SecurityLevel.Safe)
trust.postValue(SecurityLevel.EndToEndEncryptedAndVerified)
showTrust.postValue(account.isInSecureMode())
update()

View file

@ -39,6 +39,7 @@ import androidx.annotation.UiThread
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.AppCompatEditText
import androidx.appcompat.widget.AppCompatTextView
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.doOnLayout
@ -59,8 +60,8 @@ import org.linphone.BR
import org.linphone.R
import org.linphone.contacts.AbstractAvatarModel
import org.linphone.contacts.AvatarGenerator
import org.linphone.core.ChatRoom
import org.linphone.core.ConsolidatedPresence
import org.linphone.core.SecurityLevel
import org.linphone.core.tools.Log
import org.linphone.ui.call.model.ConferenceParticipantDeviceModel
@ -382,12 +383,12 @@ private fun loadContactPictureWithCoil(
if (!skipTrust) {
if (model.showTrust.value == true) {
when (model.trust.value) {
ChatRoom.SecurityLevel.Safe -> {
SecurityLevel.EndToEndEncryptedAndVerified -> {
imageView.setStrokeColorResource(R.color.info_500)
imageView.setStrokeWidthResource(R.dimen.avatar_trust_border_width)
}
ChatRoom.SecurityLevel.Unsafe -> {
SecurityLevel.Unsafe -> {
imageView.setStrokeColorResource(R.color.danger_500)
imageView.setStrokeWidthResource(R.dimen.avatar_trust_border_width)
}
@ -499,6 +500,13 @@ fun setConstraintLayoutStartMargin(view: View, margins: Float) {
view.layoutParams = params
}
@BindingAdapter("layout_constraintHorizontal_bias")
fun setConstraintLayoutChildHorizontalBias(view: View, horizontalBias: Float) {
val params = view.layoutParams as ConstraintLayout.LayoutParams
params.horizontalBias = horizontalBias
view.layoutParams = params
}
@BindingAdapter("focusNextOnInput")
fun focusNextOnInput(editText: EditText, enabled: Boolean) {
if (!enabled) return

View file

@ -5,7 +5,7 @@
<data>
<import type="android.view.View" />
<import type="org.linphone.core.ChatRoom.SecurityLevel" />
<import type="org.linphone.core.SecurityLevel" />
<variable
name="backClickListener"
type="View.OnClickListener" />
@ -110,7 +110,7 @@
android:layout_width="@dimen/avatar_presence_badge_big_size"
android:layout_height="@dimen/avatar_presence_badge_big_size"
android:layout_marginStart="@dimen/avatar_presence_badge_big_end_margin"
android:src="@{viewModel.accountModel.trust == SecurityLevel.Safe ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
android:src="@{viewModel.accountModel.trust == SecurityLevel.EndToEndEncryptedAndVerified ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
android:visibility="@{viewModel.accountModel.showTrust ? View.VISIBLE : View.GONE}"
app:layout_constraintStart_toStartOf="@id/avatar"
app:layout_constraintBottom_toBottomOf="@id/avatar"/>

View file

@ -6,7 +6,7 @@
<data>
<import type="android.view.View" />
<import type="org.linphone.core.ConsolidatedPresence" />
<import type="org.linphone.core.ChatRoom.SecurityLevel" />
<import type="org.linphone.core.SecurityLevel" />
<variable
name="model"
type="org.linphone.ui.main.model.SelectedAddressModel" />
@ -45,9 +45,9 @@
android:id="@+id/trust_badge"
android:layout_width="@dimen/avatar_presence_badge_size"
android:layout_height="@dimen/avatar_presence_badge_size"
android:src="@{model.avatarModel.trust == SecurityLevel.Safe ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
android:visibility="@{model.avatarModel.trust == SecurityLevel.Safe || model.avatarModel.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
android:contentDescription="@{model.avatarModel.trust == SecurityLevel.Safe ? @string/content_description_trusted_contact_icon : @string/content_description_not_trusted_contact_icon}"
android:src="@{model.avatarModel.trust == SecurityLevel.EndToEndEncryptedAndVerified ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
android:visibility="@{model.avatarModel.trust == SecurityLevel.EndToEndEncryptedAndVerified || model.avatarModel.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
android:contentDescription="@{model.avatarModel.trust == SecurityLevel.EndToEndEncryptedAndVerified ? @string/content_description_trusted_contact_icon : @string/content_description_not_trusted_contact_icon}"
app:layout_constraintStart_toStartOf="@id/avatar"
app:layout_constraintBottom_toBottomOf="@id/avatar"/>

View file

@ -5,7 +5,7 @@
<data>
<import type="android.view.View" />
<import type="org.linphone.core.ChatRoom.SecurityLevel" />
<import type="org.linphone.core.SecurityLevel" />
<import type="org.linphone.ui.call.model.ConferenceModel" />
<variable
name="backClickListener"

View file

@ -5,7 +5,7 @@
<data>
<import type="android.view.View" />
<import type="org.linphone.core.ChatRoom.SecurityLevel" />
<import type="org.linphone.core.SecurityLevel" />
<variable
name="backClickListener"
type="View.OnClickListener" />
@ -75,9 +75,9 @@
android:id="@+id/trust_badge"
android:layout_width="@dimen/avatar_presence_badge_in_call_size"
android:layout_height="@dimen/avatar_presence_badge_in_call_size"
android:src="@{viewModel.contact.trust == SecurityLevel.Safe ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
android:visibility="@{viewModel.contact.trust == SecurityLevel.Safe || viewModel.contact.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
android:contentDescription="@{viewModel.contact.trust == SecurityLevel.Safe ? @string/content_description_trusted_contact_icon : @string/content_description_not_trusted_contact_icon}"
android:src="@{viewModel.contact.trust == SecurityLevel.EndToEndEncryptedAndVerified ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
android:visibility="@{viewModel.contact.trust == SecurityLevel.EndToEndEncryptedAndVerified || viewModel.contact.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
android:contentDescription="@{viewModel.contact.trust == SecurityLevel.EndToEndEncryptedAndVerified ? @string/content_description_trusted_contact_icon : @string/content_description_not_trusted_contact_icon}"
app:layout_constraintStart_toStartOf="@id/avatar"
app:layout_constraintBottom_toBottomOf="@id/avatar"/>

View file

@ -4,7 +4,7 @@
<data>
<import type="android.view.View" />
<import type="org.linphone.core.ChatRoom.SecurityLevel" />
<import type="org.linphone.core.SecurityLevel" />
<variable
name="model"
type="org.linphone.ui.call.model.ConferenceParticipantDeviceModel" />
@ -43,9 +43,9 @@
android:id="@+id/trust_badge"
android:layout_width="@dimen/avatar_presence_badge_in_active_speaker_miniature_conference_call_size"
android:layout_height="@dimen/avatar_presence_badge_in_active_speaker_miniature_conference_call_size"
android:src="@{model.avatarModel.trust == SecurityLevel.Safe ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
android:visibility="@{model.avatarModel.trust == SecurityLevel.Safe || model.avatarModel.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
android:contentDescription="@{model.avatarModel.trust == SecurityLevel.Safe ? @string/content_description_trusted_contact_icon : @string/content_description_not_trusted_contact_icon}"
android:src="@{model.avatarModel.trust == SecurityLevel.EndToEndEncryptedAndVerified ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
android:visibility="@{model.avatarModel.trust == SecurityLevel.EndToEndEncryptedAndVerified || model.avatarModel.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
android:contentDescription="@{model.avatarModel.trust == SecurityLevel.EndToEndEncryptedAndVerified ? @string/content_description_trusted_contact_icon : @string/content_description_not_trusted_contact_icon}"
app:layout_constraintStart_toStartOf="@id/avatar"
app:layout_constraintBottom_toBottomOf="@id/avatar"/>

View file

@ -4,7 +4,7 @@
<data>
<import type="android.view.View" />
<import type="org.linphone.core.ChatRoom.SecurityLevel" />
<import type="org.linphone.core.SecurityLevel" />
<import type="org.linphone.ui.call.model.ConferenceModel" />
<variable
name="viewModel"

View file

@ -4,7 +4,7 @@
<data>
<import type="android.view.View" />
<import type="org.linphone.core.ChatRoom.SecurityLevel" />
<import type="org.linphone.core.SecurityLevel" />
<variable
name="model"
type="org.linphone.ui.call.model.ConferenceParticipantDeviceModel" />
@ -44,9 +44,9 @@
android:id="@+id/trust_badge"
android:layout_width="@dimen/avatar_presence_badge_size"
android:layout_height="@dimen/avatar_presence_badge_size"
android:src="@{model.avatarModel.trust == SecurityLevel.Safe ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
android:visibility="@{model.avatarModel.trust == SecurityLevel.Safe || model.avatarModel.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
android:contentDescription="@{model.avatarModel.trust == SecurityLevel.Safe ? @string/content_description_trusted_contact_icon : @string/content_description_not_trusted_contact_icon}"
android:src="@{model.avatarModel.trust == SecurityLevel.EndToEndEncryptedAndVerified ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
android:visibility="@{model.avatarModel.trust == SecurityLevel.EndToEndEncryptedAndVerified || model.avatarModel.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
android:contentDescription="@{model.avatarModel.trust == SecurityLevel.EndToEndEncryptedAndVerified ? @string/content_description_trusted_contact_icon : @string/content_description_not_trusted_contact_icon}"
app:layout_constraintStart_toStartOf="@id/avatar"
app:layout_constraintBottom_toBottomOf="@id/avatar"/>

View file

@ -4,7 +4,7 @@
<data>
<import type="android.view.View" />
<import type="org.linphone.core.ChatRoom.SecurityLevel" />
<import type="org.linphone.core.SecurityLevel" />
<variable
name="model"
type="org.linphone.ui.call.model.ConferenceParticipantDeviceModel" />
@ -43,9 +43,9 @@
android:id="@+id/trust_badge"
android:layout_width="@dimen/avatar_presence_badge_in_call_size"
android:layout_height="@dimen/avatar_presence_badge_in_call_size"
android:src="@{model.avatarModel.trust == SecurityLevel.Safe ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
android:visibility="@{model.avatarModel.trust == SecurityLevel.Safe || model.avatarModel.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
android:contentDescription="@{model.avatarModel.trust == SecurityLevel.Safe ? @string/content_description_trusted_contact_icon : @string/content_description_not_trusted_contact_icon}"
android:src="@{model.avatarModel.trust == SecurityLevel.EndToEndEncryptedAndVerified ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
android:visibility="@{model.avatarModel.trust == SecurityLevel.EndToEndEncryptedAndVerified || model.avatarModel.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
android:contentDescription="@{model.avatarModel.trust == SecurityLevel.EndToEndEncryptedAndVerified ? @string/content_description_trusted_contact_icon : @string/content_description_not_trusted_contact_icon}"
app:layout_constraintStart_toStartOf="@id/avatar"
app:layout_constraintBottom_toBottomOf="@id/avatar"/>

View file

@ -5,7 +5,7 @@
<data>
<import type="android.view.View" />
<import type="org.linphone.core.ChatRoom.SecurityLevel" />
<import type="org.linphone.core.SecurityLevel" />
<variable
name="onClickListener"
type="View.OnClickListener" />
@ -43,9 +43,9 @@
android:id="@+id/trust_badge"
android:layout_width="@dimen/avatar_presence_badge_size"
android:layout_height="@dimen/avatar_presence_badge_size"
android:src="@{model.avatarModel.trust == SecurityLevel.Safe ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
android:visibility="@{model.avatarModel.trust == SecurityLevel.Safe || model.avatarModel.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
android:contentDescription="@{model.avatarModel.trust == SecurityLevel.Safe ? @string/content_description_trusted_contact_icon : @string/content_description_not_trusted_contact_icon}"
android:src="@{model.avatarModel.trust == SecurityLevel.EndToEndEncryptedAndVerified ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
android:visibility="@{model.avatarModel.trust == SecurityLevel.EndToEndEncryptedAndVerified || model.avatarModel.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
android:contentDescription="@{model.avatarModel.trust == SecurityLevel.EndToEndEncryptedAndVerified ? @string/content_description_trusted_contact_icon : @string/content_description_not_trusted_contact_icon}"
app:layout_constraintStart_toStartOf="@id/avatar"
app:layout_constraintBottom_toBottomOf="@id/avatar"/>

View file

@ -5,7 +5,7 @@
<data>
<import type="android.view.View" />
<import type="org.linphone.core.ChatRoom.SecurityLevel" />
<import type="org.linphone.core.SecurityLevel" />
<variable
name="viewModel"
type="org.linphone.ui.call.viewmodel.CurrentCallViewModel" />
@ -109,9 +109,9 @@
android:id="@+id/trust_badge"
android:layout_width="@dimen/avatar_presence_badge_in_call_size"
android:layout_height="@dimen/avatar_presence_badge_in_call_size"
android:src="@{viewModel.contact.trust == SecurityLevel.Safe ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
android:visibility="@{viewModel.contact.trust == SecurityLevel.Safe || viewModel.contact.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
android:contentDescription="@{viewModel.contact.trust == SecurityLevel.Safe ? @string/content_description_trusted_contact_icon : @string/content_description_not_trusted_contact_icon}"
android:src="@{viewModel.contact.trust == SecurityLevel.EndToEndEncryptedAndVerified ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
android:visibility="@{viewModel.contact.trust == SecurityLevel.EndToEndEncryptedAndVerified || viewModel.contact.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
android:contentDescription="@{viewModel.contact.trust == SecurityLevel.EndToEndEncryptedAndVerified ? @string/content_description_trusted_contact_icon : @string/content_description_not_trusted_contact_icon}"
app:layout_constraintStart_toStartOf="@id/avatar"
app:layout_constraintBottom_toBottomOf="@id/avatar"/>

View file

@ -5,7 +5,7 @@
<data>
<import type="android.view.View" />
<import type="org.linphone.core.ChatRoom.SecurityLevel" />
<import type="org.linphone.core.SecurityLevel" />
<variable
name="viewModel"
type="org.linphone.ui.call.viewmodel.CurrentCallViewModel" />
@ -55,9 +55,9 @@
android:id="@+id/trust_badge"
android:layout_width="@dimen/avatar_presence_badge_in_call_size"
android:layout_height="@dimen/avatar_presence_badge_in_call_size"
android:src="@{viewModel.contact.trust == SecurityLevel.Safe ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
android:visibility="@{viewModel.contact.trust == SecurityLevel.Safe || viewModel.contact.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
android:contentDescription="@{viewModel.contact.trust == SecurityLevel.Safe ? @string/content_description_trusted_contact_icon : @string/content_description_not_trusted_contact_icon}"
android:src="@{viewModel.contact.trust == SecurityLevel.EndToEndEncryptedAndVerified ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
android:visibility="@{viewModel.contact.trust == SecurityLevel.EndToEndEncryptedAndVerified || viewModel.contact.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
android:contentDescription="@{viewModel.contact.trust == SecurityLevel.EndToEndEncryptedAndVerified ? @string/content_description_trusted_contact_icon : @string/content_description_not_trusted_contact_icon}"
app:layout_constraintStart_toStartOf="@id/avatar"
app:layout_constraintBottom_toBottomOf="@id/avatar"/>

View file

@ -5,7 +5,7 @@
<data>
<import type="android.view.View" />
<import type="org.linphone.core.ChatRoom.SecurityLevel" />
<import type="org.linphone.core.SecurityLevel" />
<variable
name="viewModel"
type="org.linphone.ui.call.viewmodel.CurrentCallViewModel" />
@ -55,9 +55,9 @@
android:id="@+id/trust_badge"
android:layout_width="@dimen/avatar_presence_badge_in_call_size"
android:layout_height="@dimen/avatar_presence_badge_in_call_size"
android:src="@{viewModel.contact.trust == SecurityLevel.Safe ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
android:visibility="@{viewModel.contact.trust == SecurityLevel.Safe || viewModel.contact.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
android:contentDescription="@{viewModel.contact.trust == SecurityLevel.Safe ? @string/content_description_trusted_contact_icon : @string/content_description_not_trusted_contact_icon}"
android:src="@{viewModel.contact.trust == SecurityLevel.EndToEndEncryptedAndVerified ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
android:visibility="@{viewModel.contact.trust == SecurityLevel.EndToEndEncryptedAndVerified || viewModel.contact.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
android:contentDescription="@{viewModel.contact.trust == SecurityLevel.EndToEndEncryptedAndVerified ? @string/content_description_trusted_contact_icon : @string/content_description_not_trusted_contact_icon}"
app:layout_constraintStart_toStartOf="@id/avatar"
app:layout_constraintBottom_toBottomOf="@id/avatar"/>

View file

@ -6,6 +6,7 @@
<data>
<import type="android.view.View" />
<import type="com.google.android.flexbox.JustifyContent" />
<import type="org.linphone.core.SecurityLevel" />
<import type="org.linphone.core.ConsolidatedPresence" />
<import type="org.linphone.core.ChatMessage.State" />
<variable
@ -44,6 +45,16 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/name" />
<ImageView
android:id="@+id/trust_badge"
android:layout_width="@dimen/avatar_bubble_presence_badge_size"
android:layout_height="@dimen/avatar_bubble_presence_badge_size"
android:src="@{model.avatarModel.trust == SecurityLevel.EndToEndEncryptedAndVerified ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
android:visibility="@{model.isFromGroup &amp;&amp; (model.avatarModel.trust == SecurityLevel.EndToEndEncryptedAndVerified || model.avatarModel.trust == SecurityLevel.Unsafe) ? View.VISIBLE : View.GONE}"
android:contentDescription="@{model.avatarModel.trust == SecurityLevel.EndToEndEncryptedAndVerified ? @string/content_description_trusted_contact_icon : @string/content_description_not_trusted_contact_icon}"
app:layout_constraintStart_toStartOf="@id/avatar"
app:layout_constraintBottom_toBottomOf="@id/avatar"/>
<ImageView
android:id="@+id/presence_badge"
android:layout_width="@dimen/avatar_bubble_presence_badge_size"

View file

@ -6,7 +6,7 @@
<data>
<import type="android.view.View" />
<import type="org.linphone.core.ConsolidatedPresence" />
<import type="org.linphone.core.ChatRoom.SecurityLevel" />
<import type="org.linphone.core.SecurityLevel" />
<variable
name="backClickListener"
type="View.OnClickListener" />
@ -107,9 +107,9 @@
android:id="@+id/trust_badge"
android:layout_width="@dimen/avatar_presence_badge_size"
android:layout_height="@dimen/avatar_presence_badge_size"
android:src="@{viewModel.avatarModel.trust == SecurityLevel.Safe ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
android:visibility="@{!viewModel.searchBarVisible &amp;&amp; (viewModel.avatarModel.trust == SecurityLevel.Safe || viewModel.avatarModel.trust == SecurityLevel.Unsafe) ? View.VISIBLE : View.GONE}"
android:contentDescription="@{viewModel.avatarModel.trust == SecurityLevel.Safe ? @string/content_description_trusted_contact_icon : @string/content_description_not_trusted_contact_icon}"
android:src="@{viewModel.avatarModel.trust == SecurityLevel.EndToEndEncryptedAndVerified ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
android:visibility="@{!viewModel.searchBarVisible &amp;&amp; (viewModel.avatarModel.trust == SecurityLevel.EndToEndEncryptedAndVerified || viewModel.avatarModel.trust == SecurityLevel.Unsafe) ? View.VISIBLE : View.GONE}"
android:contentDescription="@{viewModel.avatarModel.trust == SecurityLevel.EndToEndEncryptedAndVerified ? @string/content_description_trusted_contact_icon : @string/content_description_not_trusted_contact_icon}"
app:layout_constraintStart_toStartOf="@id/avatar"
app:layout_constraintBottom_toBottomOf="@id/avatar"/>

View file

@ -5,7 +5,7 @@
<data>
<import type="android.view.View" />
<import type="org.linphone.core.ConsolidatedPresence" />
<import type="org.linphone.core.ChatRoom.SecurityLevel" />
<import type="org.linphone.core.SecurityLevel" />
<variable
name="backClickListener"
type="View.OnClickListener" />
@ -101,6 +101,17 @@
app:layout_constraintEnd_toEndOf="@id/avatar"
app:presenceIcon="@{viewModel.avatarModel.presenceStatus}" />
<ImageView
android:id="@+id/trust_badge"
android:layout_width="@dimen/avatar_presence_badge_big_size"
android:layout_height="@dimen/avatar_presence_badge_big_size"
android:layout_marginStart="@dimen/avatar_presence_badge_big_end_margin"
android:src="@{viewModel.avatarModel.trust == SecurityLevel.EndToEndEncryptedAndVerified ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
android:visibility="@{viewModel.avatarModel.trust == SecurityLevel.EndToEndEncryptedAndVerified || viewModel.avatarModel.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
android:contentDescription="@{viewModel.avatarModel.trust == SecurityLevel.EndToEndEncryptedAndVerified ? @string/content_description_trusted_contact_icon : @string/content_description_not_trusted_contact_icon}"
app:layout_constraintStart_toStartOf="@id/avatar"
app:layout_constraintBottom_toBottomOf="@id/avatar"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/title"
style="@style/default_text_style"

View file

@ -7,7 +7,7 @@
<import type="android.view.View" />
<import type="android.graphics.Typeface" />
<import type="org.linphone.core.ConsolidatedPresence" />
<import type="org.linphone.core.ChatRoom.SecurityLevel" />
<import type="org.linphone.core.SecurityLevel" />
<variable
name="model"
type="org.linphone.ui.main.chat.model.ConversationModel" />
@ -57,9 +57,9 @@
android:id="@+id/trust_badge"
android:layout_width="@dimen/avatar_presence_badge_size"
android:layout_height="@dimen/avatar_presence_badge_size"
android:src="@{model.avatarModel.trust == SecurityLevel.Safe ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
android:visibility="@{model.avatarModel.trust == SecurityLevel.Safe || model.avatarModel.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
android:contentDescription="@{model.avatarModel.trust == SecurityLevel.Safe ? @string/content_description_trusted_contact_icon : @string/content_description_not_trusted_contact_icon}"
android:src="@{model.avatarModel.trust == SecurityLevel.EndToEndEncryptedAndVerified ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
android:visibility="@{model.avatarModel.trust == SecurityLevel.EndToEndEncryptedAndVerified || model.avatarModel.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
android:contentDescription="@{model.avatarModel.trust == SecurityLevel.EndToEndEncryptedAndVerified ? @string/content_description_trusted_contact_icon : @string/content_description_not_trusted_contact_icon}"
app:layout_constraintStart_toStartOf="@id/avatar"
app:layout_constraintBottom_toBottomOf="@id/avatar"/>

View file

@ -6,7 +6,7 @@
<data>
<import type="android.view.View" />
<import type="org.linphone.core.ConsolidatedPresence" />
<import type="org.linphone.core.ChatRoom.SecurityLevel" />
<import type="org.linphone.core.SecurityLevel" />
<variable
name="model"
type="org.linphone.ui.main.chat.model.MessageBottomSheetParticipantModel" />
@ -48,9 +48,9 @@
android:id="@+id/trust_badge"
android:layout_width="@dimen/avatar_presence_badge_size"
android:layout_height="@dimen/avatar_presence_badge_size"
android:src="@{model.avatarModel.trust == SecurityLevel.Safe ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
android:visibility="@{model.avatarModel.trust == SecurityLevel.Safe || model.avatarModel.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
android:contentDescription="@{model.avatarModel.trust == SecurityLevel.Safe ? @string/content_description_trusted_contact_icon : @string/content_description_not_trusted_contact_icon}"
android:src="@{model.avatarModel.trust == SecurityLevel.EndToEndEncryptedAndVerified ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
android:visibility="@{model.avatarModel.trust == SecurityLevel.EndToEndEncryptedAndVerified || model.avatarModel.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
android:contentDescription="@{model.avatarModel.trust == SecurityLevel.EndToEndEncryptedAndVerified ? @string/content_description_trusted_contact_icon : @string/content_description_not_trusted_contact_icon}"
app:layout_constraintStart_toStartOf="@id/avatar"
app:layout_constraintBottom_toBottomOf="@id/avatar"/>

View file

@ -6,7 +6,7 @@
<data>
<import type="android.view.View" />
<import type="org.linphone.core.ConsolidatedPresence" />
<import type="org.linphone.core.ChatRoom.SecurityLevel" />
<import type="org.linphone.core.SecurityLevel" />
<variable
name="model"
type="org.linphone.ui.main.chat.model.ParticipantModel" />
@ -48,9 +48,9 @@
android:id="@+id/trust_badge"
android:layout_width="@dimen/avatar_presence_badge_size"
android:layout_height="@dimen/avatar_presence_badge_size"
android:src="@{model.avatarModel.trust == SecurityLevel.Safe ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
android:visibility="@{model.avatarModel.trust == SecurityLevel.Safe || model.avatarModel.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
android:contentDescription="@{model.avatarModel.trust == SecurityLevel.Safe ? @string/content_description_trusted_contact_icon : @string/content_description_not_trusted_contact_icon}"
android:src="@{model.avatarModel.trust == SecurityLevel.EndToEndEncryptedAndVerified ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
android:visibility="@{model.avatarModel.trust == SecurityLevel.EndToEndEncryptedAndVerified || model.avatarModel.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
android:contentDescription="@{model.avatarModel.trust == SecurityLevel.EndToEndEncryptedAndVerified ? @string/content_description_trusted_contact_icon : @string/content_description_not_trusted_contact_icon}"
app:layout_constraintStart_toStartOf="@id/avatar"
app:layout_constraintBottom_toBottomOf="@id/avatar"/>

View file

@ -6,7 +6,7 @@
<data>
<import type="android.view.View" />
<import type="org.linphone.core.ConsolidatedPresence" />
<import type="org.linphone.core.ChatRoom.SecurityLevel" />
<import type="org.linphone.core.SecurityLevel" />
<variable
name="model"
type="org.linphone.ui.main.contacts.model.ContactAvatarModel" />
@ -53,9 +53,9 @@
android:id="@+id/trust_badge"
android:layout_width="@dimen/avatar_presence_badge_size"
android:layout_height="@dimen/avatar_presence_badge_size"
android:src="@{model.trust == SecurityLevel.Safe ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
android:visibility="@{model.trust == SecurityLevel.Safe || model.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
android:contentDescription="@{model.trust == SecurityLevel.Safe ? @string/content_description_trusted_contact_icon : @string/content_description_not_trusted_contact_icon}"
android:src="@{model.trust == SecurityLevel.EndToEndEncryptedAndVerified ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
android:visibility="@{model.trust == SecurityLevel.EndToEndEncryptedAndVerified || model.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
android:contentDescription="@{model.trust == SecurityLevel.EndToEndEncryptedAndVerified ? @string/content_description_trusted_contact_icon : @string/content_description_not_trusted_contact_icon}"
app:layout_constraintStart_toStartOf="@id/avatar"
app:layout_constraintBottom_toBottomOf="@id/avatar"/>

View file

@ -6,7 +6,7 @@
<data>
<import type="android.view.View" />
<import type="org.linphone.core.ConsolidatedPresence" />
<import type="org.linphone.core.ChatRoom.SecurityLevel" />
<import type="org.linphone.core.SecurityLevel" />
<variable
name="backClickListener"
type="View.OnClickListener" />
@ -100,8 +100,8 @@
<androidx.constraintlayout.widget.Group
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:constraint_referenced_ids="trusted_devices_count, trust_background, trusted_devices_progress, devices, trusted_devices_progress_label"
android:visibility="@{viewModel.expandDevicesTrust ? View.VISIBLE : View.GONE, default=gone}" />
app:constraint_referenced_ids="trusted_devices_count, trusted_devices_progress, devices, trusted_devices_progress_label"
android:visibility="@{viewModel.expandDevicesTrust &amp;&amp; viewModel.devices.size() > 0 ? View.VISIBLE : View.GONE}" />
<com.google.android.material.imageview.ShapeableImageView
style="@style/avatar_imageview"
@ -128,11 +128,12 @@
<ImageView
android:id="@+id/trust_badge"
android:layout_width="@dimen/avatar_presence_badge_in_call_size"
android:layout_height="@dimen/avatar_presence_badge_in_call_size"
android:src="@{viewModel.contact.trust == SecurityLevel.Safe ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
android:visibility="@{viewModel.contact.trust == SecurityLevel.Safe || viewModel.contact.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
android:contentDescription="@{viewModel.contact.trust == SecurityLevel.Safe ? @string/content_description_trusted_contact_icon : @string/content_description_not_trusted_contact_icon}"
android:layout_width="@dimen/avatar_presence_badge_big_size"
android:layout_height="@dimen/avatar_presence_badge_big_size"
android:layout_marginStart="@dimen/avatar_presence_badge_big_end_margin"
android:src="@{viewModel.contact.trust == SecurityLevel.EndToEndEncryptedAndVerified ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
android:visibility="@{viewModel.contact.trust == SecurityLevel.EndToEndEncryptedAndVerified || viewModel.contact.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
android:contentDescription="@{viewModel.contact.trust == SecurityLevel.EndToEndEncryptedAndVerified ? @string/content_description_trusted_contact_icon : @string/content_description_not_trusted_contact_icon}"
app:layout_constraintStart_toStartOf="@id/avatar"
app:layout_constraintBottom_toBottomOf="@id/avatar"/>
@ -364,7 +365,6 @@
android:drawableEnd="@drawable/question"
android:drawableTint="?attr/color_main2_600"
android:drawablePadding="8dp"
android:visibility="gone"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/info_background"/>
@ -379,11 +379,17 @@
android:padding="5dp"
android:drawableEnd="@{viewModel.expandDevicesTrust ? @drawable/caret_up : @drawable/caret_down, default=@drawable/caret_up}"
android:drawableTint="?attr/color_main2_600"
android:visibility="gone"
app:layout_constraintStart_toEndOf="@id/trust_label"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/info_background"/>
<androidx.constraintlayout.widget.Barrier
android:id="@+id/trust_background_bottom_barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="bottom"
app:constraint_referenced_ids="devices, no_device_label" />
<ImageView
android:id="@+id/trust_background"
android:layout_width="0dp"
@ -392,10 +398,11 @@
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:src="@drawable/shape_squircle_white_background"
android:visibility="@{viewModel.expandDevicesTrust ? View.VISIBLE : View.GONE}"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/trust_label"
app:layout_constraintBottom_toBottomOf="@id/devices"/>
app:layout_constraintBottom_toBottomOf="@id/trust_background_bottom_barrier"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/header_style"
@ -417,12 +424,12 @@
android:layout_marginTop="10dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:max="100"
android:progress="@{viewModel.trustedDevicesPercentage, default=75}"
app:trackCornerRadius="50dp"
app:trackThickness="22dp"
app:trackColor="?attr/color_main2_100"
app:indicatorColor="?attr/color_info_500"
android:max="100"
android:progress="75"
app:layout_constraintStart_toStartOf="@id/trust_background"
app:layout_constraintEnd_toEndOf="@id/trust_background"
app:layout_constraintTop_toBottomOf="@id/trusted_devices_count"/>
@ -430,12 +437,14 @@
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style_700"
android:id="@+id/trusted_devices_progress_label"
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:text="75%"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:text="@{String.valueOf(viewModel.trustedDevicesPercentage) + `%`, default=`75%`}"
android:textColor="?attr/color_main2_000"
android:textSize="12sp"
android:gravity="center"
app:layout_constraintHorizontal_bias="@{viewModel.trustedDevicesPercentageFloat, default=0.37}"
app:layout_constraintStart_toStartOf="@id/trusted_devices_progress"
app:layout_constraintEnd_toEndOf="@id/trusted_devices_progress"
app:layout_constraintTop_toTopOf="@id/trusted_devices_progress"
@ -455,6 +464,21 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/trusted_devices_progress" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style_700"
android:id="@+id/no_device_label"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:padding="10dp"
android:text="@string/contact_details_no_device_found"
android:visibility="@{viewModel.expandDevicesTrust &amp;&amp; viewModel.devices.empty ? View.VISIBLE : View.GONE, default=gone}"
app:layout_constraintStart_toStartOf="@id/trust_background"
app:layout_constraintEnd_toEndOf="@id/trust_background"
app:layout_constraintTop_toTopOf="@id/trust_background"
app:layout_constraintBottom_toBottomOf="@id/trust_background" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/section_header_style"
android:id="@+id/actions"

View file

@ -7,7 +7,7 @@
<import type="android.view.View" />
<import type="android.graphics.Typeface" />
<import type="org.linphone.core.ConsolidatedPresence" />
<import type="org.linphone.core.ChatRoom.SecurityLevel" />
<import type="org.linphone.core.SecurityLevel" />
<variable
name="model"
type="org.linphone.ui.main.contacts.model.ContactAvatarModel" />
@ -85,9 +85,9 @@
android:id="@+id/trust_badge"
android:layout_width="@dimen/avatar_presence_badge_size"
android:layout_height="@dimen/avatar_presence_badge_size"
android:src="@{model.trust == SecurityLevel.Safe ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
android:visibility="@{model.trust == SecurityLevel.Safe || model.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
android:contentDescription="@{model.trust == SecurityLevel.Safe ? @string/content_description_trusted_contact_icon : @string/content_description_not_trusted_contact_icon}"
android:src="@{model.trust == SecurityLevel.EndToEndEncryptedAndVerified ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
android:visibility="@{model.trust == SecurityLevel.EndToEndEncryptedAndVerified || model.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
android:contentDescription="@{model.trust == SecurityLevel.EndToEndEncryptedAndVerified ? @string/content_description_trusted_contact_icon : @string/content_description_not_trusted_contact_icon}"
app:layout_constraintStart_toStartOf="@id/avatar"
app:layout_constraintBottom_toBottomOf="@id/avatar"/>

View file

@ -6,7 +6,7 @@
<data>
<import type="android.view.View" />
<import type="org.linphone.core.ConsolidatedPresence" />
<import type="org.linphone.core.ChatRoom.SecurityLevel" />
<import type="org.linphone.core.SecurityLevel" />
<variable
name="backClickListener"
type="View.OnClickListener" />
@ -114,11 +114,12 @@
<ImageView
android:id="@+id/trust_badge"
android:layout_width="@dimen/avatar_presence_badge_in_call_size"
android:layout_height="@dimen/avatar_presence_badge_in_call_size"
android:src="@{viewModel.callLogModel.avatarModel.trust == SecurityLevel.Safe ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
android:visibility="@{viewModel.callLogModel.avatarModel.trust == SecurityLevel.Safe || viewModel.callLogModel.avatarModel.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
android:contentDescription="@{viewModel.callLogModel.avatarModel.trust == SecurityLevel.Safe ? @string/content_description_trusted_contact_icon : @string/content_description_not_trusted_contact_icon}"
android:layout_width="@dimen/avatar_presence_badge_big_size"
android:layout_height="@dimen/avatar_presence_badge_big_size"
android:layout_marginStart="@dimen/avatar_presence_badge_big_end_margin"
android:src="@{viewModel.callLogModel.avatarModel.trust == SecurityLevel.EndToEndEncryptedAndVerified ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
android:visibility="@{viewModel.callLogModel.avatarModel.trust == SecurityLevel.EndToEndEncryptedAndVerified || viewModel.callLogModel.avatarModel.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
android:contentDescription="@{viewModel.callLogModel.avatarModel.trust == SecurityLevel.EndToEndEncryptedAndVerified ? @string/content_description_trusted_contact_icon : @string/content_description_not_trusted_contact_icon}"
app:layout_constraintStart_toStartOf="@id/avatar"
app:layout_constraintBottom_toBottomOf="@id/avatar"/>

View file

@ -7,7 +7,7 @@
<import type="android.view.View" />
<import type="android.graphics.Typeface" />
<import type="org.linphone.core.ConsolidatedPresence" />
<import type="org.linphone.core.ChatRoom.SecurityLevel" />
<import type="org.linphone.core.SecurityLevel" />
<variable
name="model"
type="org.linphone.ui.main.history.model.CallLogModel" />
@ -60,9 +60,9 @@
android:id="@+id/trust_badge"
android:layout_width="@dimen/avatar_presence_badge_size"
android:layout_height="@dimen/avatar_presence_badge_size"
android:src="@{model.avatarModel.trust == SecurityLevel.Safe ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
android:visibility="@{model.avatarModel.trust == SecurityLevel.Safe || model.avatarModel.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
android:contentDescription="@{model.avatarModel.trust == SecurityLevel.Safe ? @string/content_description_trusted_contact_icon : @string/content_description_not_trusted_contact_icon}"
android:src="@{model.avatarModel.trust == SecurityLevel.EndToEndEncryptedAndVerified ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
android:visibility="@{model.avatarModel.trust == SecurityLevel.EndToEndEncryptedAndVerified || model.avatarModel.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
android:contentDescription="@{model.avatarModel.trust == SecurityLevel.EndToEndEncryptedAndVerified ? @string/content_description_trusted_contact_icon : @string/content_description_not_trusted_contact_icon}"
app:layout_constraintStart_toStartOf="@id/avatar"
app:layout_constraintBottom_toBottomOf="@id/avatar"/>

View file

@ -6,7 +6,7 @@
<data>
<import type="android.view.View" />
<import type="org.linphone.core.ConsolidatedPresence" />
<import type="org.linphone.core.ChatRoom.SecurityLevel" />
<import type="org.linphone.core.SecurityLevel" />
<variable
name="model"
type="org.linphone.ui.main.meetings.model.ParticipantModel" />
@ -45,9 +45,9 @@
android:id="@+id/trust_badge"
android:layout_width="@dimen/avatar_presence_badge_size"
android:layout_height="@dimen/avatar_presence_badge_size"
android:src="@{model.avatarModel.trust == SecurityLevel.Safe ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
android:visibility="@{model.avatarModel.trust == SecurityLevel.Safe || model.avatarModel.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
android:contentDescription="@{model.avatarModel.trust == SecurityLevel.Safe ? @string/content_description_trusted_contact_icon : @string/content_description_not_trusted_contact_icon}"
android:src="@{model.avatarModel.trust == SecurityLevel.EndToEndEncryptedAndVerified ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
android:visibility="@{model.avatarModel.trust == SecurityLevel.EndToEndEncryptedAndVerified || model.avatarModel.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
android:contentDescription="@{model.avatarModel.trust == SecurityLevel.EndToEndEncryptedAndVerified ? @string/content_description_trusted_contact_icon : @string/content_description_not_trusted_contact_icon}"
app:layout_constraintStart_toStartOf="@id/avatar"
app:layout_constraintBottom_toBottomOf="@id/avatar"/>

View file

@ -325,6 +325,7 @@
<string name="contact_details_company_name">Entreprise :</string>
<string name="contact_details_job_title">Poste :</string>
<string name="contact_details_trust_title">Confiance</string>
<string name="contact_details_no_device_found">Aucun appareil n\'a été trouvé…</string>
<string name="contact_details_trusted_devices_count">Appareils de confiance :</string>
<string name="contact_details_actions_title">Autres actions</string>
<string name="contact_details_edit">Modifier</string>
@ -351,7 +352,7 @@
<string name="contact_call_action">Appel</string>
<string name="contact_message_action">Message</string>
<string name="contact_video_call_action">Appel vidéo</string>
<string name="contact_make_call_check_device_trust">Vérifier les appareils</string>
<string name="contact_make_call_check_device_trust">Vérifier</string>
<string name="conversations_list_empty">Aucune conversation pour le moment…</string>
<string name="conversations_list_is_being_removed_label">En cours de suppression…</string>

View file

@ -372,6 +372,7 @@
<string name="contact_details_company_name">Company:</string>
<string name="contact_details_job_title">Job title:</string>
<string name="contact_details_trust_title">Trust</string>
<string name="contact_details_no_device_found">No device found…</string>
<string name="contact_details_trusted_devices_count">Number of trusted devices:</string>
<string name="contact_details_actions_title">Other actions</string>
<string name="contact_details_edit">Edit</string>
@ -398,7 +399,7 @@
<string name="contact_call_action">Call</string>
<string name="contact_message_action">Message</string>
<string name="contact_video_call_action">Video Call</string>
<string name="contact_make_call_check_device_trust">Verify device</string>
<string name="contact_make_call_check_device_trust">Verify</string>
<!-- Chat -->
<string name="conversations_list_empty">No conversation for the moment…</string>